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