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 // Defines methods relevant to all code that wants to work with browsing data. | 5 // Defines methods relevant to all code that wants to work with browsing data. |
6 | 6 |
7 #ifndef CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_HELPER_H_ | 7 #ifndef CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_HELPER_H_ |
8 #define CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_HELPER_H_ | 8 #define CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_HELPER_H_ |
9 | 9 |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 | 13 |
14 class ExtensionSpecialStoragePolicy; | 14 namespace quota { |
| 15 class SpecialStoragePolicy; |
| 16 } |
| 17 |
15 class GURL; | 18 class GURL; |
16 | 19 |
17 class BrowsingDataHelper { | 20 class BrowsingDataHelper { |
18 public: | 21 public: |
19 enum OriginSetMask { | 22 enum OriginSetMask { |
20 UNPROTECTED_WEB = 1 << 0, // drive-by web. | 23 UNPROTECTED_WEB = 1 << 0, // drive-by web. |
21 PROTECTED_WEB = 1 << 1, // hosted applications. | 24 PROTECTED_WEB = 1 << 1, // hosted applications. |
22 EXTENSION = 1 << 2, // chrome-extension://* | 25 EXTENSION = 1 << 2, // chrome-extension://* |
23 // Always add new items to the enum above ALL and add them to ALL. | 26 // Always add new items to the enum above ALL and add them to ALL. |
24 ALL = UNPROTECTED_WEB | PROTECTED_WEB | EXTENSION, | 27 ALL = UNPROTECTED_WEB | PROTECTED_WEB | EXTENSION, |
25 }; | 28 }; |
26 | 29 |
27 // Returns true iff the provided scheme is (really) web safe, and suitable | 30 // Returns true iff the provided scheme is (really) web safe, and suitable |
28 // for treatment as "browsing data". This relies on the definition of web safe | 31 // for treatment as "browsing data". This relies on the definition of web safe |
29 // in ChildProcessSecurityPolicy, but excluding schemes like | 32 // in ChildProcessSecurityPolicy, but excluding schemes like |
30 // `chrome-extension`. | 33 // `chrome-extension`. |
31 static bool IsWebScheme(const std::string& scheme); | 34 static bool IsWebScheme(const std::string& scheme); |
32 static bool HasWebScheme(const GURL& origin); | 35 static bool HasWebScheme(const GURL& origin); |
33 | 36 |
34 // Returns true iff the provided scheme is an extension. | 37 // Returns true iff the provided scheme is an extension. |
35 static bool IsExtensionScheme(const std::string& scheme); | 38 static bool IsExtensionScheme(const std::string& scheme); |
36 static bool HasExtensionScheme(const GURL& origin); | 39 static bool HasExtensionScheme(const GURL& origin); |
37 | 40 |
38 // Returns true if the provided origin matches the provided mask. | 41 // Returns true if the provided origin matches the provided mask. |
39 static bool DoesOriginMatchMask(const GURL& origin, | 42 static bool DoesOriginMatchMask(const GURL& origin, |
40 int origin_set_mask, | 43 int origin_set_mask, |
41 ExtensionSpecialStoragePolicy* policy); | 44 quota::SpecialStoragePolicy* policy); |
42 | 45 |
43 private: | 46 private: |
44 DISALLOW_IMPLICIT_CONSTRUCTORS(BrowsingDataHelper); | 47 DISALLOW_IMPLICIT_CONSTRUCTORS(BrowsingDataHelper); |
45 }; | 48 }; |
46 | 49 |
47 #endif // CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_HELPER_H_ | 50 #endif // CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_HELPER_H_ |
OLD | NEW |