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

Side by Side Diff: chrome/renderer/extensions/dispatcher.cc

Issue 138563005: <webview>: Inject denyWebView into all extensions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments Created 6 years, 11 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
« no previous file with comments | « no previous file | no next file » | 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/extensions/dispatcher.h" 5 #include "chrome/renderer/extensions/dispatcher.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/debug/alias.h" 9 #include "base/debug/alias.h"
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
(...skipping 1168 matching lines...) Expand 10 before | Expand all | Expand 10 after
1179 } 1179 }
1180 1180
1181 if (context_type == Feature::BLESSED_EXTENSION_CONTEXT && 1181 if (context_type == Feature::BLESSED_EXTENSION_CONTEXT &&
1182 is_within_platform_app && 1182 is_within_platform_app &&
1183 GetCurrentChannel() <= chrome::VersionInfo::CHANNEL_DEV && 1183 GetCurrentChannel() <= chrome::VersionInfo::CHANNEL_DEV &&
1184 CommandLine::ForCurrentProcess()->HasSwitch( 1184 CommandLine::ForCurrentProcess()->HasSwitch(
1185 ::switches::kEnableAppWindowControls)) { 1185 ::switches::kEnableAppWindowControls)) {
1186 module_system->Require("windowControls"); 1186 module_system->Require("windowControls");
1187 } 1187 }
1188 1188
1189 // Currently only platform apps and whitelisted component extensions support
1190 // the <webview> tag, because the "denyWebView" module will affect the
1191 // performance of DOM modifications (http://crbug.com/196453).
1192 // We used to limit WebView to |BLESSED_EXTENSION_CONTEXT| within platform 1189 // We used to limit WebView to |BLESSED_EXTENSION_CONTEXT| within platform
1193 // apps. An ext/app runs in a blessed extension context, if it is the active 1190 // apps. An ext/app runs in a blessed extension context, if it is the active
1194 // extension in the current process, in other words, if it is loaded in a top 1191 // extension in the current process, in other words, if it is loaded in a top
1195 // frame. To support webview in a non-frame extension, we have to allow 1192 // frame. To support webview in a non-frame extension, we have to allow
1196 // unblessed extension context as well. 1193 // unblessed extension context as well.
1197 if (context_type == Feature::BLESSED_EXTENSION_CONTEXT || 1194 // Note: setting up the WebView class here, not the chrome.webview API.
1198 context_type == Feature::UNBLESSED_EXTENSION_CONTEXT) { 1195 // The API will be automatically set up when first used.
1199 // Note: setting up the WebView class here, not the chrome.webview API. 1196 if (extension) {
1200 // The API will be automatically set up when first used.
1201 if (extension->HasAPIPermission(APIPermission::kWebView)) { 1197 if (extension->HasAPIPermission(APIPermission::kWebView)) {
not at google - send to devlin 2014/01/28 19:08:45 If I'm reading this correctly... you can merge thi
Fady Samuel 2014/01/31 22:31:45 Done.
1202 module_system->Require("webView"); 1198 module_system->Require("webView");
1203 bool includeExperimental = 1199 if (GetCurrentChannel() <= chrome::VersionInfo::CHANNEL_DEV) {
1204 GetCurrentChannel() <= chrome::VersionInfo::CHANNEL_DEV; 1200 module_system->Require("webViewExperimental");
not at google - send to devlin 2014/01/28 19:08:45 (is there any way to (eventually, not now obviousl
Fady Samuel 2014/01/31 22:31:45 I'm not aware of anyway to do that. <webview> is a
1205 if (!includeExperimental) { 1201 } else {
1206 // TODO(asargent) We need a whitelist for webview experimental. 1202 // TODO(asargent) We need a whitelist for webview experimental.
1207 // crbug.com/264852 1203 // crbug.com/264852
1208 std::string id_hash = base::SHA1HashString(extension->id()); 1204 std::string id_hash = base::SHA1HashString(extension->id());
1209 std::string hexencoded_id_hash = base::HexEncode(id_hash.c_str(), 1205 std::string hexencoded_id_hash = base::HexEncode(id_hash.c_str(),
1210 id_hash.length()); 1206 id_hash.length());
not at google - send to devlin 2014/01/28 19:08:45 indentation
Fady Samuel 2014/01/31 22:31:45 Done.
1211 if (hexencoded_id_hash == "8C3741E3AF0B93B6E8E0DDD499BB0B74839EA578" || 1207 if (hexencoded_id_hash == "8C3741E3AF0B93B6E8E0DDD499BB0B74839EA578" ||
1212 hexencoded_id_hash == "E703483CEF33DEC18B4B6DD84B5C776FB9182BDB" || 1208 hexencoded_id_hash == "E703483CEF33DEC18B4B6DD84B5C776FB9182BDB" ||
1213 hexencoded_id_hash == "1A26E32DE447A17CBE5E9750CDBA78F58539B39C" || 1209 hexencoded_id_hash == "1A26E32DE447A17CBE5E9750CDBA78F58539B39C" ||
1214 hexencoded_id_hash == "59048028102D7B4C681DBC7BC6CD980C3DC66DA3") 1210 hexencoded_id_hash == "59048028102D7B4C681DBC7BC6CD980C3DC66DA3") {
1215 includeExperimental = true; 1211 module_system->Require("webViewExperimental");
1212 } else {
1213 module_system->Require("denyWebView");
not at google - send to devlin 2014/01/28 19:08:45 err I don't understand. this code is executed even
Fady Samuel 2014/01/31 22:31:45 Wow, that's a silly refactor bug :P Thanks for cat
1214 }
1216 } 1215 }
1217 if (includeExperimental)
1218 module_system->Require("webViewExperimental");
1219 } else {
1220 module_system->Require("denyWebView");
1221 } 1216 }
1222 } 1217 }
1223 1218
1224 // Same comment as above for <adview> tag. 1219 // Same comment as above for <adview> tag.
1225 if (context_type == Feature::BLESSED_EXTENSION_CONTEXT && 1220 if (context_type == Feature::BLESSED_EXTENSION_CONTEXT &&
1226 is_within_platform_app) { 1221 is_within_platform_app) {
1227 if (CommandLine::ForCurrentProcess()->HasSwitch( 1222 if (CommandLine::ForCurrentProcess()->HasSwitch(
1228 ::switches::kEnableAdview)) { 1223 ::switches::kEnableAdview)) {
1229 if (extension->HasAPIPermission(APIPermission::kAdView)) { 1224 if (extension->HasAPIPermission(APIPermission::kAdView)) {
1230 module_system->Require("adView"); 1225 module_system->Require("adView");
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
1666 RenderView* background_view = 1661 RenderView* background_view =
1667 ExtensionHelper::GetBackgroundPage(extension_id); 1662 ExtensionHelper::GetBackgroundPage(extension_id);
1668 if (background_view) { 1663 if (background_view) {
1669 background_view->Send(new ExtensionHostMsg_EventAck( 1664 background_view->Send(new ExtensionHostMsg_EventAck(
1670 background_view->GetRoutingID())); 1665 background_view->GetRoutingID()));
1671 } 1666 }
1672 } 1667 }
1673 } 1668 }
1674 1669
1675 } // namespace extensions 1670 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698