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/browsing_data/browsing_data_helper.h" | 5 #include "chrome/browser/browsing_data/browsing_data_helper.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/common/chrome_switches.h" | 9 #include "chrome/common/chrome_switches.h" |
10 #include "chrome/common/url_constants.h" | 10 #include "chrome/common/url_constants.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 bool BrowsingDataHelper::IsExtensionScheme(const std::string& scheme) { | 40 bool BrowsingDataHelper::IsExtensionScheme(const std::string& scheme) { |
41 return scheme == extensions::kExtensionScheme; | 41 return scheme == extensions::kExtensionScheme; |
42 } | 42 } |
43 | 43 |
44 // Static | 44 // Static |
45 bool BrowsingDataHelper::HasExtensionScheme(const GURL& origin) { | 45 bool BrowsingDataHelper::HasExtensionScheme(const GURL& origin) { |
46 return BrowsingDataHelper::IsExtensionScheme(origin.scheme()); | 46 return BrowsingDataHelper::IsExtensionScheme(origin.scheme()); |
47 } | 47 } |
48 | 48 |
49 // Static | 49 // Static |
50 bool BrowsingDataHelper::DoesOriginMatchMask(const GURL& origin, | 50 bool BrowsingDataHelper::DoesOriginMatchMask( |
51 int origin_set_mask, quota::SpecialStoragePolicy* policy) { | 51 const GURL& origin, |
| 52 int origin_set_mask, |
| 53 storage::SpecialStoragePolicy* policy) { |
52 // Packaged apps and extensions match iff EXTENSION. | 54 // Packaged apps and extensions match iff EXTENSION. |
53 if (BrowsingDataHelper::HasExtensionScheme(origin.GetOrigin()) && | 55 if (BrowsingDataHelper::HasExtensionScheme(origin.GetOrigin()) && |
54 origin_set_mask & EXTENSION) | 56 origin_set_mask & EXTENSION) |
55 return true; | 57 return true; |
56 | 58 |
57 // If a websafe origin is unprotected, it matches iff UNPROTECTED_WEB. | 59 // If a websafe origin is unprotected, it matches iff UNPROTECTED_WEB. |
58 if ((!policy || !policy->IsStorageProtected(origin.GetOrigin())) && | 60 if ((!policy || !policy->IsStorageProtected(origin.GetOrigin())) && |
59 BrowsingDataHelper::HasWebScheme(origin.GetOrigin()) && | 61 BrowsingDataHelper::HasWebScheme(origin.GetOrigin()) && |
60 origin_set_mask & UNPROTECTED_WEB) | 62 origin_set_mask & UNPROTECTED_WEB) |
61 return true; | 63 return true; |
62 | 64 |
63 // Hosted applications (protected and websafe origins) iff PROTECTED_WEB. | 65 // Hosted applications (protected and websafe origins) iff PROTECTED_WEB. |
64 if (policy && | 66 if (policy && |
65 policy->IsStorageProtected(origin.GetOrigin()) && | 67 policy->IsStorageProtected(origin.GetOrigin()) && |
66 BrowsingDataHelper::HasWebScheme(origin.GetOrigin()) && | 68 BrowsingDataHelper::HasWebScheme(origin.GetOrigin()) && |
67 origin_set_mask & PROTECTED_WEB) | 69 origin_set_mask & PROTECTED_WEB) |
68 return true; | 70 return true; |
69 | 71 |
70 return false; | 72 return false; |
71 } | 73 } |
OLD | NEW |