blob: 3c40796ce5a804a75127597410287dfce9e7c8c5 [file] [log] [blame]
Danesh M22398a72015-10-07 13:08:21 -07001// 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
5package com.android.browser;
6
7import android.content.Context;
8import android.net.Uri;
9import android.support.v4.content.FileProvider;
10
11import org.chromium.base.ContentUriUtils;
12
13import java.io.File;
14
15/**
16 * Utilities for translating a file into content URI.
17 */
18public 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}