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

Side by Side Diff: chrome/browser/extensions/chrome_content_browser_client_extensions_part.cc

Issue 2400523002: Isolating Chrome Web Store app in the transfer (i.e. non-OpenURL) path. (Closed)
Patch Set: Addressed CR feedback from lazyboy@ (removed one more unneeded #include). Created 4 years, 2 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 | chrome/browser/extensions/process_management_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/browser/extensions/chrome_content_browser_client_extensions_par t.h" 5 #include "chrome/browser/extensions/chrome_content_browser_client_extensions_par t.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <set> 9 #include <set>
10 10
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 // Hosted apps that have script access to their background page must use 261 // Hosted apps that have script access to their background page must use
262 // process per site, since all instances can make synchronous calls to the 262 // process per site, since all instances can make synchronous calls to the
263 // background window. Other extensions should use process per site as well. 263 // background window. Other extensions should use process per site as well.
264 return true; 264 return true;
265 } 265 }
266 266
267 // static 267 // static
268 bool ChromeContentBrowserClientExtensionsPart::DoesSiteRequireDedicatedProcess( 268 bool ChromeContentBrowserClientExtensionsPart::DoesSiteRequireDedicatedProcess(
269 content::BrowserContext* browser_context, 269 content::BrowserContext* browser_context,
270 const GURL& effective_site_url) { 270 const GURL& effective_site_url) {
271 if (effective_site_url.SchemeIs(extensions::kExtensionScheme)) { 271 if (IsIsolateExtensionsEnabled()) {
272 // --isolate-extensions should isolate extensions, except for a) hosted 272 const Extension* extension =
273 // apps, b) platform apps. 273 ExtensionRegistry::Get(browser_context)
274 // a) Isolating hosted apps is a good idea, but ought to be a separate knob. 274 ->enabled_extensions()
275 // b) Sandbox pages in platform app can load web content in iframes; 275 .GetExtensionOrAppByURL(effective_site_url);
276 // isolating the app and the iframe leads to StoragePartition mismatch in 276 if (extension) {
277 // the two processes. 277 // Always isolate Chrome Web Store.
278 // TODO(lazyboy): We should deprecate this behaviour and not let web 278 if (extension->id() == kWebStoreAppId)
279 // content load in platform app's process; see http://crbug.com/615585.
280 if (IsIsolateExtensionsEnabled()) {
281 const Extension* extension =
282 ExtensionRegistry::Get(browser_context)
283 ->enabled_extensions()
284 .GetExtensionOrAppByURL(effective_site_url);
285 if (extension && !extension->is_hosted_app() &&
286 !extension->is_platform_app()) {
287 return true; 279 return true;
288 } 280
281 // --isolate-extensions should isolate extensions, except for a) hosted
282 // apps, b) platform apps.
283 // a) Isolating hosted apps is a good idea, but ought to be a separate
284 // knob.
285 // b) Sandbox pages in platform app can load web content in iframes;
286 // isolating the app and the iframe leads to StoragePartition mismatch
287 // in the two processes.
288 // TODO(lazyboy): We should deprecate this behaviour and not let web
289 // content load in platform app's process; see http://crbug.com/615585.
290 if (extension->is_hosted_app() || extension->is_platform_app())
291 return false;
292
293 // Isolate all extensions.
294 return true;
289 } 295 }
290 } 296 }
291 return false; 297 return false;
292 } 298 }
293 299
294 // static 300 // static
295 bool ChromeContentBrowserClientExtensionsPart::ShouldLockToOrigin( 301 bool ChromeContentBrowserClientExtensionsPart::ShouldLockToOrigin(
296 content::BrowserContext* browser_context, 302 content::BrowserContext* browser_context,
297 const GURL& effective_site_url) { 303 const GURL& effective_site_url) {
298 // https://crbug.com/160576 workaround: Origin lock to the chrome-extension:// 304 // https://crbug.com/160576 workaround: Origin lock to the chrome-extension://
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 } 691 }
686 } 692 }
687 } 693 }
688 694
689 void ChromeContentBrowserClientExtensionsPart::ResourceDispatcherHostCreated() { 695 void ChromeContentBrowserClientExtensionsPart::ResourceDispatcherHostCreated() {
690 content::ResourceDispatcherHost::Get()->RegisterInterceptor( 696 content::ResourceDispatcherHost::Get()->RegisterInterceptor(
691 "Origin", kExtensionScheme, base::Bind(&OnHttpHeaderReceived)); 697 "Origin", kExtensionScheme, base::Bind(&OnHttpHeaderReceived));
692 } 698 }
693 699
694 } // namespace extensions 700 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/process_management_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698