Chromium Code Reviews| Index: chrome/browser/chromeos/extensions/file_handler_util.h |
| diff --git a/chrome/browser/chromeos/extensions/file_handler_util.h b/chrome/browser/chromeos/extensions/file_handler_util.h |
| index 899f36bf98017f3101804cd624e4977638209141..71ab69a91c9cd80e7479d34871dfa99e96ed8ed1 100644 |
| --- a/chrome/browser/chromeos/extensions/file_handler_util.h |
| +++ b/chrome/browser/chromeos/extensions/file_handler_util.h |
| @@ -6,9 +6,13 @@ |
| #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_HANDLER_UTIL_H_ |
| #pragma once |
| +#include <vector> |
| + |
| #include "base/platform_file.h" |
| #include "chrome/common/extensions/extension.h" |
| #include "chrome/common/extensions/url_pattern_set.h" |
| +#include "content/public/browser/notification_observer.h" |
| +#include "content/public/browser/notification_registrar.h" |
| class Browser; |
| class FileBrowserHandler; |
| @@ -60,7 +64,8 @@ bool GetDefaultTask(Profile* profile, |
| const FileBrowserHandler** handler); |
| // Helper class for executing file browser file action. |
| -class FileTaskExecutor : public base::RefCountedThreadSafe<FileTaskExecutor> { |
| +class FileTaskExecutor : public base::RefCountedThreadSafe<FileTaskExecutor>, |
| + public content::NotificationObserver { |
| public: |
| FileTaskExecutor(Profile* profile, |
| @@ -89,6 +94,7 @@ class FileTaskExecutor : public base::RefCountedThreadSafe<FileTaskExecutor> { |
| FilePath absolute_path; |
| bool is_directory; |
| }; |
| + |
| typedef std::vector<FileDefinition> FileDefinitionList; |
| class ExecuteTasksFileSystemCallbackDispatcher; |
| void RequestFileEntryOnFileThread( |
| @@ -96,20 +102,43 @@ class FileTaskExecutor : public base::RefCountedThreadSafe<FileTaskExecutor> { |
| const scoped_refptr<const Extension>& handler, |
| int handler_pid, |
| const std::vector<GURL>& file_urls); |
| - void SetupFileAccessPermissionsForGDataCache( |
| - const FileDefinitionList& file_list, |
| - int handler_pid); |
| - void RespondFailedOnUIThread(base::PlatformFileError error_code); |
| + |
| + void ExecuteFailedOnUIThread(); |
| void ExecuteFileActionsOnUIThread(const std::string& file_system_name, |
| const GURL& file_system_root, |
| const FileDefinitionList& file_list, |
| int handler_id); |
| - void ExecuteFailedOnUIThread(); |
| + |
| + // Populates |handler_host_permissions| with file path-permissions pairs that |
| + // will be given to the handler extension host process. |
| + void InitHandlerHostFileAccessPermissions( |
| + const FileDefinitionList& file_list, |
| + const Extension* handler_extension, |
| + const std::string& action_id); |
|
Matt Perry
2012/04/13 18:45:17
add blank line here
|
| + // Registers file permissions from |handler_host_permissions_| with |
| + // ChildProcessSecurityPolicy for process with id |handler_pid|. |
| + void SetupHandlerHostFileAccessPermissions(int handler_pid); |
| + |
| + // If the handler has lazy background page, we'll have to wait until the |
| + // extension host is loaded until we can setup file access permissions. To do |
| + // that, we'll have to listen for notifications. |
| + // Registers notifications we listen to. |
| + void RegisterNotificationObservers(); |
| + |
| + // content::NotificationObserver interface. |
| + // Called when observed notification is detected. |
| + virtual void Observe(int type, |
| + const content::NotificationSource& source, |
| + const content::NotificationDetails& details) OVERRIDE; |
| Profile* profile_; |
| const GURL source_url_; |
| const std::string extension_id_; |
| const std::string action_id_; |
| + |
| + // (File path, permission for file path) pairs for the handler. |
| + std::vector<std::pair<FilePath, int> > handler_host_permissions_; |
| + content::NotificationRegistrar registrar_; |
| }; |
| } // namespace file_handler_util |