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/macros.h" | 12 #include "base/macros.h" |
13 | 13 |
14 namespace storage { | |
15 class SpecialStoragePolicy; | |
16 } | |
17 | |
18 class GURL; | 14 class GURL; |
19 | 15 |
| 16 // TODO(crbug.com/668114): DEPRECATED. Remove this class. |
| 17 // The primary functionality of testing origin type masks has moved to |
| 18 // BrowsingDataRemover. The secondary functionality of recognizing web schemes |
| 19 // storing browsing data has moved to url::GetWebStorageSchemes(); |
| 20 // or alternatively, it can also be retrieved from BrowsingDataRemover by |
| 21 // testing the ORIGIN_TYPE_UNPROTECTED_ORIGIN | ORIGIN_TYPE_PROTECTED_ORIGIN |
| 22 // origin mask. This class now merely forwards the functionality to several |
| 23 // helper classes in the browsing_data codebase. |
20 class BrowsingDataHelper { | 24 class BrowsingDataHelper { |
21 public: | 25 public: |
22 enum OriginTypeMask { | |
23 UNPROTECTED_WEB = 1 << 0, // drive-by web. | |
24 PROTECTED_WEB = 1 << 1, // hosted applications. | |
25 EXTENSION = 1 << 2, // chrome-extension://* | |
26 // Always add new items to the enum above ALL and add them to ALL. | |
27 ALL = UNPROTECTED_WEB | PROTECTED_WEB | EXTENSION, | |
28 }; | |
29 | |
30 // Returns true iff the provided scheme is (really) web safe, and suitable | 26 // Returns true iff the provided scheme is (really) web safe, and suitable |
31 // for treatment as "browsing data". This relies on the definition of web safe | 27 // for treatment as "browsing data". This relies on the definition of web safe |
32 // in ChildProcessSecurityPolicy, but excluding schemes like | 28 // in ChildProcessSecurityPolicy, but excluding schemes like |
33 // `chrome-extension`. | 29 // `chrome-extension`. |
34 static bool IsWebScheme(const std::string& scheme); | 30 static bool IsWebScheme(const std::string& scheme); |
35 static bool HasWebScheme(const GURL& origin); | 31 static bool HasWebScheme(const GURL& origin); |
36 | 32 |
37 // Returns true iff the provided scheme is an extension. | 33 // Returns true iff the provided scheme is an extension. |
38 static bool IsExtensionScheme(const std::string& scheme); | 34 static bool IsExtensionScheme(const std::string& scheme); |
39 static bool HasExtensionScheme(const GURL& origin); | 35 static bool HasExtensionScheme(const GURL& origin); |
40 | 36 |
41 // Returns true if the provided origin matches the provided mask. | |
42 static bool DoesOriginMatchMask(const GURL& origin, | |
43 int origin_type_mask, | |
44 storage::SpecialStoragePolicy* policy); | |
45 | |
46 private: | 37 private: |
47 DISALLOW_IMPLICIT_CONSTRUCTORS(BrowsingDataHelper); | 38 DISALLOW_IMPLICIT_CONSTRUCTORS(BrowsingDataHelper); |
48 }; | 39 }; |
49 | 40 |
50 #endif // CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_HELPER_H_ | 41 #endif // CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_HELPER_H_ |
OLD | NEW |