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

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

Issue 11308024: Fixing guest processes to use the proper storage partition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix some substring match bugs Created 8 years, 1 month 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
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 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 // we can pick any of them to retrieve the storage partition id. 484 // we can pick any of them to retrieve the storage partition id.
485 extension = 485 extension =
486 extension_service->extensions()->GetByID(*(extension_ids.begin())); 486 extension_service->extensions()->GetByID(*(extension_ids.begin()));
487 } 487 }
488 return GetStoragePartitionIdForExtension(browser_context, extension); 488 return GetStoragePartitionIdForExtension(browser_context, extension);
489 } 489 }
490 490
491 std::string ChromeContentBrowserClient::GetStoragePartitionIdForSite( 491 std::string ChromeContentBrowserClient::GetStoragePartitionIdForSite(
492 content::BrowserContext* browser_context, 492 content::BrowserContext* browser_context,
493 const GURL& site) { 493 const GURL& site) {
494 if (site.SchemeIs(chrome::kGuestScheme))
495 return "guest-" + site.host();
496
494 const Extension* extension = NULL; 497 const Extension* extension = NULL;
495 Profile* profile = Profile::FromBrowserContext(browser_context); 498 Profile* profile = Profile::FromBrowserContext(browser_context);
496 ExtensionService* extension_service = 499 ExtensionService* extension_service =
497 extensions::ExtensionSystem::Get(profile)->extension_service(); 500 extensions::ExtensionSystem::Get(profile)->extension_service();
498 if (extension_service) { 501 if (extension_service) {
499 extension = extension_service->extensions()-> 502 extension = extension_service->extensions()->
500 GetExtensionOrAppByURL(ExtensionURLInfo(site)); 503 GetExtensionOrAppByURL(ExtensionURLInfo(site));
501 } 504 }
502 505
503 return GetStoragePartitionIdForExtension(browser_context, extension); 506 return GetStoragePartitionIdForExtension(browser_context, extension);
(...skipping 1093 matching lines...) Expand 10 before | Expand all | Expand 10 after
1597 if (web_prefs->default_encoding.empty()) { 1600 if (web_prefs->default_encoding.empty()) {
1598 prefs->ClearPref(prefs::kDefaultCharset); 1601 prefs->ClearPref(prefs::kDefaultCharset);
1599 web_prefs->default_encoding = prefs->GetString(prefs::kDefaultCharset); 1602 web_prefs->default_encoding = prefs->GetString(prefs::kDefaultCharset);
1600 } 1603 }
1601 DCHECK(!web_prefs->default_encoding.empty()); 1604 DCHECK(!web_prefs->default_encoding.empty());
1602 1605
1603 WebContents* web_contents = WebContents::FromRenderViewHost(rvh); 1606 WebContents* web_contents = WebContents::FromRenderViewHost(rvh);
1604 chrome::ViewType view_type = chrome::GetViewType(web_contents); 1607 chrome::ViewType view_type = chrome::GetViewType(web_contents);
1605 ExtensionService* service = profile->GetExtensionService(); 1608 ExtensionService* service = profile->GetExtensionService();
1606 if (service) { 1609 if (service) {
1607 const Extension* extension = service->extensions()->GetByID( 1610 const GURL& url = rvh->GetSiteInstance()->GetSiteURL();
1608 rvh->GetSiteInstance()->GetSiteURL().host()); 1611 const Extension* extension = service->extensions()->GetByID(url.host());
1609 extension_webkit_preferences::SetPreferences( 1612 // Guests are not extensions, so they should not be given any extra
1610 extension, view_type, web_prefs); 1613 // privileges.
Charlie Reis 2012/10/27 01:11:43 nit: This comment is confusing unless you know mor
awong 2012/10/27 01:23:54 Done.
1614 if (url.SchemeIs(chrome::kExtensionScheme)) {
1615 extension_webkit_preferences::SetPreferences(
1616 extension, view_type, web_prefs);
1617 }
1611 } 1618 }
1612 1619
1613 if (content::IsForceCompositingModeEnabled()) 1620 if (content::IsForceCompositingModeEnabled())
1614 web_prefs->force_compositing_mode = true; 1621 web_prefs->force_compositing_mode = true;
1615 1622
1616 if (view_type == chrome::VIEW_TYPE_NOTIFICATION) { 1623 if (view_type == chrome::VIEW_TYPE_NOTIFICATION) {
1617 web_prefs->allow_scripts_to_close_windows = true; 1624 web_prefs->allow_scripts_to_close_windows = true;
1618 } else if (view_type == chrome::VIEW_TYPE_BACKGROUND_CONTENTS) { 1625 } else if (view_type == chrome::VIEW_TYPE_BACKGROUND_CONTENTS) {
1619 // Disable all kinds of acceleration for background pages. 1626 // Disable all kinds of acceleration for background pages.
1620 // See http://crbug.com/96005 and http://crbug.com/96006 1627 // See http://crbug.com/96005 and http://crbug.com/96006
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
1877 partition_id = extension->id(); 1884 partition_id = extension->id();
1878 } 1885 }
1879 1886
1880 // Enforce that IsValidStoragePartitionId() implementation stays in sync. 1887 // Enforce that IsValidStoragePartitionId() implementation stays in sync.
1881 DCHECK(IsValidStoragePartitionId(browser_context, partition_id)); 1888 DCHECK(IsValidStoragePartitionId(browser_context, partition_id));
1882 return partition_id; 1889 return partition_id;
1883 } 1890 }
1884 1891
1885 1892
1886 } // namespace chrome 1893 } // namespace chrome
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/web_view_browsertest.cc » ('j') | chrome/browser/extensions/web_view_browsertest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698