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

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

Issue 23653012: Support webview tag in component extension (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add whitelist Created 7 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « chrome/common/extensions/api/_permission_features.json ('k') | 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 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
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();
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
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 exts/apps support the <webview> tag, because the "webView"
1114 // "denyWebView" modules will affect the performance of DOM modifications 1113 // and "denyWebView" modules will affect the performance of DOM modifications
1115 // (http://crbug.com/196453). 1114 // (http://crbug.com/196453).
1116 if (context_type == Feature::BLESSED_EXTENSION_CONTEXT && 1115 // We used to limit WebView to |BLESSED_EXTENSION_CONTEXT| within platform
1117 is_within_platform_app) { 1116 // apps. An ext/app runs in a blessed extension context, if it is the active
1117 // extension in the current process, in other words, if it is loaded in the
1118 // top frame. To support webview in iframed extensions, we have to drop the
Charlie Reis 2013/09/19 17:04:41 I don't understand why this is in this CL. The CL
guohui1 2013/09/19 17:50:32 agree, Fady has pointed out the same thing in a of
1119 // check.
1120 if (extension) {
1118 // Note: setting up the WebView class here, not the chrome.webview API. 1121 // Note: setting up the WebView class here, not the chrome.webview API.
1119 // The API will be automatically set up when first used. 1122 // The API will be automatically set up when first used.
1120 if (extension->HasAPIPermission(APIPermission::kWebView)) { 1123 if (extension->HasAPIPermission(APIPermission::kWebView)) {
1121 module_system->Require("webView"); 1124 module_system->Require("webView");
1122 bool includeExperimental = 1125 bool includeExperimental =
1123 GetCurrentChannel() <= chrome::VersionInfo::CHANNEL_DEV || 1126 GetCurrentChannel() <= chrome::VersionInfo::CHANNEL_DEV ||
1124 extension->id() == extension_misc::kIdentityApiUiAppId; 1127 extension->id() == extension_misc::kIdentityApiUiAppId;
1125 if (!includeExperimental) { 1128 if (!includeExperimental) {
1126 // TODO(asargent) We need a whitelist for webview experimental. 1129 // TODO(asargent) We need a whitelist for webview experimental.
1127 // crbug.com/264852 1130 // crbug.com/264852
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
1241 if (is_webkit_initialized_) { 1244 if (is_webkit_initialized_) {
1242 InitOriginPermissions(extension); 1245 InitOriginPermissions(extension);
1243 // DOMActivity logger for a main world controlled by an extension (as in 1246 // DOMActivity logger for a main world controlled by an extension (as in
1244 // the case of an extension background page, options page, popup etc.) 1247 // the case of an extension background page, options page, popup etc.)
1245 // gets an empty title. 1248 // gets an empty title.
1246 DOMActivityLogger::AttachToWorld(DOMActivityLogger::kMainWorldId, 1249 DOMActivityLogger::AttachToWorld(DOMActivityLogger::kMainWorldId,
1247 extension_id, 1250 extension_id,
1248 extension->url(), 1251 extension->url(),
1249 string16()); 1252 string16());
1250 1253
1251 if (IsWithinPlatformApp()) 1254 EnableCustomElementWhiteList();
1252 EnableCustomElementWhiteList();
1253 } 1255 }
1254 } 1256 }
1255 1257
1256 void Dispatcher::InitOriginPermissions(const Extension* extension) { 1258 void Dispatcher::InitOriginPermissions(const Extension* extension) {
1257 // TODO(jstritar): We should try to remove this special case. Also, these 1259 // TODO(jstritar): We should try to remove this special case. Also, these
1258 // whitelist entries need to be updated when the kManagement permission 1260 // whitelist entries need to be updated when the kManagement permission
1259 // changes. 1261 // changes.
1260 if (extension->HasAPIPermission(APIPermission::kManagement)) { 1262 if (extension->HasAPIPermission(APIPermission::kManagement)) {
1261 WebSecurityPolicy::addOriginAccessWhitelistEntry( 1263 WebSecurityPolicy::addOriginAccessWhitelistEntry(
1262 extension->url(), 1264 extension->url(),
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
1565 RenderView* background_view = 1567 RenderView* background_view =
1566 ExtensionHelper::GetBackgroundPage(extension_id); 1568 ExtensionHelper::GetBackgroundPage(extension_id);
1567 if (background_view) { 1569 if (background_view) {
1568 background_view->Send(new ExtensionHostMsg_EventAck( 1570 background_view->Send(new ExtensionHostMsg_EventAck(
1569 background_view->GetRoutingID())); 1571 background_view->GetRoutingID()));
1570 } 1572 }
1571 } 1573 }
1572 } 1574 }
1573 1575
1574 } // namespace extensions 1576 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/common/extensions/api/_permission_features.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698