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

Side by Side Diff: chrome/browser/renderer_host/pepper/pepper_isolated_file_system_message_filter.cc

Issue 2479593006: Move enable extensions define to a build flag. (Closed)
Patch Set: Merge Created 4 years, 1 month 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 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 #include "chrome/browser/renderer_host/pepper/pepper_isolated_file_system_messag e_filter.h" 5 #include "chrome/browser/renderer_host/pepper/pepper_isolated_file_system_messag e_filter.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
11 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/browser/profiles/profile_manager.h" 12 #include "chrome/browser/profiles/profile_manager.h"
13 #include "chrome/common/chrome_switches.h" 13 #include "chrome/common/chrome_switches.h"
14 #include "chrome/common/pepper_permission_util.h" 14 #include "chrome/common/pepper_permission_util.h"
15 #include "content/public/browser/browser_ppapi_host.h" 15 #include "content/public/browser/browser_ppapi_host.h"
16 #include "content/public/browser/browser_thread.h" 16 #include "content/public/browser/browser_thread.h"
17 #include "content/public/browser/child_process_security_policy.h" 17 #include "content/public/browser/child_process_security_policy.h"
18 #include "content/public/browser/render_view_host.h" 18 #include "content/public/browser/render_view_host.h"
19 #if defined(ENABLE_EXTENSIONS) 19 #include "extensions/features/features.h"
20 #include "extensions/browser/extension_registry.h"
21 #include "extensions/common/constants.h"
22 #include "extensions/common/extension.h"
23 #include "extensions/common/extension_set.h"
24 #endif
25 #include "ppapi/c/pp_errors.h" 20 #include "ppapi/c/pp_errors.h"
26 #include "ppapi/host/dispatch_host_message.h" 21 #include "ppapi/host/dispatch_host_message.h"
27 #include "ppapi/host/host_message_context.h" 22 #include "ppapi/host/host_message_context.h"
28 #include "ppapi/host/ppapi_host.h" 23 #include "ppapi/host/ppapi_host.h"
29 #include "ppapi/proxy/ppapi_messages.h" 24 #include "ppapi/proxy/ppapi_messages.h"
30 #include "ppapi/shared_impl/file_system_util.h" 25 #include "ppapi/shared_impl/file_system_util.h"
31 #include "storage/browser/fileapi/isolated_context.h" 26 #include "storage/browser/fileapi/isolated_context.h"
32 27
28 #if BUILDFLAG(ENABLE_EXTENSIONS)
29 #include "extensions/browser/extension_registry.h"
30 #include "extensions/common/constants.h"
31 #include "extensions/common/extension.h"
32 #include "extensions/common/extension_set.h"
33 #endif
34
33 namespace chrome { 35 namespace chrome {
34 36
35 namespace { 37 namespace {
36 38
37 const char* kPredefinedAllowedCrxFsOrigins[] = { 39 const char* kPredefinedAllowedCrxFsOrigins[] = {
38 "6EAED1924DB611B6EEF2A664BD077BE7EAD33B8F", // see crbug.com/234789 40 "6EAED1924DB611B6EEF2A664BD077BE7EAD33B8F", // see crbug.com/234789
39 "4EB74897CB187C7633357C2FE832E0AD6A44883A" // see crbug.com/234789 41 "4EB74897CB187C7633357C2FE832E0AD6A44883A" // see crbug.com/234789
40 }; 42 };
41 43
42 } // namespace 44 } // namespace
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 } 97 }
96 98
97 Profile* PepperIsolatedFileSystemMessageFilter::GetProfile() { 99 Profile* PepperIsolatedFileSystemMessageFilter::GetProfile() {
98 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 100 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
99 ProfileManager* profile_manager = g_browser_process->profile_manager(); 101 ProfileManager* profile_manager = g_browser_process->profile_manager();
100 return profile_manager->GetProfile(profile_directory_); 102 return profile_manager->GetProfile(profile_directory_);
101 } 103 }
102 104
103 std::string PepperIsolatedFileSystemMessageFilter::CreateCrxFileSystem( 105 std::string PepperIsolatedFileSystemMessageFilter::CreateCrxFileSystem(
104 Profile* profile) { 106 Profile* profile) {
105 #if defined(ENABLE_EXTENSIONS) 107 #if BUILDFLAG(ENABLE_EXTENSIONS)
106 const extensions::Extension* extension = 108 const extensions::Extension* extension =
107 extensions::ExtensionRegistry::Get(profile)->enabled_extensions().GetByID( 109 extensions::ExtensionRegistry::Get(profile)->enabled_extensions().GetByID(
108 document_url_.host()); 110 document_url_.host());
109 if (!extension) 111 if (!extension)
110 return std::string(); 112 return std::string();
111 113
112 // First level directory for isolated filesystem to lookup. 114 // First level directory for isolated filesystem to lookup.
113 std::string kFirstLevelDirectory("crxfs"); 115 std::string kFirstLevelDirectory("crxfs");
114 return storage::IsolatedContext::GetInstance()->RegisterFileSystemForPath( 116 return storage::IsolatedContext::GetInstance()->RegisterFileSystemForPath(
115 storage::kFileSystemTypeNativeLocal, 117 storage::kFileSystemTypeNativeLocal,
(...skipping 17 matching lines...) Expand all
133 return OpenPluginPrivateFileSystem(context); 135 return OpenPluginPrivateFileSystem(context);
134 } 136 }
135 NOTREACHED(); 137 NOTREACHED();
136 context->reply_msg = 138 context->reply_msg =
137 PpapiPluginMsg_IsolatedFileSystem_BrowserOpenReply(std::string()); 139 PpapiPluginMsg_IsolatedFileSystem_BrowserOpenReply(std::string());
138 return PP_ERROR_FAILED; 140 return PP_ERROR_FAILED;
139 } 141 }
140 142
141 int32_t PepperIsolatedFileSystemMessageFilter::OpenCrxFileSystem( 143 int32_t PepperIsolatedFileSystemMessageFilter::OpenCrxFileSystem(
142 ppapi::host::HostMessageContext* context) { 144 ppapi::host::HostMessageContext* context) {
143 #if defined(ENABLE_EXTENSIONS) 145 #if BUILDFLAG(ENABLE_EXTENSIONS)
144 Profile* profile = GetProfile(); 146 Profile* profile = GetProfile();
145 const extensions::ExtensionSet* extension_set = NULL; 147 const extensions::ExtensionSet* extension_set = NULL;
146 if (profile) { 148 if (profile) {
147 extension_set = 149 extension_set =
148 &extensions::ExtensionRegistry::Get(profile)->enabled_extensions(); 150 &extensions::ExtensionRegistry::Get(profile)->enabled_extensions();
149 } 151 }
150 if (!IsExtensionOrSharedModuleWhitelisted( 152 if (!IsExtensionOrSharedModuleWhitelisted(
151 document_url_, extension_set, allowed_crxfs_origins_) && 153 document_url_, extension_set, allowed_crxfs_origins_) &&
152 !IsHostAllowedByCommandLine( 154 !IsHostAllowedByCommandLine(
153 document_url_, extension_set, switches::kAllowNaClCrxFsAPI)) { 155 document_url_, extension_set, switches::kAllowNaClCrxFsAPI)) {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 // Grant full access of isolated filesystem to renderer process. 195 // Grant full access of isolated filesystem to renderer process.
194 content::ChildProcessSecurityPolicy* policy = 196 content::ChildProcessSecurityPolicy* policy =
195 content::ChildProcessSecurityPolicy::GetInstance(); 197 content::ChildProcessSecurityPolicy::GetInstance();
196 policy->GrantCreateReadWriteFileSystem(render_process_id_, fsid); 198 policy->GrantCreateReadWriteFileSystem(render_process_id_, fsid);
197 199
198 context->reply_msg = PpapiPluginMsg_IsolatedFileSystem_BrowserOpenReply(fsid); 200 context->reply_msg = PpapiPluginMsg_IsolatedFileSystem_BrowserOpenReply(fsid);
199 return PP_OK; 201 return PP_OK;
200 } 202 }
201 203
202 } // namespace chrome 204 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698