Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_HANDLER_UTIL_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_HANDLER_UTIL_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_HANDLER_UTIL_H_ | 6 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_HANDLER_UTIL_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 57 bool FindCommonTasks(Profile* profile, | 57 bool FindCommonTasks(Profile* profile, |
| 58 const std::vector<GURL>& files_list, | 58 const std::vector<GURL>& files_list, |
| 59 LastUsedHandlerList* named_action_list); | 59 LastUsedHandlerList* named_action_list); |
| 60 | 60 |
| 61 // Find the default task for a file whose url is |url|. (The default task is the | 61 // Find the default task for a file whose url is |url|. (The default task is the |
| 62 // task that is assigned to file browser task button by default). | 62 // task that is assigned to file browser task button by default). |
| 63 bool GetDefaultTask(Profile* profile, | 63 bool GetDefaultTask(Profile* profile, |
| 64 const GURL& url, | 64 const GURL& url, |
| 65 const FileBrowserHandler** handler); | 65 const FileBrowserHandler** handler); |
| 66 | 66 |
| 67 // Used for executing file actions. | |
| 68 typedef base::Callback<void(const extensions::Extension*)> | |
|
satorux1
2012/06/07 22:47:17
nit: please put the parameter name.
hshi1
2012/06/08 00:22:05
Removed this definition as Toni suggested to get t
| |
| 69 ExecuteFileActionsCallback; | |
| 70 | |
| 67 // Helper class for executing file browser file action. | 71 // Helper class for executing file browser file action. |
| 68 class FileTaskExecutor : public base::RefCountedThreadSafe<FileTaskExecutor> { | 72 class FileTaskExecutor : public base::RefCountedThreadSafe<FileTaskExecutor> { |
| 69 public: | 73 public: |
| 70 | 74 |
| 71 FileTaskExecutor(Profile* profile, | 75 FileTaskExecutor(Profile* profile, |
| 72 const GURL source_url, | 76 const GURL source_url, |
| 73 const std::string& extension_id, | 77 const std::string& extension_id, |
| 74 const std::string& action_id); | 78 const std::string& action_id); |
| 75 | 79 |
| 76 virtual ~FileTaskExecutor(); | 80 virtual ~FileTaskExecutor(); |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 99 | 103 |
| 100 typedef std::vector<FileDefinition> FileDefinitionList; | 104 typedef std::vector<FileDefinition> FileDefinitionList; |
| 101 class ExecuteTasksFileSystemCallbackDispatcher; | 105 class ExecuteTasksFileSystemCallbackDispatcher; |
| 102 void RequestFileEntryOnFileThread( | 106 void RequestFileEntryOnFileThread( |
| 103 const GURL& handler_base_url, | 107 const GURL& handler_base_url, |
| 104 const scoped_refptr<const extensions::Extension>& handler, | 108 const scoped_refptr<const extensions::Extension>& handler, |
| 105 int handler_pid, | 109 int handler_pid, |
| 106 const std::vector<GURL>& file_urls); | 110 const std::vector<GURL>& file_urls); |
| 107 | 111 |
| 108 void ExecuteFailedOnUIThread(); | 112 void ExecuteFailedOnUIThread(); |
| 109 void ExecuteFileActionsOnUIThread(const std::string& file_system_name, | 113 void ExecuteFileActionsOnUIThread( |
| 110 const GURL& file_system_root, | 114 const FileDefinitionList& file_list, |
| 111 const FileDefinitionList& file_list, | 115 const ExecuteFileActionsCallback& callback); |
| 112 int handler_id); | |
| 113 void SetupPermissionsAndDispatchEvent(const std::string& file_system_name, | 116 void SetupPermissionsAndDispatchEvent(const std::string& file_system_name, |
| 114 const GURL& file_system_root, | 117 const GURL& file_system_root, |
| 115 const FileDefinitionList& file_list, | 118 const FileDefinitionList& file_list, |
| 116 int handler_pid_in, | 119 int handler_pid_in, |
| 117 ExtensionHost* host); | 120 ExtensionHost* host); |
| 118 | 121 |
| 119 // Populates |handler_host_permissions| with file path-permissions pairs that | 122 // Populates |handler_host_permissions| with file path-permissions pairs that |
| 120 // will be given to the handler extension host process. | 123 // will be given to the handler extension host process. |
| 121 void InitHandlerHostFileAccessPermissions( | 124 void InitHandlerHostFileAccessPermissions( |
| 122 const FileDefinitionList& file_list, | 125 const FileDefinitionList& file_list, |
| 123 const extensions::Extension* handler_extension, | 126 const extensions::Extension* handler_extension, |
| 124 const std::string& action_id); | 127 const std::string& action_id, |
| 128 const ExecuteFileActionsCallback& callback); | |
| 129 | |
| 130 // Invoked upon completion of InitHandlerHostFileAccessPermissions initiated | |
| 131 // by ExecuteFileActionsOnUIThread. | |
| 132 void OnInitAccessForExecuteFileActionsOnUIThread( | |
| 133 const std::string& file_system_name, | |
| 134 const GURL& file_system_root, | |
| 135 const FileDefinitionList& file_list, | |
| 136 int handler_pid, | |
| 137 const extensions::Extension* extension); | |
| 138 | |
| 125 // Registers file permissions from |handler_host_permissions_| with | 139 // Registers file permissions from |handler_host_permissions_| with |
| 126 // ChildProcessSecurityPolicy for process with id |handler_pid|. | 140 // ChildProcessSecurityPolicy for process with id |handler_pid|. |
| 127 void SetupHandlerHostFileAccessPermissions(int handler_pid); | 141 void SetupHandlerHostFileAccessPermissions(int handler_pid); |
| 128 | 142 |
| 129 Profile* profile_; | 143 Profile* profile_; |
| 130 const GURL source_url_; | 144 const GURL source_url_; |
| 131 const std::string extension_id_; | 145 const std::string extension_id_; |
| 132 const std::string action_id_; | 146 const std::string action_id_; |
| 133 | 147 |
| 134 // (File path, permission for file path) pairs for the handler. | 148 // (File path, permission for file path) pairs for the handler. |
| 135 std::vector<std::pair<FilePath, int> > handler_host_permissions_; | 149 std::vector<std::pair<FilePath, int> > handler_host_permissions_; |
| 136 }; | 150 }; |
| 137 | 151 |
| 138 } // namespace file_handler_util | 152 } // namespace file_handler_util |
| 139 | 153 |
| 140 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_HANDLER_UTIL_H_ | 154 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_HANDLER_UTIL_H_ |
| OLD | NEW |