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