OLD | NEW |
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 725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
736 return main_parts; | 736 return main_parts; |
737 } | 737 } |
738 | 738 |
739 std::string ChromeContentBrowserClient::GetStoragePartitionIdForSite( | 739 std::string ChromeContentBrowserClient::GetStoragePartitionIdForSite( |
740 content::BrowserContext* browser_context, | 740 content::BrowserContext* browser_context, |
741 const GURL& site) { | 741 const GURL& site) { |
742 std::string partition_id; | 742 std::string partition_id; |
743 | 743 |
744 // The partition ID for webview guest processes is the string value of its | 744 // The partition ID for webview guest processes is the string value of its |
745 // SiteInstance URL - "chrome-guest://app_id/persist?partition". | 745 // SiteInstance URL - "chrome-guest://app_id/persist?partition". |
746 if (site.SchemeIs(content::kGuestScheme)) | 746 if (site.SchemeIs(content::kGuestScheme)) { |
747 partition_id = site.spec(); | 747 partition_id = site.spec(); |
| 748 } else if (site.GetOrigin().spec() == kChromeUIChromeSigninURL) { |
| 749 // Chrome signin page has an embedded iframe of extension and web content, |
| 750 // thus it must be isolated from other webUI pages. |
| 751 partition_id = site.GetOrigin().spec(); |
| 752 } |
748 | 753 |
749 DCHECK(IsValidStoragePartitionId(browser_context, partition_id)); | 754 DCHECK(IsValidStoragePartitionId(browser_context, partition_id)); |
750 return partition_id; | 755 return partition_id; |
751 } | 756 } |
752 | 757 |
753 bool ChromeContentBrowserClient::IsValidStoragePartitionId( | 758 bool ChromeContentBrowserClient::IsValidStoragePartitionId( |
754 content::BrowserContext* browser_context, | 759 content::BrowserContext* browser_context, |
755 const std::string& partition_id) { | 760 const std::string& partition_id) { |
756 // The default ID is empty and is always valid. | 761 // The default ID is empty and is always valid. |
757 if (partition_id.empty()) | 762 if (partition_id.empty()) |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
801 | 806 |
802 if (is_isolated) { | 807 if (is_isolated) { |
803 CHECK(site.has_host()); | 808 CHECK(site.has_host()); |
804 // For extensions with isolated storage, the the host of the |site| is | 809 // For extensions with isolated storage, the the host of the |site| is |
805 // the |partition_domain|. The |in_memory| and |partition_name| are only | 810 // the |partition_domain|. The |in_memory| and |partition_name| are only |
806 // used in guest schemes so they are cleared here. | 811 // used in guest schemes so they are cleared here. |
807 *partition_domain = site.host(); | 812 *partition_domain = site.host(); |
808 *in_memory = false; | 813 *in_memory = false; |
809 partition_name->clear(); | 814 partition_name->clear(); |
810 } | 815 } |
| 816 } else if (site.GetOrigin().spec() == kChromeUIChromeSigninURL) { |
| 817 // Chrome signin page has an embedded iframe of extension and web content, |
| 818 // thus it must be isolated from other webUI pages. |
| 819 *partition_domain = chrome::kChromeUIChromeSigninHost; |
811 } | 820 } |
812 | 821 |
813 // Assert that if |can_be_default| is false, the code above must have found a | 822 // Assert that if |can_be_default| is false, the code above must have found a |
814 // non-default partition. If this fails, the caller has a serious logic | 823 // non-default partition. If this fails, the caller has a serious logic |
815 // error about which StoragePartition they expect to be in and it is not | 824 // error about which StoragePartition they expect to be in and it is not |
816 // safe to continue. | 825 // safe to continue. |
817 CHECK(can_be_default || !partition_domain->empty()); | 826 CHECK(can_be_default || !partition_domain->empty()); |
818 } | 827 } |
819 | 828 |
820 content::WebContentsViewDelegate* | 829 content::WebContentsViewDelegate* |
(...skipping 1889 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2710 // releases of Chrome. Permitting "Unknown" allows these APIs to be used on | 2719 // releases of Chrome. Permitting "Unknown" allows these APIs to be used on |
2711 // Chromium builds as well. | 2720 // Chromium builds as well. |
2712 return channel <= chrome::VersionInfo::CHANNEL_DEV; | 2721 return channel <= chrome::VersionInfo::CHANNEL_DEV; |
2713 #else | 2722 #else |
2714 return false; | 2723 return false; |
2715 #endif | 2724 #endif |
2716 } | 2725 } |
2717 | 2726 |
2718 | 2727 |
2719 } // namespace chrome | 2728 } // namespace chrome |
OLD | NEW |