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_PUBLIC_PROVIDER_CHROME_BROWSER_BROWSER_STATE_CHROME_BROWSER_STATE_H_
6 #define IOS_PUBLIC_PROVIDER_CHROME_BROWSER_BROWSER_STATE_CHROME_BROWSER_STATE_H_
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "base/memory/ref_counted.h"
11 #include "ios/web/public/browser_state.h"
13 class HostContentSettingsMap
;
17 class SequencedTaskRunner
;
22 // This class is a Chrome-specific extension of the BrowserState interface.
23 class ChromeBrowserState
: public web::BrowserState
{
25 ~ChromeBrowserState() override
{}
27 // Returns the ChromeBrowserState corresponding to the given BrowserState.
28 static ChromeBrowserState
* FromBrowserState(BrowserState
* browser_state
);
30 // Returns sequenced task runner where browser state dependent I/O
31 // operations should be performed.
32 virtual scoped_refptr
<base::SequencedTaskRunner
> GetIOTaskRunner() = 0;
34 // Returns the original "recording" ChromeBrowserState. This method returns
35 // |this| if the ChromeBrowserState is not incognito.
36 virtual ChromeBrowserState
* GetOriginalChromeBrowserState() = 0;
38 // Returns the incognito version of this ChromeBrowserState. The returned
39 // ChromeBrowserState instance is owned by this ChromeBrowserState instance.
40 // WARNING: This will create the OffTheRecord ChromeBrowserState if it
41 // doesn't already exist.
42 virtual ChromeBrowserState
* GetOffTheRecordChromeBrowserState() = 0;
44 // Destroys the OffTheRecord ChromeBrowserState that is associated with this
45 // ChromeBrowserState, if one exists.
46 virtual void DestroyOffTheRecordChromeBrowserState() = 0;
48 // Retrieves a pointer to the PrefService that manages the preferences.
49 virtual PrefService
* GetPrefs() = 0;
51 // Returns the Hostname <-> Content settings map for the ChromeBrowserState.
52 virtual HostContentSettingsMap
* GetHostContentSettingsMap() = 0;
55 ChromeBrowserState() {}
58 DISALLOW_COPY_AND_ASSIGN(ChromeBrowserState
);
63 #endif // IOS_PUBLIC_PROVIDER_CHROME_BROWSER_BROWSER_STATE_CHROME_BROWSER_STATE_H_