Chromium Code Reviews| 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 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 471 | 471 |
| 472 // Initialize host permissions for any extensions that were activated before | 472 // Initialize host permissions for any extensions that were activated before |
| 473 // WebKit was initialized. | 473 // WebKit was initialized. |
| 474 for (std::set<std::string>::iterator iter = active_extension_ids_.begin(); | 474 for (std::set<std::string>::iterator iter = active_extension_ids_.begin(); |
| 475 iter != active_extension_ids_.end(); ++iter) { | 475 iter != active_extension_ids_.end(); ++iter) { |
| 476 const Extension* extension = extensions_.GetByID(*iter); | 476 const Extension* extension = extensions_.GetByID(*iter); |
| 477 CHECK(extension); | 477 CHECK(extension); |
| 478 InitOriginPermissions(extension); | 478 InitOriginPermissions(extension); |
| 479 } | 479 } |
| 480 | 480 |
| 481 if (IsWithinPlatformApp()) | 481 EnableCustomElementWhiteList(); |
|
Charlie Reis
2013/09/04 17:47:29
Removing this seems concerning. We don't want the
guohui
2013/09/05 19:35:04
In an earlier prototype CL, Fady mentioned that it
Fady Samuel
2013/09/09 16:30:49
Yea, document_natives is not exposed to third part
guohui
2013/09/09 16:43:00
thanks fady, then is there any other unwanted side
Fady Samuel
2013/09/09 17:35:05
None come to mind, but I'm not entirely certain. I
dominicc (has gone to gerrit)
2013/09/10 02:50:49
The side effect will be that any element names you
guohui
2013/09/12 20:27:27
today EnableCustomElementWhiteList is called in tw
| |
| 482 EnableCustomElementWhiteList(); | |
| 483 | 482 |
| 484 is_webkit_initialized_ = true; | 483 is_webkit_initialized_ = true; |
| 485 } | 484 } |
| 486 | 485 |
| 487 void Dispatcher::IdleNotification() { | 486 void Dispatcher::IdleNotification() { |
| 488 if (is_extension_process_) { | 487 if (is_extension_process_) { |
| 489 // Dampen the forced delay as well if the extension stays idle for long | 488 // Dampen the forced delay as well if the extension stays idle for long |
| 490 // periods of time. | 489 // periods of time. |
| 491 int64 forced_delay_ms = std::max( | 490 int64 forced_delay_ms = std::max( |
| 492 RenderThread::Get()->GetIdleNotificationDelayInMs(), | 491 RenderThread::Get()->GetIdleNotificationDelayInMs(), |
| (...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1103 } | 1102 } |
| 1104 | 1103 |
| 1105 if (context_type == Feature::BLESSED_EXTENSION_CONTEXT && | 1104 if (context_type == Feature::BLESSED_EXTENSION_CONTEXT && |
| 1106 is_within_platform_app && | 1105 is_within_platform_app && |
| 1107 GetCurrentChannel() <= chrome::VersionInfo::CHANNEL_DEV && | 1106 GetCurrentChannel() <= chrome::VersionInfo::CHANNEL_DEV && |
| 1108 CommandLine::ForCurrentProcess()->HasSwitch( | 1107 CommandLine::ForCurrentProcess()->HasSwitch( |
| 1109 switches::kEnableAppWindowControls)) { | 1108 switches::kEnableAppWindowControls)) { |
| 1110 module_system->Require("windowControls"); | 1109 module_system->Require("windowControls"); |
| 1111 } | 1110 } |
| 1112 | 1111 |
| 1113 // Only platform apps support the <webview> tag, because the "webView" and | 1112 // Currently only platform apps and component extensions support the <webview> |
| 1114 // "denyWebView" modules will affect the performance of DOM modifications | 1113 // tag, because the "webView" and "denyWebView" modules will affect the |
| 1115 // (http://crbug.com/196453). | 1114 // performance of DOM modifications (http://crbug.com/196453). |
| 1116 if (context_type == Feature::BLESSED_EXTENSION_CONTEXT && | 1115 if (context_type == Feature::BLESSED_EXTENSION_CONTEXT) { |
| 1117 is_within_platform_app) { | |
| 1118 // Note: setting up the WebView class here, not the chrome.webview API. | 1116 // Note: setting up the WebView class here, not the chrome.webview API. |
| 1119 // The API will be automatically set up when first used. | 1117 // The API will be automatically set up when first used. |
| 1120 if (extension->HasAPIPermission(APIPermission::kWebView)) { | 1118 if (extension->HasAPIPermission(APIPermission::kWebView)) { |
| 1121 module_system->Require("webView"); | 1119 module_system->Require("webView"); |
| 1122 bool includeExperimental = | 1120 bool includeExperimental = |
| 1123 GetCurrentChannel() <= chrome::VersionInfo::CHANNEL_DEV || | 1121 GetCurrentChannel() <= chrome::VersionInfo::CHANNEL_DEV || |
| 1124 extension->id() == extension_misc::kIdentityApiUiAppId; | 1122 extension->id() == extension_misc::kIdentityApiUiAppId; |
| 1125 if (!includeExperimental) { | 1123 if (!includeExperimental) { |
| 1126 // TODO(asargent) We need a whitelist for webview experimental. | 1124 // TODO(asargent) We need a whitelist for webview experimental. |
| 1127 // crbug.com/264852 | 1125 // crbug.com/264852 |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1241 if (is_webkit_initialized_) { | 1239 if (is_webkit_initialized_) { |
| 1242 InitOriginPermissions(extension); | 1240 InitOriginPermissions(extension); |
| 1243 // DOMActivity logger for a main world controlled by an extension (as in | 1241 // DOMActivity logger for a main world controlled by an extension (as in |
| 1244 // the case of an extension background page, options page, popup etc.) | 1242 // the case of an extension background page, options page, popup etc.) |
| 1245 // gets an empty title. | 1243 // gets an empty title. |
| 1246 DOMActivityLogger::AttachToWorld(DOMActivityLogger::kMainWorldId, | 1244 DOMActivityLogger::AttachToWorld(DOMActivityLogger::kMainWorldId, |
| 1247 extension_id, | 1245 extension_id, |
| 1248 extension->url(), | 1246 extension->url(), |
| 1249 string16()); | 1247 string16()); |
| 1250 | 1248 |
| 1251 if (IsWithinPlatformApp()) | 1249 EnableCustomElementWhiteList(); |
| 1252 EnableCustomElementWhiteList(); | |
| 1253 } | 1250 } |
| 1254 } | 1251 } |
| 1255 | 1252 |
| 1256 void Dispatcher::InitOriginPermissions(const Extension* extension) { | 1253 void Dispatcher::InitOriginPermissions(const Extension* extension) { |
| 1257 // TODO(jstritar): We should try to remove this special case. Also, these | 1254 // TODO(jstritar): We should try to remove this special case. Also, these |
| 1258 // whitelist entries need to be updated when the kManagement permission | 1255 // whitelist entries need to be updated when the kManagement permission |
| 1259 // changes. | 1256 // changes. |
| 1260 if (extension->HasAPIPermission(APIPermission::kManagement)) { | 1257 if (extension->HasAPIPermission(APIPermission::kManagement)) { |
| 1261 WebSecurityPolicy::addOriginAccessWhitelistEntry( | 1258 WebSecurityPolicy::addOriginAccessWhitelistEntry( |
| 1262 extension->url(), | 1259 extension->url(), |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1562 RenderView* background_view = | 1559 RenderView* background_view = |
| 1563 ExtensionHelper::GetBackgroundPage(extension_id); | 1560 ExtensionHelper::GetBackgroundPage(extension_id); |
| 1564 if (background_view) { | 1561 if (background_view) { |
| 1565 background_view->Send(new ExtensionHostMsg_EventAck( | 1562 background_view->Send(new ExtensionHostMsg_EventAck( |
| 1566 background_view->GetRoutingID())); | 1563 background_view->GetRoutingID())); |
| 1567 } | 1564 } |
| 1568 } | 1565 } |
| 1569 } | 1566 } |
| 1570 | 1567 |
| 1571 } // namespace extensions | 1568 } // namespace extensions |
| OLD | NEW |