Danesh M | 22398a7 | 2015-10-07 13:08:21 -0700 | [diff] [blame] | 1 | // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | package com.android.browser; |
| 6 | |
| 7 | import android.content.Context; |
| 8 | import android.net.Uri; |
| 9 | import android.support.v4.content.FileProvider; |
| 10 | |
| 11 | import org.chromium.base.ContentUriUtils; |
| 12 | |
| 13 | import java.io.File; |
| 14 | |
| 15 | /** |
| 16 | * Utilities for translating a file into content URI. |
| 17 | */ |
| 18 | public class FileProviderHelper implements ContentUriUtils.FileProviderUtil { |
| 19 | // Keep this variable in sync with the value defined in file_paths.xml. |
| 20 | private static final String API_AUTHORITY_SUFFIX = ".FileProvider"; |
| 21 | |
| 22 | @Override |
| 23 | public Uri getContentUriFromFile(Context context, File file) { |
| 24 | return FileProvider.getUriForFile(context, |
| 25 | context.getPackageName() + API_AUTHORITY_SUFFIX, file); |
| 26 | } |
| 27 | } |