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

Side by Side Diff: chrome/renderer/chrome_content_renderer_client.cc

Issue 12093036: Move Extension Location and Type enums to Manifest, and move InstallWarning to its own file. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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
« no previous file with comments | « chrome/common/extensions/unpacker_unittest.cc ('k') | chrome/renderer/extensions/dispatcher.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "chrome/renderer/chrome_content_renderer_client.h" 5 #include "chrome/renderer/chrome_content_renderer_client.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 342
343 SkBitmap* ChromeContentRendererClient::GetSadWebViewBitmap() { 343 SkBitmap* ChromeContentRendererClient::GetSadWebViewBitmap() {
344 return const_cast<SkBitmap*>(ResourceBundle::GetSharedInstance(). 344 return const_cast<SkBitmap*>(ResourceBundle::GetSharedInstance().
345 GetImageNamed(IDR_SAD_WEBVIEW).ToSkBitmap()); 345 GetImageNamed(IDR_SAD_WEBVIEW).ToSkBitmap());
346 } 346 }
347 347
348 std::string ChromeContentRendererClient::GetDefaultEncoding() { 348 std::string ChromeContentRendererClient::GetDefaultEncoding() {
349 return l10n_util::GetStringUTF8(IDS_DEFAULT_ENCODING); 349 return l10n_util::GetStringUTF8(IDS_DEFAULT_ENCODING);
350 } 350 }
351 351
352 const extensions::Extension* ChromeContentRendererClient::GetExtension( 352 const Extension* ChromeContentRendererClient::GetExtension(
353 const WebSecurityOrigin& origin) const { 353 const WebSecurityOrigin& origin) const {
354 if (!EqualsASCII(origin.protocol(), extensions::kExtensionScheme)) 354 if (!EqualsASCII(origin.protocol(), extensions::kExtensionScheme))
355 return NULL; 355 return NULL;
356 356
357 const std::string extension_id = origin.host().utf8().data(); 357 const std::string extension_id = origin.host().utf8().data();
358 if (!extension_dispatcher_->IsExtensionActive(extension_id)) 358 if (!extension_dispatcher_->IsExtensionActive(extension_id))
359 return NULL; 359 return NULL;
360 360
361 return extension_dispatcher_->extensions()->GetByID(extension_id); 361 return extension_dispatcher_->extensions()->GetByID(extension_id);
362 } 362 }
363 363
364 bool ChromeContentRendererClient::OverrideCreatePlugin( 364 bool ChromeContentRendererClient::OverrideCreatePlugin(
365 content::RenderView* render_view, 365 content::RenderView* render_view,
366 WebFrame* frame, 366 WebFrame* frame,
367 const WebPluginParams& params, 367 const WebPluginParams& params,
368 WebPlugin** plugin) { 368 WebPlugin** plugin) {
369 std::string orig_mime_type = params.mimeType.utf8(); 369 std::string orig_mime_type = params.mimeType.utf8();
370 if (orig_mime_type == content::kBrowserPluginMimeType) { 370 if (orig_mime_type == content::kBrowserPluginMimeType) {
371 if (CommandLine::ForCurrentProcess()->HasSwitch( 371 if (CommandLine::ForCurrentProcess()->HasSwitch(
372 switches::kEnableBrowserPluginForAllViewTypes)) 372 switches::kEnableBrowserPluginForAllViewTypes))
373 return false; 373 return false;
374 WebDocument document = frame->document(); 374 WebDocument document = frame->document();
375 const extensions::Extension* extension = 375 const Extension* extension =
376 GetExtension(document.securityOrigin()); 376 GetExtension(document.securityOrigin());
377 if (extension && extension->HasAPIPermission( 377 if (extension && extension->HasAPIPermission(
378 extensions::APIPermission::kWebView)) 378 extensions::APIPermission::kWebView))
379 return false; 379 return false;
380 } 380 }
381 381
382 ChromeViewHostMsg_GetPluginInfo_Output output; 382 ChromeViewHostMsg_GetPluginInfo_Output output;
383 #if defined(ENABLE_PLUGINS) 383 #if defined(ENABLE_PLUGINS)
384 render_view->Send(new ChromeViewHostMsg_GetPluginInfo( 384 render_view->Send(new ChromeViewHostMsg_GetPluginInfo(
385 render_view->GetRoutingID(), GURL(params.url), 385 render_view->GetRoutingID(), GURL(params.url),
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 if (is_nacl_plugin || is_nacl_mime_type) { 513 if (is_nacl_plugin || is_nacl_mime_type) {
514 GURL manifest_url = is_nacl_mime_type ? 514 GURL manifest_url = is_nacl_mime_type ?
515 url : GetNaClContentHandlerURL(actual_mime_type, plugin); 515 url : GetNaClContentHandlerURL(actual_mime_type, plugin);
516 const Extension* extension = 516 const Extension* extension =
517 extension_dispatcher_->extensions()->GetExtensionOrAppByURL( 517 extension_dispatcher_->extensions()->GetExtensionOrAppByURL(
518 ExtensionURLInfo(manifest_url)); 518 ExtensionURLInfo(manifest_url));
519 bool is_extension_from_webstore = 519 bool is_extension_from_webstore =
520 extension && extension->from_webstore(); 520 extension && extension->from_webstore();
521 // Allow built-in extensions and extensions under development. 521 // Allow built-in extensions and extensions under development.
522 bool is_extension_unrestricted = extension && 522 bool is_extension_unrestricted = extension &&
523 (extension->location() == Extension::COMPONENT || 523 (extension->location() == extensions::Manifest::COMPONENT ||
524 extension->location() == Extension::LOAD); 524 extension->location() == extensions::Manifest::LOAD);
525 GURL top_url = frame->top()->document().url(); 525 GURL top_url = frame->top()->document().url();
526 if (!IsNaClAllowed(manifest_url, 526 if (!IsNaClAllowed(manifest_url,
527 top_url, 527 top_url,
528 is_nacl_unrestricted, 528 is_nacl_unrestricted,
529 is_extension_unrestricted, 529 is_extension_unrestricted,
530 is_extension_from_webstore, 530 is_extension_from_webstore,
531 &params)) { 531 &params)) {
532 frame->addMessageToConsole( 532 frame->addMessageToConsole(
533 WebConsoleMessage( 533 WebConsoleMessage(
534 WebConsoleMessage::LevelError, 534 WebConsoleMessage::LevelError,
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after
1055 } 1055 }
1056 1056
1057 void ChromeContentRendererClient::RegisterPPAPIInterfaceFactories( 1057 void ChromeContentRendererClient::RegisterPPAPIInterfaceFactories(
1058 webkit::ppapi::PpapiInterfaceFactoryManager* factory_manager) { 1058 webkit::ppapi::PpapiInterfaceFactoryManager* factory_manager) {
1059 #if defined(ENABLE_PLUGINS) 1059 #if defined(ENABLE_PLUGINS)
1060 factory_manager->RegisterFactory(ChromePPAPIInterfaceFactory); 1060 factory_manager->RegisterFactory(ChromePPAPIInterfaceFactory);
1061 #endif 1061 #endif
1062 } 1062 }
1063 1063
1064 } // namespace chrome 1064 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/common/extensions/unpacker_unittest.cc ('k') | chrome/renderer/extensions/dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698