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
3 // found in the LICENSE file.
5 #ifndef IOS_WEB_PUBLIC_BROWSER_STATE_H_
6 #define IOS_WEB_PUBLIC_BROWSER_STATE_H_
8 #include "base/supports_user_data.h"
15 class URLRequestContextGetter
;
19 class CertificatePolicyCache
;
21 // This class holds the context needed for a browsing session.
22 // It lives on the UI thread. All these methods must only be called on the UI
24 class BrowserState
: public base::SupportsUserData
{
26 ~BrowserState() override
;
29 static scoped_refptr
<CertificatePolicyCache
> GetCertificatePolicyCache(
30 BrowserState
* browser_state
);
32 // Returns whether this BrowserState is incognito. Default is false.
33 virtual bool IsOffTheRecord() const = 0;
35 // Returns the path where the BrowserState data is stored.
36 // Unlike Profile::GetPath(), incognito BrowserState do not share their path
37 // with their original BrowserState.
38 virtual base::FilePath
GetStatePath() const = 0;
40 // Returns the request context information associated with this
42 virtual net::URLRequestContextGetter
* GetRequestContext() = 0;
44 // Safely cast a base::SupportsUserData to a BrowserState. Returns nullptr
45 // if |supports_user_data| is not a BrowserState.
46 static BrowserState
* FromSupportsUserData(
47 base::SupportsUserData
* supports_user_data
);
55 #endif // IOS_WEB_PUBLIC_BROWSER_STATE_H_