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

Side by Side Diff: chrome/browser/extensions/chrome_extensions_browser_client.cc

Issue 1226353004: Generate all extension schema namespaces as "api" and instead vary the generated bundle names. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 5 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
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/extensions/chrome_extensions_browser_client.h" 5 #include "chrome/browser/extensions/chrome_extensions_browser_client.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/version.h" 8 #include "base/version.h"
9 #include "chrome/browser/app_mode/app_mode_utils.h" 9 #include "chrome/browser/app_mode/app_mode_utils.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 } 121 }
122 122
123 bool ChromeExtensionsBrowserClient::IsExtensionIncognitoEnabled( 123 bool ChromeExtensionsBrowserClient::IsExtensionIncognitoEnabled(
124 const std::string& extension_id, 124 const std::string& extension_id,
125 content::BrowserContext* context) const { 125 content::BrowserContext* context) const {
126 return IsGuestSession(context) 126 return IsGuestSession(context)
127 || util::IsIncognitoEnabled(extension_id, context); 127 || util::IsIncognitoEnabled(extension_id, context);
128 } 128 }
129 129
130 bool ChromeExtensionsBrowserClient::CanExtensionCrossIncognito( 130 bool ChromeExtensionsBrowserClient::CanExtensionCrossIncognito(
131 const extensions::Extension* extension, 131 const Extension* extension,
132 content::BrowserContext* context) const { 132 content::BrowserContext* context) const {
133 return IsGuestSession(context) 133 return IsGuestSession(context)
134 || util::CanCrossIncognito(extension, context); 134 || util::CanCrossIncognito(extension, context);
135 } 135 }
136 136
137 net::URLRequestJob* 137 net::URLRequestJob*
138 ChromeExtensionsBrowserClient::MaybeCreateResourceBundleRequestJob( 138 ChromeExtensionsBrowserClient::MaybeCreateResourceBundleRequestJob(
139 net::URLRequest* request, 139 net::URLRequest* request,
140 net::NetworkDelegate* network_delegate, 140 net::NetworkDelegate* network_delegate,
141 const base::FilePath& directory_path, 141 const base::FilePath& directory_path,
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 } 236 }
237 237
238 ExtensionSystemProvider* 238 ExtensionSystemProvider*
239 ChromeExtensionsBrowserClient::GetExtensionSystemFactory() { 239 ChromeExtensionsBrowserClient::GetExtensionSystemFactory() {
240 return ExtensionSystemFactory::GetInstance(); 240 return ExtensionSystemFactory::GetInstance();
241 } 241 }
242 242
243 void ChromeExtensionsBrowserClient::RegisterExtensionFunctions( 243 void ChromeExtensionsBrowserClient::RegisterExtensionFunctions(
244 ExtensionFunctionRegistry* registry) const { 244 ExtensionFunctionRegistry* registry) const {
245 // Preferences. 245 // Preferences.
246 registry->RegisterFunction<extensions::GetPreferenceFunction>(); 246 registry->RegisterFunction<GetPreferenceFunction>();
247 registry->RegisterFunction<extensions::SetPreferenceFunction>(); 247 registry->RegisterFunction<SetPreferenceFunction>();
248 registry->RegisterFunction<extensions::ClearPreferenceFunction>(); 248 registry->RegisterFunction<ClearPreferenceFunction>();
249 249
250 // Direct Preference Access for Component Extensions. 250 // Direct Preference Access for Component Extensions.
251 registry->RegisterFunction< 251 registry->RegisterFunction<chromedirectsetting::GetDirectSettingFunction>();
252 extensions::chromedirectsetting::GetDirectSettingFunction>(); 252 registry->RegisterFunction<chromedirectsetting::SetDirectSettingFunction>();
253 registry->RegisterFunction< 253 registry->RegisterFunction<chromedirectsetting::ClearDirectSettingFunction>();
254 extensions::chromedirectsetting::SetDirectSettingFunction>();
255 registry->RegisterFunction<
256 extensions::chromedirectsetting::ClearDirectSettingFunction>();
257 254
258 // Generated APIs from lower-level modules. 255 // Generated APIs from lower-level modules.
259 extensions::core_api::GeneratedFunctionRegistry::RegisterAll(registry); 256 api::GeneratedFunctionRegistry::RegisterAll(registry);
260 257
261 // Generated APIs from Chrome. 258 // Generated APIs from Chrome.
262 extensions::api::GeneratedFunctionRegistry::RegisterAll(registry); 259 api::ChromeGeneratedFunctionRegistry::RegisterAll(registry);
263 } 260 }
264 261
265 void ChromeExtensionsBrowserClient::RegisterMojoServices( 262 void ChromeExtensionsBrowserClient::RegisterMojoServices(
266 content::RenderFrameHost* render_frame_host, 263 content::RenderFrameHost* render_frame_host,
267 const Extension* extension) const { 264 const Extension* extension) const {
268 RegisterServicesForFrame(render_frame_host, extension); 265 RegisterServicesForFrame(render_frame_host, extension);
269 RegisterChromeServicesForFrame(render_frame_host, extension); 266 RegisterChromeServicesForFrame(render_frame_host, extension);
270 } 267 }
271 268
272 scoped_ptr<extensions::RuntimeAPIDelegate> 269 scoped_ptr<RuntimeAPIDelegate>
273 ChromeExtensionsBrowserClient::CreateRuntimeAPIDelegate( 270 ChromeExtensionsBrowserClient::CreateRuntimeAPIDelegate(
274 content::BrowserContext* context) const { 271 content::BrowserContext* context) const {
275 return scoped_ptr<extensions::RuntimeAPIDelegate>( 272 return scoped_ptr<RuntimeAPIDelegate>(new ChromeRuntimeAPIDelegate(context));
276 new ChromeRuntimeAPIDelegate(context));
277 } 273 }
278 274
279 const ComponentExtensionResourceManager* 275 const ComponentExtensionResourceManager*
280 ChromeExtensionsBrowserClient::GetComponentExtensionResourceManager() { 276 ChromeExtensionsBrowserClient::GetComponentExtensionResourceManager() {
281 return resource_manager_.get(); 277 return resource_manager_.get();
282 } 278 }
283 279
284 void ChromeExtensionsBrowserClient::BroadcastEventToRenderers( 280 void ChromeExtensionsBrowserClient::BroadcastEventToRenderers(
285 events::HistogramValue histogram_value, 281 events::HistogramValue histogram_value,
286 const std::string& event_name, 282 const std::string& event_name,
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 321
326 ExtensionWebContentsObserver* 322 ExtensionWebContentsObserver*
327 ChromeExtensionsBrowserClient::GetExtensionWebContentsObserver( 323 ChromeExtensionsBrowserClient::GetExtensionWebContentsObserver(
328 content::WebContents* web_contents) { 324 content::WebContents* web_contents) {
329 return ChromeExtensionWebContentsObserver::FromWebContents(web_contents); 325 return ChromeExtensionWebContentsObserver::FromWebContents(web_contents);
330 } 326 }
331 327
332 void ChromeExtensionsBrowserClient::ReportError( 328 void ChromeExtensionsBrowserClient::ReportError(
333 content::BrowserContext* context, 329 content::BrowserContext* context,
334 scoped_ptr<ExtensionError> error) { 330 scoped_ptr<ExtensionError> error) {
335 extensions::ErrorConsole::Get(context)->ReportError(error.Pass()); 331 ErrorConsole::Get(context)->ReportError(error.Pass());
336 } 332 }
337 333
338 void ChromeExtensionsBrowserClient::CleanUpWebView(int embedder_process_id, 334 void ChromeExtensionsBrowserClient::CleanUpWebView(int embedder_process_id,
339 int view_instance_id) { 335 int view_instance_id) {
340 content::BrowserContext* browser_context = 336 content::BrowserContext* browser_context =
341 content::RenderProcessHost::FromID(embedder_process_id) 337 content::RenderProcessHost::FromID(embedder_process_id)
342 ->GetBrowserContext(); 338 ->GetBrowserContext();
343 339
344 // Clean up context menus for the WebView. 340 // Clean up context menus for the WebView.
345 auto menu_manager = 341 auto menu_manager =
346 MenuManager::Get(Profile::FromBrowserContext(browser_context)); 342 MenuManager::Get(Profile::FromBrowserContext(browser_context));
347 menu_manager->RemoveAllContextItems( 343 menu_manager->RemoveAllContextItems(
348 MenuItem::ExtensionKey("", embedder_process_id, view_instance_id)); 344 MenuItem::ExtensionKey("", embedder_process_id, view_instance_id));
349 } 345 }
350 346
351 } // namespace extensions 347 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/chrome_extensions_browser_client.h ('k') | chrome/browser/extensions/display_info_provider_aura.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698