file_manager: Move FindPreferredIcon() to drive_app_registry.h
[chromium-blink-merge.git] / chrome / browser / chromeos / extensions / file_manager / private_api_util.h
blobbe2e15e0482b4b86a2d6cd6e2bc483775667beed
1 // Copyright 2013 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 // This file provides utility functions for fileBrowserPrivate API.
7 #ifndef CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_PRIVATE_API_UTIL_H_
8 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_PRIVATE_API_UTIL_H_
10 #include "base/callback_forward.h"
11 #include "chrome/browser/google_apis/gdata_wapi_parser.h"
12 #include "url/gurl.h"
14 class ExtensionFunctionDispatcher;
15 class Profile;
17 namespace content {
18 class RenderViewHost;
21 namespace ui {
22 struct SelectedFileInfo;
25 namespace file_manager {
26 namespace util {
28 // Returns the ID of the tab associated with the dispatcher. Returns 0 on
29 // error.
30 int32 GetTabId(ExtensionFunctionDispatcher* dispatcher);
32 // Returns the local FilePath associated with |url|. If the file isn't of the
33 // type FileSystemBackend handles, returns an empty
34 // FilePath. |render_view_host| and |profile| are needed to obtain the
35 // FileSystemContext currently in use.
37 // Local paths will look like "/home/chronos/user/Downloads/foo/bar.txt" or
38 // "/special/drive/foo/bar.txt".
39 base::FilePath GetLocalPathFromURL(
40 content::RenderViewHost* render_view_host,
41 Profile* profile,
42 const GURL& url);
44 // The callback type is used for GetSelectedFileInfo().
45 typedef base::Callback<void(const std::vector<ui::SelectedFileInfo>&)>
46 GetSelectedFileInfoCallback;
48 // Option enum to control how to set the ui::SelectedFileInfo::local_path
49 // fields in GetSelectedFileInfo() for Drive files.
50 // NO_LOCAL_PATH_RESOLUTION:
51 // Does nothing. Set the Drive path as-is.
52 // NEED_LOCAL_PATH_FOR_OPENING:
53 // Sets the path to a local cache file.
54 // NEED_LOCAL_PATH_FOR_SAVING:
55 // Sets the path to a local cache file. Modification to the file is monitored
56 // and automatically synced to the Drive server.
57 enum GetSelectedFileInfoLocalPathOption {
58 NO_LOCAL_PATH_RESOLUTION,
59 NEED_LOCAL_PATH_FOR_OPENING,
60 NEED_LOCAL_PATH_FOR_SAVING,
63 // Gets the information for |file_urls|.
64 void GetSelectedFileInfo(content::RenderViewHost* render_view_host,
65 Profile* profile,
66 const std::vector<GURL>& file_urls,
67 GetSelectedFileInfoLocalPathOption local_path_option,
68 GetSelectedFileInfoCallback callback);
70 } // namespace util
71 } // namespace file_manager
73 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_PRIVATE_API_UTIL_H_