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

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

Issue 12612011: Allow NaCl plugin to be loaded from hosted app URLs. (Closed) Base URL: https://src.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 9 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 (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 528 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 const Extension* extension = 539 const Extension* extension =
540 extension_dispatcher_->extensions()->GetExtensionOrAppByURL( 540 extension_dispatcher_->extensions()->GetExtensionOrAppByURL(
541 ExtensionURLInfo(manifest_url)); 541 ExtensionURLInfo(manifest_url));
542 bool is_extension_from_webstore = 542 bool is_extension_from_webstore =
543 extension && extension->from_webstore(); 543 extension && extension->from_webstore();
544 // Allow built-in extensions and extensions under development. 544 // Allow built-in extensions and extensions under development.
545 bool is_extension_unrestricted = extension && 545 bool is_extension_unrestricted = extension &&
546 (extension->location() == extensions::Manifest::COMPONENT || 546 (extension->location() == extensions::Manifest::COMPONENT ||
547 extensions::Manifest::IsUnpackedLocation(extension->location())); 547 extensions::Manifest::IsUnpackedLocation(extension->location()));
548 GURL top_url = frame->top()->document().url(); 548 GURL top_url = frame->top()->document().url();
549 if (!IsNaClAllowed(manifest_url, 549 bool is_invoked_by_hosted_app = extension &&
550 extension->is_hosted_app() &&
551 extension->web_extent().MatchesURL(top_url);
552 if (!is_invoked_by_hosted_app &&
Matt Perry 2013/03/12 22:23:22 I would pass |extension| as a parameter to IsNaclA
553 !IsNaClAllowed(manifest_url,
550 top_url, 554 top_url,
551 is_nacl_unrestricted, 555 is_nacl_unrestricted,
552 is_extension_unrestricted, 556 is_extension_unrestricted,
553 is_extension_from_webstore, 557 is_extension_from_webstore,
554 &params)) { 558 &params)) {
555 frame->addMessageToConsole( 559 frame->addMessageToConsole(
556 WebConsoleMessage( 560 WebConsoleMessage(
557 WebConsoleMessage::LevelError, 561 WebConsoleMessage::LevelError,
558 "Only unpacked extensions and apps installed from the " 562 "Only unpacked extensions and apps installed from the "
559 "Chrome Web Store can load NaCl modules without enabling " 563 "Chrome Web Store can load NaCl modules without enabling "
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after
1122 if (container->element().shadowHost().tagName().equals( 1126 if (container->element().shadowHost().tagName().equals(
1123 WebKit::WebString::fromUTF8(kWebViewTagName))) { 1127 WebKit::WebString::fromUTF8(kWebViewTagName))) {
1124 return true; 1128 return true;
1125 } else { 1129 } else {
1126 return CommandLine::ForCurrentProcess()->HasSwitch( 1130 return CommandLine::ForCurrentProcess()->HasSwitch(
1127 switches::kEnableBrowserPluginForAllViewTypes); 1131 switches::kEnableBrowserPluginForAllViewTypes);
1128 } 1132 }
1129 } 1133 }
1130 1134
1131 } // namespace chrome 1135 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698