| 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 718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 729 return main_parts; | 729 return main_parts; |
| 730 } | 730 } |
| 731 | 731 |
| 732 std::string ChromeContentBrowserClient::GetStoragePartitionIdForSite( | 732 std::string ChromeContentBrowserClient::GetStoragePartitionIdForSite( |
| 733 content::BrowserContext* browser_context, | 733 content::BrowserContext* browser_context, |
| 734 const GURL& site) { | 734 const GURL& site) { |
| 735 std::string partition_id; | 735 std::string partition_id; |
| 736 | 736 |
| 737 // The partition ID for webview guest processes is the string value of its | 737 // The partition ID for webview guest processes is the string value of its |
| 738 // SiteInstance URL - "chrome-guest://app_id/persist?partition". | 738 // SiteInstance URL - "chrome-guest://app_id/persist?partition". |
| 739 if (site.SchemeIs(content::kGuestScheme)) | 739 if (site.SchemeIs(content::kGuestScheme)) { |
| 740 partition_id = site.spec(); | 740 partition_id = site.spec(); |
| 741 } else if (site.SchemeIs(chrome::kChromeUIScheme) && |
| 742 site.host() == chrome::kChromeSigninHost) { |
| 743 partition_id = site.spec(); |
| 744 } |
| 741 | 745 |
| 742 DCHECK(IsValidStoragePartitionId(browser_context, partition_id)); | 746 DCHECK(IsValidStoragePartitionId(browser_context, partition_id)); |
| 743 return partition_id; | 747 return partition_id; |
| 744 } | 748 } |
| 745 | 749 |
| 746 bool ChromeContentBrowserClient::IsValidStoragePartitionId( | 750 bool ChromeContentBrowserClient::IsValidStoragePartitionId( |
| 747 content::BrowserContext* browser_context, | 751 content::BrowserContext* browser_context, |
| 748 const std::string& partition_id) { | 752 const std::string& partition_id) { |
| 749 // The default ID is empty and is always valid. | 753 // The default ID is empty and is always valid. |
| 750 if (partition_id.empty()) | 754 if (partition_id.empty()) |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 794 | 798 |
| 795 if (is_isolated) { | 799 if (is_isolated) { |
| 796 CHECK(site.has_host()); | 800 CHECK(site.has_host()); |
| 797 // For extensions with isolated storage, the the host of the |site| is | 801 // For extensions with isolated storage, the the host of the |site| is |
| 798 // the |partition_domain|. The |in_memory| and |partition_name| are only | 802 // the |partition_domain|. The |in_memory| and |partition_name| are only |
| 799 // used in guest schemes so they are cleared here. | 803 // used in guest schemes so they are cleared here. |
| 800 *partition_domain = site.host(); | 804 *partition_domain = site.host(); |
| 801 *in_memory = false; | 805 *in_memory = false; |
| 802 partition_name->clear(); | 806 partition_name->clear(); |
| 803 } | 807 } |
| 808 } else if (site.SchemeIs(chrome::kChromeUIScheme) && |
| 809 site.host() == chrome::kChromeSigninHost) { |
| 810 *partition_domain = chrome::kChromeSigninHost; |
| 804 } | 811 } |
| 805 | 812 |
| 806 // Assert that if |can_be_default| is false, the code above must have found a | 813 // Assert that if |can_be_default| is false, the code above must have found a |
| 807 // non-default partition. If this fails, the caller has a serious logic | 814 // non-default partition. If this fails, the caller has a serious logic |
| 808 // error about which StoragePartition they expect to be in and it is not | 815 // error about which StoragePartition they expect to be in and it is not |
| 809 // safe to continue. | 816 // safe to continue. |
| 810 CHECK(can_be_default || !partition_domain->empty()); | 817 CHECK(can_be_default || !partition_domain->empty()); |
| 811 } | 818 } |
| 812 | 819 |
| 813 content::WebContentsViewDelegate* | 820 content::WebContentsViewDelegate* |
| (...skipping 1886 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2700 // releases of Chrome. Permitting "Unknown" allows these APIs to be used on | 2707 // releases of Chrome. Permitting "Unknown" allows these APIs to be used on |
| 2701 // Chromium builds as well. | 2708 // Chromium builds as well. |
| 2702 return channel <= chrome::VersionInfo::CHANNEL_DEV; | 2709 return channel <= chrome::VersionInfo::CHANNEL_DEV; |
| 2703 #else | 2710 #else |
| 2704 return false; | 2711 return false; |
| 2705 #endif | 2712 #endif |
| 2706 } | 2713 } |
| 2707 | 2714 |
| 2708 | 2715 |
| 2709 } // namespace chrome | 2716 } // namespace chrome |
| OLD | NEW |