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

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

Issue 2850793005: Remove command line/field trial support and configs for Isolate Extensions. (Closed)
Patch Set: Rebase. Created 3 years, 7 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
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 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 // Hosted apps that have script access to their background page must use 316 // Hosted apps that have script access to their background page must use
317 // process per site, since all instances can make synchronous calls to the 317 // process per site, since all instances can make synchronous calls to the
318 // background window. Other extensions should use process per site as well. 318 // background window. Other extensions should use process per site as well.
319 return true; 319 return true;
320 } 320 }
321 321
322 // static 322 // static
323 bool ChromeContentBrowserClientExtensionsPart::DoesSiteRequireDedicatedProcess( 323 bool ChromeContentBrowserClientExtensionsPart::DoesSiteRequireDedicatedProcess(
324 content::BrowserContext* browser_context, 324 content::BrowserContext* browser_context,
325 const GURL& effective_site_url) { 325 const GURL& effective_site_url) {
326 if (IsIsolateExtensionsEnabled()) { 326 const Extension* extension = ExtensionRegistry::Get(browser_context)
327 const Extension* extension = 327 ->enabled_extensions()
328 ExtensionRegistry::Get(browser_context) 328 .GetExtensionOrAppByURL(effective_site_url);
329 ->enabled_extensions() 329 if (!extension)
330 .GetExtensionOrAppByURL(effective_site_url); 330 return false;
331 if (extension) {
332 // Always isolate Chrome Web Store.
333 if (extension->id() == kWebStoreAppId)
334 return true;
335 331
336 // --isolate-extensions should isolate extensions, except for hosted 332 // Always isolate Chrome Web Store.
337 // apps. Isolating hosted apps is a good idea, but ought to be a separate 333 if (extension->id() == kWebStoreAppId)
338 // knob. 334 return true;
339 if (extension->is_hosted_app())
340 return false;
341 335
342 // Isolate all extensions. 336 // Extensions should be isolated, except for hosted apps. Isolating hosted
343 return true; 337 // apps is a good idea, but ought to be a separate knob.
344 } 338 if (extension->is_hosted_app())
345 } 339 return false;
346 return false; 340
341 // Isolate all extensions.
342 return true;
347 } 343 }
348 344
349 // static 345 // static
350 bool ChromeContentBrowserClientExtensionsPart::ShouldLockToOrigin( 346 bool ChromeContentBrowserClientExtensionsPart::ShouldLockToOrigin(
351 content::BrowserContext* browser_context, 347 content::BrowserContext* browser_context,
352 const GURL& effective_site_url) { 348 const GURL& effective_site_url) {
353 // https://crbug.com/160576 workaround: Origin lock to the chrome-extension:// 349 // https://crbug.com/160576 workaround: Origin lock to the chrome-extension://
354 // scheme for a hosted app would kill processes on legitimate requests for the 350 // scheme for a hosted app would kill processes on legitimate requests for the
355 // app's cookies. 351 // app's cookies.
356 if (effective_site_url.SchemeIs(extensions::kExtensionScheme)) { 352 if (effective_site_url.SchemeIs(extensions::kExtensionScheme)) {
357 const Extension* extension = 353 const Extension* extension =
358 ExtensionRegistry::Get(browser_context) 354 ExtensionRegistry::Get(browser_context)
359 ->enabled_extensions() 355 ->enabled_extensions()
360 .GetExtensionOrAppByURL(effective_site_url); 356 .GetExtensionOrAppByURL(effective_site_url);
361 if (extension && extension->is_hosted_app()) 357 if (extension && extension->is_hosted_app())
362 return false; 358 return false;
363 359
364 // http://crbug.com/600441 workaround: Extension process reuse, implemented 360 // http://crbug.com/600441 workaround: Extension process reuse, implemented
365 // in ShouldTryToUseExistingProcessHost(), means that extension processes 361 // in ShouldTryToUseExistingProcessHost(), means that extension processes
366 // aren't always actually dedicated to a single origin, even in 362 // aren't always actually dedicated to a single origin.
367 // --isolate-extensions. TODO(nick): Fix this. 363 // TODO(nick): Fix this.
368 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( 364 if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
369 ::switches::kSitePerProcess)) 365 ::switches::kSitePerProcess))
370 return false; 366 return false;
371 } 367 }
372 return true; 368 return true;
373 } 369 }
374 370
375 // static 371 // static
376 bool ChromeContentBrowserClientExtensionsPart::CanCommitURL( 372 bool ChromeContentBrowserClientExtensionsPart::CanCommitURL(
377 content::RenderProcessHost* process_host, const GURL& url) { 373 content::RenderProcessHost* process_host, const GURL& url) {
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after
871 command_line->AppendSwitch(switches::kExtensionProcess); 867 command_line->AppendSwitch(switches::kExtensionProcess);
872 } 868 }
873 } 869 }
874 870
875 void ChromeContentBrowserClientExtensionsPart::ResourceDispatcherHostCreated() { 871 void ChromeContentBrowserClientExtensionsPart::ResourceDispatcherHostCreated() {
876 content::ResourceDispatcherHost::Get()->RegisterInterceptor( 872 content::ResourceDispatcherHost::Get()->RegisterInterceptor(
877 "Origin", kExtensionScheme, base::Bind(&OnHttpHeaderReceived)); 873 "Origin", kExtensionScheme, base::Bind(&OnHttpHeaderReceived));
878 } 874 }
879 875
880 } // namespace extensions 876 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698