| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2014 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. |
| 4 |
| 5 #ifndef IOS_WEB_VIEW_INTERNAL_CRIWV_BROWSER_STATE_H_ |
| 6 #define IOS_WEB_VIEW_INTERNAL_CRIWV_BROWSER_STATE_H_ |
| 7 |
| 8 #include <memory> |
| 9 |
| 10 #include "base/files/file_path.h" |
| 11 #include "base/macros.h" |
| 12 #include "base/memory/ref_counted.h" |
| 13 #include "components/prefs/pref_service.h" |
| 14 #include "ios/web/public/browser_state.h" |
| 15 |
| 16 namespace user_prefs { |
| 17 class PrefRegistrySyncable; |
| 18 } |
| 19 |
| 20 namespace ios_web_view { |
| 21 |
| 22 class CRIWVURLRequestContextGetter; |
| 23 |
| 24 // CRIWV implementation of BrowserState. Can only be called from the UI thread. |
| 25 class CRIWVBrowserState : public web::BrowserState { |
| 26 public: |
| 27 CRIWVBrowserState(); |
| 28 ~CRIWVBrowserState() override; |
| 29 |
| 30 // web::BrowserState implementation. |
| 31 bool IsOffTheRecord() const override; |
| 32 base::FilePath GetStatePath() const override; |
| 33 net::URLRequestContextGetter* GetRequestContext() override; |
| 34 |
| 35 // Returns the associated PrefService. |
| 36 PrefService* GetPrefs(); |
| 37 |
| 38 // Converts from web::BrowserState to CRIWVBrowserState. |
| 39 static CRIWVBrowserState* FromBrowserState(web::BrowserState* browser_state); |
| 40 |
| 41 private: |
| 42 // Registers the preferences for this BrowserState. |
| 43 void RegisterPrefs(user_prefs::PrefRegistrySyncable* pref_registry); |
| 44 |
| 45 // The path associated with this BrowserState object. |
| 46 base::FilePath path_; |
| 47 |
| 48 // The request context getter for this BrowserState object. |
| 49 scoped_refptr<CRIWVURLRequestContextGetter> request_context_getter_; |
| 50 |
| 51 // The PrefService associated with this BrowserState. |
| 52 std::unique_ptr<PrefService> prefs_; |
| 53 |
| 54 DISALLOW_COPY_AND_ASSIGN(CRIWVBrowserState); |
| 55 }; |
| 56 |
| 57 } // namespace ios_web_view |
| 58 |
| 59 #endif // IOS_WEB_VIEW_INTERNAL_CRIWV_BROWSER_STATE_H_ |
| OLD | NEW |