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_PUBLIC_PROVIDER_CHROME_BROWSER_BROWSER_STATE_CHROME_BROWSER_STATE_H_ | 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_ | 6 #define IOS_PUBLIC_PROVIDER_CHROME_BROWSER_BROWSER_STATE_CHROME_BROWSER_STATE_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/callback_forward.h" | 9 #include "base/callback_forward.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 | 24 |
25 namespace web { | 25 namespace web { |
26 class WebUIIOS; | 26 class WebUIIOS; |
27 } | 27 } |
28 | 28 |
29 namespace ios { | 29 namespace ios { |
30 | 30 |
31 // This class is a Chrome-specific extension of the BrowserState interface. | 31 // This class is a Chrome-specific extension of the BrowserState interface. |
32 class ChromeBrowserState : public web::BrowserState { | 32 class ChromeBrowserState : public web::BrowserState { |
33 public: | 33 public: |
34 enum ExitType { | |
35 EXIT_NORMAL, | |
36 EXIT_CRASHED, | |
37 }; | |
38 | |
39 ~ChromeBrowserState() override {} | 34 ~ChromeBrowserState() override {} |
40 | 35 |
41 // Returns the ChromeBrowserState corresponding to the given BrowserState. | 36 // Returns the ChromeBrowserState corresponding to the given BrowserState. |
42 static ChromeBrowserState* FromBrowserState(BrowserState* browser_state); | 37 static ChromeBrowserState* FromBrowserState(BrowserState* browser_state); |
43 | 38 |
44 // Returns the ChromeBrowserState corresponding to the given WebUIIOS. | 39 // Returns the ChromeBrowserState corresponding to the given WebUIIOS. |
45 static ChromeBrowserState* FromWebUIIOS(web::WebUIIOS* web_ui); | 40 static ChromeBrowserState* FromWebUIIOS(web::WebUIIOS* web_ui); |
46 | 41 |
47 // Returns sequenced task runner where browser state dependent I/O | 42 // Returns sequenced task runner where browser state dependent I/O |
48 // operations should be performed. | 43 // operations should be performed. |
(...skipping 19 matching lines...) Expand all Loading... |
68 // ChromeBrowserState, if one exists. | 63 // ChromeBrowserState, if one exists. |
69 virtual void DestroyOffTheRecordChromeBrowserState() = 0; | 64 virtual void DestroyOffTheRecordChromeBrowserState() = 0; |
70 | 65 |
71 // Retrieves a pointer to the PrefService that manages the preferences. | 66 // Retrieves a pointer to the PrefService that manages the preferences. |
72 virtual PrefService* GetPrefs() = 0; | 67 virtual PrefService* GetPrefs() = 0; |
73 | 68 |
74 // Retrieves a pointer to the PrefService that manages the preferences as | 69 // Retrieves a pointer to the PrefService that manages the preferences as |
75 // a syncable_prefs::PrefServiceSyncable. | 70 // a syncable_prefs::PrefServiceSyncable. |
76 virtual syncable_prefs::PrefServiceSyncable* GetSyncablePrefs() = 0; | 71 virtual syncable_prefs::PrefServiceSyncable* GetSyncablePrefs() = 0; |
77 | 72 |
78 // Sets the ExitType for the ChromeBrowserState. This may be invoked multiple | |
79 // times during shutdown; only the first such change (the transition from | |
80 // EXIT_CRASHED to one of the other values) is written to prefs, any later | |
81 // calls are ignored. | |
82 // | |
83 // NOTE: this is invoked internally on a normal shutdown, but is public so | |
84 // that it can be invoked to handle backgrounding/foregrounding. | |
85 virtual void SetExitType(ExitType exit_type) = 0; | |
86 | |
87 // Returns how the last session was shutdown. | |
88 virtual ExitType GetLastSessionExitType() = 0; | |
89 | |
90 // Deletes all network related data since |time|. It deletes transport | 73 // Deletes all network related data since |time|. It deletes transport |
91 // security state since |time| and it also deletes HttpServerProperties data. | 74 // security state since |time| and it also deletes HttpServerProperties data. |
92 // Works asynchronously, however if the |completion| callback is non-null, it | 75 // Works asynchronously, however if the |completion| callback is non-null, it |
93 // will be posted on the UI thread once the removal process completes. | 76 // will be posted on the UI thread once the removal process completes. |
94 // Be aware that theoretically it is possible that |completion| will be | 77 // Be aware that theoretically it is possible that |completion| will be |
95 // invoked after the Profile instance has been destroyed. | 78 // invoked after the Profile instance has been destroyed. |
96 virtual void ClearNetworkingHistorySince(base::Time time, | 79 virtual void ClearNetworkingHistorySince(base::Time time, |
97 const base::Closure& completion) = 0; | 80 const base::Closure& completion) = 0; |
98 | 81 |
99 protected: | 82 protected: |
100 ChromeBrowserState() {} | 83 ChromeBrowserState() {} |
101 | 84 |
102 private: | 85 private: |
103 DISALLOW_COPY_AND_ASSIGN(ChromeBrowserState); | 86 DISALLOW_COPY_AND_ASSIGN(ChromeBrowserState); |
104 }; | 87 }; |
105 | 88 |
106 } // namespace ios | 89 } // namespace ios |
107 | 90 |
108 #endif // IOS_PUBLIC_PROVIDER_CHROME_BROWSER_BROWSER_STATE_CHROME_BROWSER_STATE
_H_ | 91 #endif // IOS_PUBLIC_PROVIDER_CHROME_BROWSER_BROWSER_STATE_CHROME_BROWSER_STATE
_H_ |
OLD | NEW |