Supervised user whitelists: Cleanup
[chromium-blink-merge.git] / ios / web / public / browser_state.h
blob44facddd093ddb9ece2b3e5ccb7b94a3017b987e
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"
10 namespace base {
11 class FilePath;
14 namespace net {
15 class URLRequestContextGetter;
18 namespace web {
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
23 // thread.
24 class BrowserState : public base::SupportsUserData {
25 public:
26 ~BrowserState() override;
28 // static
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
41 // BrowserState.
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);
49 protected:
50 BrowserState();
53 } // namespace web
55 #endif // IOS_WEB_PUBLIC_BROWSER_STATE_H_