Chromium Code Reviews| 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_HELPER_H_ | 7 #ifndef CHROME_BROWSER_BROWSING_DATA_HELPER_H_ |
| 8 #define CHROME_BROWSER_BROWSING_DATA_HELPER_H_ | 8 #define CHROME_BROWSER_BROWSING_DATA_HELPER_H_ |
| 9 #pragma once | 9 #pragma once |
| 10 | 10 |
| 11 #include <string> | 11 #include <string> |
| 12 | 12 |
| 13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
| 14 | 14 |
| 15 namespace WebKit { | 15 namespace WebKit { |
| 16 class WebString; | 16 class WebString; |
| 17 } | 17 } |
| 18 | 18 |
| 19 class ExtensionSpecialStoragePolicy; | |
| 19 class GURL; | 20 class GURL; |
| 20 | 21 |
| 21 class BrowsingDataHelper { | 22 class BrowsingDataHelper { |
| 22 public: | 23 public: |
| 24 enum OriginSetMask { | |
| 25 UNPROTECTED_WEB = 1 << 0, // drive-by web. | |
|
Evan Stade
2012/06/01 17:17:02
nit: Comments should be capitalized. Also I think
| |
| 26 PROTECTED_WEB = 1 << 1, // hosted applications. | |
| 27 EXTENSION = 1 << 2, // chrome-extension://* | |
| 28 }; | |
| 29 | |
| 23 // 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 |
| 24 // 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 |
| 25 // in ChildProcessSecurityPolicy, but excluding schemes like | 32 // in ChildProcessSecurityPolicy, but excluding schemes like |
| 26 // `chrome-extension`. | 33 // `chrome-extension`. |
| 27 static bool IsWebScheme(const std::string& scheme); | 34 static bool IsWebScheme(const std::string& scheme); |
| 28 static bool IsWebScheme(const WebKit::WebString& scheme); | 35 static bool IsWebScheme(const WebKit::WebString& scheme); |
| 29 static bool HasWebScheme(const GURL& origin); | 36 static bool HasWebScheme(const GURL& origin); |
| 30 | 37 |
| 31 // Returns true iff the provided scheme is an extension. | 38 // Returns true iff the provided scheme is an extension. |
| 32 static bool IsExtensionScheme(const std::string& scheme); | 39 static bool IsExtensionScheme(const std::string& scheme); |
| 33 static bool IsExtensionScheme(const WebKit::WebString& scheme); | 40 static bool IsExtensionScheme(const WebKit::WebString& scheme); |
| 34 static bool HasExtensionScheme(const GURL& origin); | 41 static bool HasExtensionScheme(const GURL& origin); |
| 35 | 42 |
| 43 // Returns true if the provided origin matches the provided mask. | |
| 44 static bool DoesOriginMatchMask(const GURL& origin, | |
| 45 int origin_set_mask, | |
| 46 ExtensionSpecialStoragePolicy* policy); | |
| 47 | |
| 36 private: | 48 private: |
| 37 DISALLOW_IMPLICIT_CONSTRUCTORS(BrowsingDataHelper); | 49 DISALLOW_IMPLICIT_CONSTRUCTORS(BrowsingDataHelper); |
| 38 }; | 50 }; |
| 39 | 51 |
| 40 #endif // CHROME_BROWSER_BROWSING_DATA_HELPER_H_ | 52 #endif // CHROME_BROWSER_BROWSING_DATA_HELPER_H_ |
| OLD | NEW |