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

Unified Diff: chrome/renderer/extensions/dispatcher.cc

Issue 17104003: Improvements to fatal JavaScript extension errors: (1) include the extension (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: channel restriction Created 7 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/renderer/extensions/chrome_v8_context_set.cc ('k') | chrome/renderer/extensions/module_system.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/extensions/dispatcher.cc
diff --git a/chrome/renderer/extensions/dispatcher.cc b/chrome/renderer/extensions/dispatcher.cc
index 50348c326dc3be3cd1f11e302c451aa28ddac3d9..5300d386ea10445abaf1a9430ae8d90619d1ae75 100644
--- a/chrome/renderer/extensions/dispatcher.cc
+++ b/chrome/renderer/extensions/dispatcher.cc
@@ -304,8 +304,12 @@ class ProcessInfoNativeHandler : public ChromeV8Extension {
RouteFunction("IsSendRequestDisabled",
base::Bind(&ProcessInfoNativeHandler::IsSendRequestDisabled,
base::Unretained(this)));
+ RouteFunction("HasSwitch",
+ base::Bind(&ProcessInfoNativeHandler::HasSwitch,
+ base::Unretained(this)));
}
+ private:
void GetExtensionId(const v8::FunctionCallbackInfo<v8::Value>& args) {
args.GetReturnValue().Set(v8::String::New(extension_id_.c_str()));
}
@@ -330,7 +334,13 @@ class ProcessInfoNativeHandler : public ChromeV8Extension {
}
}
- private:
+ void HasSwitch(const v8::FunctionCallbackInfo<v8::Value>& args) {
+ CHECK(args.Length() == 1 && args[0]->IsString());
+ bool has_switch = CommandLine::ForCurrentProcess()->HasSwitch(
+ *v8::String::AsciiValue(args[0]));
+ args.GetReturnValue().Set(v8::Boolean::New(has_switch));
+ }
+
std::string extension_id_;
std::string context_type_;
bool is_incognito_context_;
@@ -971,10 +981,6 @@ void Dispatcher::PopulateSourceMap() {
IDR_WEB_VIEW_EXPERIMENTAL_JS);
source_map_.RegisterSource("denyWebView", IDR_WEB_VIEW_DENY_JS);
source_map_.RegisterSource("adView", IDR_AD_VIEW_JS);
- if (CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableAdviewSrcAttribute)) {
- source_map_.RegisterSource("adViewCustom", IDR_AD_VIEW_CUSTOM_JS);
- }
source_map_.RegisterSource("denyAdView", IDR_AD_VIEW_DENY_JS);
source_map_.RegisterSource("platformApp", IDR_PLATFORM_APP_JS);
source_map_.RegisterSource("injectAppTitlebar", IDR_INJECT_APP_TITLEBAR_JS);
@@ -1114,10 +1120,6 @@ void Dispatcher::DidCreateScriptContext(
is_within_platform_app) {
if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableAdview)) {
if (extension->HasAPIPermission(APIPermission::kAdView)) {
- if (CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableAdviewSrcAttribute)) {
- module_system->Require("adViewCustom");
- }
module_system->Require("adView");
} else {
module_system->Require("denyAdView");
« no previous file with comments | « chrome/renderer/extensions/chrome_v8_context_set.cc ('k') | chrome/renderer/extensions/module_system.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698