| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef IOS_WEB_PUBLIC_BROWSER_STATE_H_ | 5 #ifndef IOS_WEB_PUBLIC_BROWSER_STATE_H_ |
| 6 #define IOS_WEB_PUBLIC_BROWSER_STATE_H_ | 6 #define IOS_WEB_PUBLIC_BROWSER_STATE_H_ |
| 7 | 7 |
| 8 #include "base/supports_user_data.h" | 8 #include "base/supports_user_data.h" |
| 9 | 9 |
| 10 namespace base { | 10 namespace base { |
| 11 class FilePath; | 11 class FilePath; |
| 12 } | 12 } |
| 13 | 13 |
| 14 namespace net { | 14 namespace net { |
| 15 class URLRequestContextGetter; | 15 class URLRequestContextGetter; |
| 16 } | 16 } |
| 17 | 17 |
| 18 namespace web { | 18 namespace web { |
| 19 class CertificatePolicyCache; |
| 19 | 20 |
| 20 // This class holds the context needed for a browsing session. | 21 // This class holds the context needed for a browsing session. |
| 21 // It lives on the UI thread. All these methods must only be called on the UI | 22 // It lives on the UI thread. All these methods must only be called on the UI |
| 22 // thread. | 23 // thread. |
| 23 class BrowserState : public base::SupportsUserData { | 24 class BrowserState : public base::SupportsUserData { |
| 24 public: | 25 public: |
| 25 ~BrowserState() override; | 26 ~BrowserState() override; |
| 26 | 27 |
| 28 // static |
| 29 static scoped_refptr<CertificatePolicyCache> GetCertificatePolicyCache( |
| 30 BrowserState* browser_state); |
| 31 |
| 27 // Returns whether this BrowserState is incognito. Default is false. | 32 // Returns whether this BrowserState is incognito. Default is false. |
| 28 virtual bool IsOffTheRecord() const = 0; | 33 virtual bool IsOffTheRecord() const = 0; |
| 29 | 34 |
| 30 // Returns the path where the BrowserState data is stored. | 35 // Returns the path where the BrowserState data is stored. |
| 31 // Unlike Profile::GetPath(), incognito BrowserState do not share their path | 36 // Unlike Profile::GetPath(), incognito BrowserState do not share their path |
| 32 // with their original BrowserState. | 37 // with their original BrowserState. |
| 33 virtual base::FilePath GetStatePath() const = 0; | 38 virtual base::FilePath GetStatePath() const = 0; |
| 34 | 39 |
| 35 // Returns the request context information associated with this | 40 // Returns the request context information associated with this |
| 36 // BrowserState. | 41 // BrowserState. |
| 37 virtual net::URLRequestContextGetter* GetRequestContext() = 0; | 42 virtual net::URLRequestContextGetter* GetRequestContext() = 0; |
| 38 | 43 |
| 39 // Safely cast a base::SupportsUserData to a BrowserState. Returns nullptr | 44 // Safely cast a base::SupportsUserData to a BrowserState. Returns nullptr |
| 40 // if |supports_user_data| is not a BrowserState. | 45 // if |supports_user_data| is not a BrowserState. |
| 41 static BrowserState* FromSupportsUserData( | 46 static BrowserState* FromSupportsUserData( |
| 42 base::SupportsUserData* supports_user_data); | 47 base::SupportsUserData* supports_user_data); |
| 43 | 48 |
| 44 protected: | 49 protected: |
| 45 BrowserState(); | 50 BrowserState(); |
| 46 }; | 51 }; |
| 47 | 52 |
| 48 } // namespace web | 53 } // namespace web |
| 49 | 54 |
| 50 #endif // IOS_WEB_PUBLIC_BROWSER_STATE_H_ | 55 #endif // IOS_WEB_PUBLIC_BROWSER_STATE_H_ |
| OLD | NEW |