| 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 1168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 && extension->HasAPIPermission(APIPermission::kWebView)) { |
| 1200 // The API will be automatically set up when first used. | 1197 module_system->Require("webView"); |
| 1201 if (extension->HasAPIPermission(APIPermission::kWebView)) { | 1198 if (GetCurrentChannel() <= chrome::VersionInfo::CHANNEL_DEV) { |
| 1202 module_system->Require("webView"); | 1199 module_system->Require("webViewExperimental"); |
| 1203 bool includeExperimental = | 1200 } else { |
| 1204 GetCurrentChannel() <= chrome::VersionInfo::CHANNEL_DEV; | 1201 // TODO(asargent) We need a whitelist for webview experimental. |
| 1205 if (!includeExperimental) { | 1202 // crbug.com/264852 |
| 1206 // TODO(asargent) We need a whitelist for webview experimental. | 1203 std::string id_hash = base::SHA1HashString(extension->id()); |
| 1207 // crbug.com/264852 | 1204 std::string hexencoded_id_hash = base::HexEncode(id_hash.c_str(), |
| 1208 std::string id_hash = base::SHA1HashString(extension->id()); | 1205 id_hash.length()); |
| 1209 std::string hexencoded_id_hash = base::HexEncode(id_hash.c_str(), | 1206 if (hexencoded_id_hash == "8C3741E3AF0B93B6E8E0DDD499BB0B74839EA578" || |
| 1210 id_hash.length()); | 1207 hexencoded_id_hash == "E703483CEF33DEC18B4B6DD84B5C776FB9182BDB" || |
| 1211 if (hexencoded_id_hash == "8C3741E3AF0B93B6E8E0DDD499BB0B74839EA578" || | 1208 hexencoded_id_hash == "1A26E32DE447A17CBE5E9750CDBA78F58539B39C" || |
| 1212 hexencoded_id_hash == "E703483CEF33DEC18B4B6DD84B5C776FB9182BDB" || | 1209 hexencoded_id_hash == "59048028102D7B4C681DBC7BC6CD980C3DC66DA3") { |
| 1213 hexencoded_id_hash == "1A26E32DE447A17CBE5E9750CDBA78F58539B39C" || | 1210 module_system->Require("webViewExperimental"); |
| 1214 hexencoded_id_hash == "59048028102D7B4C681DBC7BC6CD980C3DC66DA3") | |
| 1215 includeExperimental = true; | |
| 1216 } | 1211 } |
| 1217 if (includeExperimental) | |
| 1218 module_system->Require("webViewExperimental"); | |
| 1219 } else { | |
| 1220 module_system->Require("denyWebView"); | |
| 1221 } | 1212 } |
| 1213 } else { |
| 1214 module_system->Require("denyWebView"); |
| 1222 } | 1215 } |
| 1223 | 1216 |
| 1224 // Same comment as above for <adview> tag. | 1217 // Same comment as above for <adview> tag. |
| 1225 if (context_type == Feature::BLESSED_EXTENSION_CONTEXT && | 1218 if (context_type == Feature::BLESSED_EXTENSION_CONTEXT && |
| 1226 is_within_platform_app) { | 1219 is_within_platform_app) { |
| 1227 if (CommandLine::ForCurrentProcess()->HasSwitch( | 1220 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 1228 ::switches::kEnableAdview)) { | 1221 ::switches::kEnableAdview)) { |
| 1229 if (extension->HasAPIPermission(APIPermission::kAdView)) { | 1222 if (extension->HasAPIPermission(APIPermission::kAdView)) { |
| 1230 module_system->Require("adView"); | 1223 module_system->Require("adView"); |
| 1231 } else { | 1224 } else { |
| (...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1666 RenderView* background_view = | 1659 RenderView* background_view = |
| 1667 ExtensionHelper::GetBackgroundPage(extension_id); | 1660 ExtensionHelper::GetBackgroundPage(extension_id); |
| 1668 if (background_view) { | 1661 if (background_view) { |
| 1669 background_view->Send(new ExtensionHostMsg_EventAck( | 1662 background_view->Send(new ExtensionHostMsg_EventAck( |
| 1670 background_view->GetRoutingID())); | 1663 background_view->GetRoutingID())); |
| 1671 } | 1664 } |
| 1672 } | 1665 } |
| 1673 } | 1666 } |
| 1674 | 1667 |
| 1675 } // namespace extensions | 1668 } // namespace extensions |
| OLD | NEW |