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

Side by Side Diff: chrome/browser/chrome_content_browser_client.cc

Issue 9508008: Allow apps with background pages to request process-per-app-instance. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 9 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 | « no previous file | chrome/browser/extensions/app_process_apitest.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 (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/browser/chrome_content_browser_client.h" 5 #include "chrome/browser/chrome_content_browser_client.h"
6 6
7 #include <set> 7 #include <set>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 Profile* profile = Profile::FromBrowserContext(browser_context); 443 Profile* profile = Profile::FromBrowserContext(browser_context);
444 if (!profile || !profile->GetExtensionService()) 444 if (!profile || !profile->GetExtensionService())
445 return false; 445 return false;
446 446
447 const Extension* extension = profile->GetExtensionService()->extensions()-> 447 const Extension* extension = profile->GetExtensionService()->extensions()->
448 GetExtensionOrAppByURL(ExtensionURLInfo(effective_url)); 448 GetExtensionOrAppByURL(ExtensionURLInfo(effective_url));
449 if (!extension) 449 if (!extension)
450 return false; 450 return false;
451 451
452 // If the URL is part of a hosted app that does not have the background 452 // If the URL is part of a hosted app that does not have the background
453 // permission, we want to give each instance its own process to improve 453 // permission, or that does not allow JavaScript access to the background
454 // page, we want to give each instance its own process to improve
454 // responsiveness. 455 // responsiveness.
455 if (extension->GetType() == Extension::TYPE_HOSTED_APP && 456 if (extension->GetType() == Extension::TYPE_HOSTED_APP) {
456 !extension->HasAPIPermission(ExtensionAPIPermission::kBackground)) 457 if (!extension->HasAPIPermission(ExtensionAPIPermission::kBackground) ||
457 return false; 458 !extension->allow_background_js_access()) {
Charlie Reis 2012/02/29 02:56:32 Drew or Mihai, is there a way to enforce having no
Andrew T Wilson (Slow) 2012/02/29 03:20:15 I think returning false from CanCreateWindow() wil
Charlie Reis 2012/03/01 00:38:22 Yep, seems to work.
459 return false;
460 }
461 }
458 462
459 // Hosted apps that have the background permission must use process per site, 463 // Hosted apps that have script access to their background page must use
460 // since all instances can make synchronous calls to the background window. 464 // process per site, since all instances can make synchronous calls to the
461 // Other extensions should use process per site as well. 465 // background window. Other extensions should use process per site as well.
462 return true; 466 return true;
463 } 467 }
464 468
465 bool ChromeContentBrowserClient::IsHandledURL(const GURL& url) { 469 bool ChromeContentBrowserClient::IsHandledURL(const GURL& url) {
466 return ProfileIOData::IsHandledURL(url); 470 return ProfileIOData::IsHandledURL(url);
467 } 471 }
468 472
469 bool ChromeContentBrowserClient::IsSuitableHost( 473 bool ChromeContentBrowserClient::IsSuitableHost(
470 content::RenderProcessHost* process_host, 474 content::RenderProcessHost* process_host,
471 const GURL& site_url) { 475 const GURL& site_url) {
(...skipping 1000 matching lines...) Expand 10 before | Expand all | Expand 10 after
1472 #if defined(USE_NSS) 1476 #if defined(USE_NSS)
1473 crypto::CryptoModuleBlockingPasswordDelegate* 1477 crypto::CryptoModuleBlockingPasswordDelegate*
1474 ChromeContentBrowserClient::GetCryptoPasswordDelegate( 1478 ChromeContentBrowserClient::GetCryptoPasswordDelegate(
1475 const GURL& url) { 1479 const GURL& url) {
1476 return browser::NewCryptoModuleBlockingDialogDelegate( 1480 return browser::NewCryptoModuleBlockingDialogDelegate(
1477 browser::kCryptoModulePasswordKeygen, url.host()); 1481 browser::kCryptoModulePasswordKeygen, url.host());
1478 } 1482 }
1479 #endif 1483 #endif
1480 1484
1481 } // namespace chrome 1485 } // namespace chrome
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/app_process_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698