Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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_CHROME_BROWSER_BROWSER_STATE_CHROME_BROWSER_STATE_H_ | 5 #ifndef IOS_CHROME_BROWSER_BROWSER_STATE_CHROME_BROWSER_STATE_H_ |
| 6 #define IOS_CHROME_BROWSER_BROWSER_STATE_CHROME_BROWSER_STATE_H_ | 6 #define IOS_CHROME_BROWSER_BROWSER_STATE_CHROME_BROWSER_STATE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/callback_forward.h" | 11 #include "base/callback_forward.h" |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/memory/linked_ptr.h" | 14 #include "base/memory/linked_ptr.h" |
| 15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
| 16 #include "base/memory/scoped_vector.h" | 16 #include "base/memory/scoped_vector.h" |
| 17 #include "ios/web/public/browser_state.h" | 17 #include "ios/web/public/browser_state.h" |
| 18 #include "net/url_request/url_request_job_factory.h" | 18 #include "net/url_request/url_request_job_factory.h" |
| 19 | 19 |
| 20 class ChromeBrowserStateIOData; | 20 class ChromeBrowserStateIOData; |
| 21 class PrefProxyConfigTracker; | 21 class PrefProxyConfigTracker; |
| 22 class PrefService; | 22 class PrefService; |
| 23 class TestChromeBrowserState; | 23 class TestChromeBrowserState; |
| 24 class TestChromeBrowserStateManager; | |
| 24 | 25 |
| 25 namespace base { | 26 namespace base { |
| 26 class SequencedTaskRunner; | 27 class SequencedTaskRunner; |
| 27 class Time; | 28 class Time; |
| 28 } | 29 } |
| 29 | 30 |
| 30 namespace net { | 31 namespace net { |
| 31 class SSLConfigService; | 32 class SSLConfigService; |
| 32 class URLRequestInterceptor; | 33 class URLRequestInterceptor; |
| 33 } | 34 } |
| 34 | 35 |
| 35 namespace syncable_prefs { | 36 namespace syncable_prefs { |
| 36 class PrefServiceSyncable; | 37 class PrefServiceSyncable; |
| 37 } | 38 } |
| 38 | 39 |
| 39 namespace web { | 40 namespace web { |
| 40 class WebUIIOS; | 41 class WebUIIOS; |
| 41 } | 42 } |
| 42 | 43 |
| 43 namespace ios { | 44 namespace ios { |
| 44 | 45 |
| 45 enum class ChromeBrowserStateType { | 46 enum class ChromeBrowserStateType { |
| 46 REGULAR_BROWSER_STATE, | 47 REGULAR_BROWSER_STATE, |
| 47 INCOGNITO_BROWSER_STATE, | 48 INCOGNITO_BROWSER_STATE, |
| 48 }; | 49 }; |
| 49 | 50 |
| 50 // This class is a Chrome-specific extension of the BrowserState interface. | 51 // This class is a Chrome-specific extension of the BrowserState interface. |
| 51 class ChromeBrowserState : public web::BrowserState { | 52 class ChromeBrowserState : public web::BrowserState { |
| 52 public: | 53 public: |
| 53 ~ChromeBrowserState() override {} | 54 ~ChromeBrowserState() override; |
| 54 | 55 |
| 55 // Returns the ChromeBrowserState corresponding to the given BrowserState. | 56 // Returns the ChromeBrowserState corresponding to the given BrowserState. |
| 56 static ChromeBrowserState* FromBrowserState(BrowserState* browser_state); | 57 static ChromeBrowserState* FromBrowserState(BrowserState* browser_state); |
| 57 | 58 |
| 58 // Returns the ChromeBrowserState corresponding to the given WebUIIOS. | 59 // Returns the ChromeBrowserState corresponding to the given WebUIIOS. |
| 59 static ChromeBrowserState* FromWebUIIOS(web::WebUIIOS* web_ui); | 60 static ChromeBrowserState* FromWebUIIOS(web::WebUIIOS* web_ui); |
| 60 | 61 |
| 61 // Returns sequenced task runner where browser state dependent I/O | 62 // Returns sequenced task runner where browser state dependent I/O |
| 62 // operations should be performed. | 63 // operations should be performed. |
| 63 virtual scoped_refptr<base::SequencedTaskRunner> GetIOTaskRunner() = 0; | 64 virtual scoped_refptr<base::SequencedTaskRunner> GetIOTaskRunner(); |
| 64 | 65 |
| 65 // Returns the original "recording" ChromeBrowserState. This method returns | 66 // Returns the original "recording" ChromeBrowserState. This method returns |
| 66 // |this| if the ChromeBrowserState is not incognito. | 67 // |this| if the ChromeBrowserState is not incognito. |
| 67 virtual ChromeBrowserState* GetOriginalChromeBrowserState() = 0; | 68 virtual ChromeBrowserState* GetOriginalChromeBrowserState() = 0; |
| 68 | 69 |
| 69 // Returns true if the ChromeBrowserState is off-the-record or if the | 70 // Returns true if the ChromeBrowserState is off-the-record or if the |
| 70 // associated off-the-record browser state has been created. | 71 // associated off-the-record browser state has been created. |
| 71 // Calling this method does not create the off-the-record browser state if it | 72 // Calling this method does not create the off-the-record browser state if it |
| 72 // does not already exist. | 73 // does not already exist. |
| 73 virtual bool HasOffTheRecordChromeBrowserState() const = 0; | 74 virtual bool HasOffTheRecordChromeBrowserState() const = 0; |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 89 // for OffTheRecord browser states. | 90 // for OffTheRecord browser states. |
| 90 virtual PrefService* GetOffTheRecordPrefs() = 0; | 91 virtual PrefService* GetOffTheRecordPrefs() = 0; |
| 91 | 92 |
| 92 // Allows access to ChromeBrowserStateIOData without going through | 93 // Allows access to ChromeBrowserStateIOData without going through |
| 93 // ResourceContext that is not compiled on iOS. This method must be called on | 94 // ResourceContext that is not compiled on iOS. This method must be called on |
| 94 // UI thread, but the returned object must only be accessed on the IO thread. | 95 // UI thread, but the returned object must only be accessed on the IO thread. |
| 95 virtual ChromeBrowserStateIOData* GetIOData() = 0; | 96 virtual ChromeBrowserStateIOData* GetIOData() = 0; |
| 96 | 97 |
| 97 // Retrieves a pointer to the PrefService that manages the preferences as | 98 // Retrieves a pointer to the PrefService that manages the preferences as |
| 98 // a syncable_prefs::PrefServiceSyncable. | 99 // a syncable_prefs::PrefServiceSyncable. |
| 99 virtual syncable_prefs::PrefServiceSyncable* GetSyncablePrefs() = 0; | 100 virtual syncable_prefs::PrefServiceSyncable* GetSyncablePrefs(); |
| 100 | 101 |
| 101 // Deletes all network related data since |time|. It deletes transport | 102 // Deletes all network related data since |time|. It deletes transport |
| 102 // security state since |time| and it also deletes HttpServerProperties data. | 103 // security state since |time| and it also deletes HttpServerProperties data. |
| 103 // Works asynchronously, however if the |completion| callback is non-null, it | 104 // Works asynchronously, however if the |completion| callback is non-null, it |
| 104 // will be posted on the UI thread once the removal process completes. | 105 // will be posted on the UI thread once the removal process completes. |
| 105 // Be aware that theoretically it is possible that |completion| will be | 106 // Be aware that theoretically it is possible that |completion| will be |
| 106 // invoked after the Profile instance has been destroyed. | 107 // invoked after the Profile instance has been destroyed. |
| 107 virtual void ClearNetworkingHistorySince(base::Time time, | 108 virtual void ClearNetworkingHistorySince(base::Time time, |
| 108 const base::Closure& completion) = 0; | 109 const base::Closure& completion) = 0; |
| 109 | 110 |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 125 protocol_handlers, | 126 protocol_handlers, |
| 126 ScopedVector<net::URLRequestInterceptor> request_interceptors) = 0; | 127 ScopedVector<net::URLRequestInterceptor> request_interceptors) = 0; |
| 127 | 128 |
| 128 // Creates a isolated net::URLRequestContextGetter. Should only be called once | 129 // Creates a isolated net::URLRequestContextGetter. Should only be called once |
| 129 // per partition_path per browser state object. | 130 // per partition_path per browser state object. |
| 130 virtual net::URLRequestContextGetter* CreateIsolatedRequestContext( | 131 virtual net::URLRequestContextGetter* CreateIsolatedRequestContext( |
| 131 const base::FilePath& partition_path) = 0; | 132 const base::FilePath& partition_path) = 0; |
| 132 | 133 |
| 133 // Returns the current ChromeBrowserState casted as a TestChromeBrowserState | 134 // Returns the current ChromeBrowserState casted as a TestChromeBrowserState |
| 134 // or null if it is not a TestChromeBrowserState. | 135 // or null if it is not a TestChromeBrowserState. |
| 135 virtual TestChromeBrowserState* AsTestChromeBrowserState() = 0; | 136 virtual TestChromeBrowserState* AsTestChromeBrowserState(); |
|
droger
2016/02/03 16:20:48
It would be great to remove this:
1) It seems this
sdefresne
2016/02/03 16:32:05
=> crbug.com/583682
| |
| 137 | |
| 138 // web::BrowserState | |
| 139 net::URLRequestContextGetter* GetRequestContext() override; | |
| 136 | 140 |
| 137 protected: | 141 protected: |
| 138 ChromeBrowserState() {} | 142 ChromeBrowserState(); |
| 139 | 143 |
| 140 private: | 144 private: |
| 145 friend class ::TestChromeBrowserState; | |
| 146 friend class ::TestChromeBrowserStateManager; | |
| 147 | |
| 148 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; | |
| 149 | |
| 141 DISALLOW_COPY_AND_ASSIGN(ChromeBrowserState); | 150 DISALLOW_COPY_AND_ASSIGN(ChromeBrowserState); |
| 142 }; | 151 }; |
| 143 | 152 |
| 144 } // namespace ios | 153 } // namespace ios |
| 145 | 154 |
| 146 #endif // IOS_CHROME_BROWSER_BROWSER_STATE_CHROME_BROWSER_STATE_H_ | 155 #endif // IOS_CHROME_BROWSER_BROWSER_STATE_CHROME_BROWSER_STATE_H_ |
| OLD | NEW |