Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(958)

Side by Side Diff: chrome/browser/chromeos/extensions/file_handler_util.h

Issue 10067021: Postpone setting up file handler's file permissions if handler is running lazy background page. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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>
10
9 #include "base/platform_file.h" 11 #include "base/platform_file.h"
10 #include "chrome/common/extensions/extension.h" 12 #include "chrome/common/extensions/extension.h"
11 #include "chrome/common/extensions/url_pattern_set.h" 13 #include "chrome/common/extensions/url_pattern_set.h"
12 14
13 class Browser; 15 class Browser;
16 class ExtensionHost;
14 class FileBrowserHandler; 17 class FileBrowserHandler;
15 class GURL; 18 class GURL;
16 class Profile; 19 class Profile;
17 20
18 namespace file_handler_util { 21 namespace file_handler_util {
19 22
20 // Gets read-write file access permission flags. 23 // Gets read-write file access permission flags.
21 int GetReadWritePermissions(); 24 int GetReadWritePermissions();
22 // Gets read-only file access permission flags. 25 // Gets read-only file access permission flags.
23 int GetReadOnlyPermissions(); 26 int GetReadOnlyPermissions();
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 private: 85 private:
83 struct FileDefinition { 86 struct FileDefinition {
84 FileDefinition(); 87 FileDefinition();
85 ~FileDefinition(); 88 ~FileDefinition();
86 89
87 GURL target_file_url; 90 GURL target_file_url;
88 FilePath virtual_path; 91 FilePath virtual_path;
89 FilePath absolute_path; 92 FilePath absolute_path;
90 bool is_directory; 93 bool is_directory;
91 }; 94 };
95
92 typedef std::vector<FileDefinition> FileDefinitionList; 96 typedef std::vector<FileDefinition> FileDefinitionList;
93 class ExecuteTasksFileSystemCallbackDispatcher; 97 class ExecuteTasksFileSystemCallbackDispatcher;
94 void RequestFileEntryOnFileThread( 98 void RequestFileEntryOnFileThread(
95 const GURL& handler_base_url, 99 const GURL& handler_base_url,
96 const scoped_refptr<const Extension>& handler, 100 const scoped_refptr<const Extension>& handler,
97 int handler_pid, 101 int handler_pid,
98 const std::vector<GURL>& file_urls); 102 const std::vector<GURL>& file_urls);
99 void SetupFileAccessPermissionsForGDataCache( 103
100 const FileDefinitionList& file_list, 104 void ExecuteFailedOnUIThread();
101 int handler_pid);
102 void RespondFailedOnUIThread(base::PlatformFileError error_code);
103 void ExecuteFileActionsOnUIThread(const std::string& file_system_name, 105 void ExecuteFileActionsOnUIThread(const std::string& file_system_name,
104 const GURL& file_system_root, 106 const GURL& file_system_root,
105 const FileDefinitionList& file_list, 107 const FileDefinitionList& file_list,
106 int handler_id); 108 int handler_id);
107 void ExecuteFailedOnUIThread(); 109 void SetupPermissionsAndDispatchEvent(const std::string& file_system_name,
110 const GURL& file_system_root,
111 const FileDefinitionList& file_list,
112 int handler_pid_in,
113 ExtensionHost* host);
114
115 // Populates |handler_host_permissions| with file path-permissions pairs that
116 // will be given to the handler extension host process.
117 void InitHandlerHostFileAccessPermissions(
118 const FileDefinitionList& file_list,
119 const Extension* handler_extension,
120 const std::string& action_id);
121 // Registers file permissions from |handler_host_permissions_| with
122 // ChildProcessSecurityPolicy for process with id |handler_pid|.
123 void SetupHandlerHostFileAccessPermissions(int handler_pid);
108 124
109 Profile* profile_; 125 Profile* profile_;
110 const GURL source_url_; 126 const GURL source_url_;
111 const std::string extension_id_; 127 const std::string extension_id_;
112 const std::string action_id_; 128 const std::string action_id_;
129
130 // (File path, permission for file path) pairs for the handler.
131 std::vector<std::pair<FilePath, int> > handler_host_permissions_;
113 }; 132 };
114 133
115 } // namespace file_handler_util 134 } // namespace file_handler_util
116 135
117 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_HANDLER_UTIL_H_ 136 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_HANDLER_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698