Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(68)

Side by Side Diff: chrome/browser/chromeos/arc/arc_session_manager.h

Issue 2541173002: arc: Make request to remove Android's data folder persistent. (Closed)
Patch Set: fix browser tests Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 CHROME_BROWSER_CHROMEOS_ARC_ARC_SESSION_MANAGER_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_ARC_ARC_SESSION_MANAGER_H_
6 #define CHROME_BROWSER_CHROMEOS_ARC_ARC_SESSION_MANAGER_H_ 6 #define CHROME_BROWSER_CHROMEOS_ARC_ARC_SESSION_MANAGER_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <ostream> 9 #include <ostream>
10 #include <string> 10 #include <string>
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 // FETCHING_CODE -> ACTIVE: when the auth token is successfully fetched. 87 // FETCHING_CODE -> ACTIVE: when the auth token is successfully fetched.
88 // 88 //
89 // In the second (or later) boot case: 89 // In the second (or later) boot case:
90 // STOPPED -> ACTIVE: when arc.enabled preference is checked that it is 90 // STOPPED -> ACTIVE: when arc.enabled preference is checked that it is
91 // true. Practically, this is when the primary Profile gets ready. 91 // true. Practically, this is when the primary Profile gets ready.
92 enum class State { 92 enum class State {
93 NOT_INITIALIZED, 93 NOT_INITIALIZED,
94 STOPPED, 94 STOPPED,
95 SHOWING_TERMS_OF_SERVICE, 95 SHOWING_TERMS_OF_SERVICE,
96 CHECKING_ANDROID_MANAGEMENT, 96 CHECKING_ANDROID_MANAGEMENT,
97 REMOVING_DATA_DIR,
97 ACTIVE, 98 ACTIVE,
98 }; 99 };
99 100
100 class Observer { 101 class Observer {
101 public: 102 public:
102 virtual ~Observer() = default; 103 virtual ~Observer() = default;
103 104
104 // Called to notify that ARC bridge is shut down. 105 // Called to notify that ARC bridge is shut down.
105 virtual void OnShutdownBridge() {} 106 virtual void OnShutdownBridge() {}
106 107
107 // Called to notify that ARC enabled state has been updated. 108 // Called to notify that ARC enabled state has been updated.
108 virtual void OnOptInEnabled(bool enabled) {} 109 virtual void OnOptInEnabled(bool enabled) {}
109 110
110 // Called to notify that ARC has been initialized successfully. 111 // Called to notify that ARC has been initialized successfully.
111 virtual void OnInitialStart() {} 112 virtual void OnInitialStart() {}
113
114 // Called to notify that Android data has been removed. Used in
115 // browser_tests
116 virtual void OnArcDataRemoved() {}
112 }; 117 };
113 118
114 explicit ArcSessionManager(ArcBridgeService* bridge_service); 119 explicit ArcSessionManager(ArcBridgeService* bridge_service);
115 ~ArcSessionManager() override; 120 ~ArcSessionManager() override;
116 121
117 static ArcSessionManager* Get(); 122 static ArcSessionManager* Get();
118 123
119 // It is called from chrome/browser/prefs/browser_prefs.cc. 124 // It is called from chrome/browser/prefs/browser_prefs.cc.
120 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); 125 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
121 126
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 void SetState(State state); 214 void SetState(State state);
210 void ShutdownBridge(); 215 void ShutdownBridge();
211 void OnOptInPreferenceChanged(); 216 void OnOptInPreferenceChanged();
212 void OnAndroidManagementPassed(); 217 void OnAndroidManagementPassed();
213 void OnArcDataRemoved(bool success); 218 void OnArcDataRemoved(bool success);
214 void OnArcSignInTimeout(); 219 void OnArcSignInTimeout();
215 void FetchAuthCode(); 220 void FetchAuthCode();
216 void PrepareContextForAuthCodeRequest(); 221 void PrepareContextForAuthCodeRequest();
217 222
218 void StartArcAndroidManagementCheck(); 223 void StartArcAndroidManagementCheck();
224 void MaybeReenableArc();
219 225
220 // Called when the Android management check is done in opt-in flow or 226 // Called when the Android management check is done in opt-in flow or
221 // re-auth flow. 227 // re-auth flow.
222 void OnAndroidManagementChecked( 228 void OnAndroidManagementChecked(
223 policy::AndroidManagementClient::Result result); 229 policy::AndroidManagementClient::Result result);
224 230
225 // Called when the background Android management check is done. It is 231 // Called when the background Android management check is done. It is
226 // triggered when the second or later ARC boot timing. 232 // triggered when the second or later ARC boot timing.
227 void OnBackgroundAndroidManagementChecked( 233 void OnBackgroundAndroidManagementChecked(
228 policy::AndroidManagementClient::Result result); 234 policy::AndroidManagementClient::Result result);
229 235
230 // Unowned pointer. Keeps current profile. 236 // Unowned pointer. Keeps current profile.
231 Profile* profile_ = nullptr; 237 Profile* profile_ = nullptr;
232 238
233 // Registrar used to monitor ARC enabled state. 239 // Registrar used to monitor ARC enabled state.
234 PrefChangeRegistrar pref_change_registrar_; 240 PrefChangeRegistrar pref_change_registrar_;
235 241
236 State state_ = State::NOT_INITIALIZED; 242 State state_ = State::NOT_INITIALIZED;
237 base::ObserverList<Observer> observer_list_; 243 base::ObserverList<Observer> observer_list_;
238 std::unique_ptr<ArcAppLauncher> playstore_launcher_; 244 std::unique_ptr<ArcAppLauncher> playstore_launcher_;
239 bool clear_required_ = false;
240 bool reenable_arc_ = false; 245 bool reenable_arc_ = false;
241 base::OneShotTimer arc_sign_in_timer_; 246 base::OneShotTimer arc_sign_in_timer_;
242 247
243 std::unique_ptr<ArcSupportHost> support_host_; 248 std::unique_ptr<ArcSupportHost> support_host_;
244 249
245 std::unique_ptr<ArcTermsOfServiceNegotiator> terms_of_service_negotiator_; 250 std::unique_ptr<ArcTermsOfServiceNegotiator> terms_of_service_negotiator_;
246 251
247 std::unique_ptr<ArcAuthContext> context_; 252 std::unique_ptr<ArcAuthContext> context_;
248 std::unique_ptr<ArcAndroidManagementChecker> android_management_checker_; 253 std::unique_ptr<ArcAndroidManagementChecker> android_management_checker_;
249 254
250 base::Time sign_in_time_; 255 base::Time sign_in_time_;
251 256
252 base::WeakPtrFactory<ArcSessionManager> weak_ptr_factory_; 257 base::WeakPtrFactory<ArcSessionManager> weak_ptr_factory_;
253 258
254 DISALLOW_COPY_AND_ASSIGN(ArcSessionManager); 259 DISALLOW_COPY_AND_ASSIGN(ArcSessionManager);
255 }; 260 };
256 261
257 // Outputs the stringified |state| to |os|. This is only for logging purposes. 262 // Outputs the stringified |state| to |os|. This is only for logging purposes.
258 std::ostream& operator<<(std::ostream& os, 263 std::ostream& operator<<(std::ostream& os,
259 const ArcSessionManager::State& state); 264 const ArcSessionManager::State& state);
260 265
261 } // namespace arc 266 } // namespace arc
262 267
263 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_SESSION_MANAGER_H_ 268 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_SESSION_MANAGER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/arc/arc_session_manager.cc » ('j') | chrome/browser/chromeos/arc/arc_session_manager.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698