OLD | NEW |
---|---|
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 1165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1176 } | 1176 } |
1177 | 1177 |
1178 if (context_type == Feature::BLESSED_EXTENSION_CONTEXT && | 1178 if (context_type == Feature::BLESSED_EXTENSION_CONTEXT && |
1179 is_within_platform_app && | 1179 is_within_platform_app && |
1180 GetCurrentChannel() <= chrome::VersionInfo::CHANNEL_DEV && | 1180 GetCurrentChannel() <= chrome::VersionInfo::CHANNEL_DEV && |
1181 CommandLine::ForCurrentProcess()->HasSwitch( | 1181 CommandLine::ForCurrentProcess()->HasSwitch( |
1182 switches::kEnableAppWindowControls)) { | 1182 switches::kEnableAppWindowControls)) { |
1183 module_system->Require("windowControls"); | 1183 module_system->Require("windowControls"); |
1184 } | 1184 } |
1185 | 1185 |
1186 // Currently only platform apps and whitelisted component extensions support | |
1187 // the <webview> tag, because the "denyWebView" module will affect the | |
1188 // performance of DOM modifications (http://crbug.com/196453). | |
1189 // We used to limit WebView to |BLESSED_EXTENSION_CONTEXT| within platform | 1186 // We used to limit WebView to |BLESSED_EXTENSION_CONTEXT| within platform |
1190 // apps. An ext/app runs in a blessed extension context, if it is the active | 1187 // apps. An ext/app runs in a blessed extension context, if it is the active |
1191 // extension in the current process, in other words, if it is loaded in a top | 1188 // extension in the current process, in other words, if it is loaded in a top |
1192 // frame. To support webview in a non-frame extension, we have to allow | 1189 // frame. To support webview in a non-frame extension, we have to allow |
1193 // unblessed extension context as well. | 1190 // unblessed extension context as well. |
1194 if (context_type == Feature::BLESSED_EXTENSION_CONTEXT || | 1191 // Note: setting up the WebView class here, not the chrome.webview API. |
1195 context_type == Feature::UNBLESSED_EXTENSION_CONTEXT) { | 1192 // The API will be automatically set up when first used. |
not at google - send to devlin
2014/01/14 23:58:49
it's premature to delete this altogether, you prob
Fady Samuel
2014/01/17 22:35:10
Done.
| |
1196 // Note: setting up the WebView class here, not the chrome.webview API. | 1193 if (extension->HasAPIPermission(APIPermission::kWebView)) { |
1197 // The API will be automatically set up when first used. | 1194 module_system->Require("webView"); |
1198 if (extension->HasAPIPermission(APIPermission::kWebView)) { | 1195 bool includeExperimental = |
1199 module_system->Require("webView"); | 1196 GetCurrentChannel() <= chrome::VersionInfo::CHANNEL_DEV; |
1200 bool includeExperimental = | 1197 if (!includeExperimental) { |
1201 GetCurrentChannel() <= chrome::VersionInfo::CHANNEL_DEV; | 1198 // TODO(asargent) We need a whitelist for webview experimental. |
1202 if (!includeExperimental) { | 1199 // crbug.com/264852 |
1203 // TODO(asargent) We need a whitelist for webview experimental. | 1200 std::string id_hash = base::SHA1HashString(extension->id()); |
1204 // crbug.com/264852 | 1201 std::string hexencoded_id_hash = base::HexEncode(id_hash.c_str(), |
1205 std::string id_hash = base::SHA1HashString(extension->id()); | 1202 id_hash.length()); |
1206 std::string hexencoded_id_hash = base::HexEncode(id_hash.c_str(), | 1203 if (hexencoded_id_hash == "8C3741E3AF0B93B6E8E0DDD499BB0B74839EA578" || |
1207 id_hash.length()); | 1204 hexencoded_id_hash == "E703483CEF33DEC18B4B6DD84B5C776FB9182BDB" || |
1208 if (hexencoded_id_hash == "8C3741E3AF0B93B6E8E0DDD499BB0B74839EA578" || | 1205 hexencoded_id_hash == "1A26E32DE447A17CBE5E9750CDBA78F58539B39C" || |
1209 hexencoded_id_hash == "E703483CEF33DEC18B4B6DD84B5C776FB9182BDB" || | 1206 hexencoded_id_hash == "59048028102D7B4C681DBC7BC6CD980C3DC66DA3") |
1210 hexencoded_id_hash == "1A26E32DE447A17CBE5E9750CDBA78F58539B39C" || | 1207 includeExperimental = true; |
1211 hexencoded_id_hash == "59048028102D7B4C681DBC7BC6CD980C3DC66DA3") | |
1212 includeExperimental = true; | |
1213 } | |
1214 if (includeExperimental) | |
1215 module_system->Require("webViewExperimental"); | |
1216 } else { | |
1217 module_system->Require("denyWebView"); | |
1218 } | 1208 } |
1209 if (includeExperimental) | |
not at google - send to devlin
2014/01/14 23:58:49
include_experimental, though, why isn't this check
Fady Samuel
2014/01/17 22:35:10
I think I capture what you're suggesting here. Doe
| |
1210 module_system->Require("webViewExperimental"); | |
1211 } else { | |
1212 module_system->Require("denyWebView"); | |
1219 } | 1213 } |
1220 | 1214 |
1221 // Same comment as above for <adview> tag. | 1215 // Same comment as above for <adview> tag. |
1222 if (context_type == Feature::BLESSED_EXTENSION_CONTEXT && | 1216 if (context_type == Feature::BLESSED_EXTENSION_CONTEXT && |
1223 is_within_platform_app) { | 1217 is_within_platform_app) { |
1224 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableAdview)) { | 1218 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableAdview)) { |
1225 if (extension->HasAPIPermission(APIPermission::kAdView)) { | 1219 if (extension->HasAPIPermission(APIPermission::kAdView)) { |
1226 module_system->Require("adView"); | 1220 module_system->Require("adView"); |
1227 } else { | 1221 } else { |
1228 module_system->Require("denyAdView"); | 1222 module_system->Require("denyAdView"); |
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1662 RenderView* background_view = | 1656 RenderView* background_view = |
1663 ExtensionHelper::GetBackgroundPage(extension_id); | 1657 ExtensionHelper::GetBackgroundPage(extension_id); |
1664 if (background_view) { | 1658 if (background_view) { |
1665 background_view->Send(new ExtensionHostMsg_EventAck( | 1659 background_view->Send(new ExtensionHostMsg_EventAck( |
1666 background_view->GetRoutingID())); | 1660 background_view->GetRoutingID())); |
1667 } | 1661 } |
1668 } | 1662 } |
1669 } | 1663 } |
1670 | 1664 |
1671 } // namespace extensions | 1665 } // namespace extensions |
OLD | NEW |