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
5package org.chromium.chrome.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}
28