| OLD | NEW |
| 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_AUTH_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_ARC_ARC_AUTH_SERVICE_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_ARC_ARC_AUTH_SERVICE_H_ | 6 #define CHROME_BROWSER_CHROMEOS_ARC_ARC_AUTH_SERVICE_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <ostream> | 9 #include <ostream> |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "base/observer_list.h" | 14 #include "base/observer_list.h" |
| 15 #include "base/timer/timer.h" |
| 15 #include "chrome/browser/chromeos/arc/arc_android_management_checker_delegate.h" | 16 #include "chrome/browser/chromeos/arc/arc_android_management_checker_delegate.h" |
| 16 #include "chrome/browser/chromeos/arc/arc_auth_context_delegate.h" | 17 #include "chrome/browser/chromeos/arc/arc_auth_context_delegate.h" |
| 17 #include "components/arc/arc_bridge_service.h" | 18 #include "components/arc/arc_bridge_service.h" |
| 18 #include "components/arc/arc_service.h" | 19 #include "components/arc/arc_service.h" |
| 19 #include "components/arc/common/auth.mojom.h" | 20 #include "components/arc/common/auth.mojom.h" |
| 20 #include "components/arc/instance_holder.h" | 21 #include "components/arc/instance_holder.h" |
| 21 #include "components/prefs/pref_change_registrar.h" | 22 #include "components/prefs/pref_change_registrar.h" |
| 22 #include "components/syncable_prefs/pref_service_syncable_observer.h" | 23 #include "components/syncable_prefs/pref_service_syncable_observer.h" |
| 23 #include "components/syncable_prefs/synced_pref_observer.h" | 24 #include "components/syncable_prefs/synced_pref_observer.h" |
| 24 #include "mojo/public/cpp/bindings/binding.h" | 25 #include "mojo/public/cpp/bindings/binding.h" |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 void SetState(State state); | 206 void SetState(State state); |
| 206 void ShutdownBridge(); | 207 void ShutdownBridge(); |
| 207 void ShutdownBridgeAndCloseUI(); | 208 void ShutdownBridgeAndCloseUI(); |
| 208 void ShutdownBridgeAndShowUI(UIPage page, const base::string16& status); | 209 void ShutdownBridgeAndShowUI(UIPage page, const base::string16& status); |
| 209 void OnOptInPreferenceChanged(); | 210 void OnOptInPreferenceChanged(); |
| 210 void StartUI(); | 211 void StartUI(); |
| 211 void StartAndroidManagementClient(); | 212 void StartAndroidManagementClient(); |
| 212 void CheckAndroidManagement(bool background_mode); | 213 void CheckAndroidManagement(bool background_mode); |
| 213 void StartArcIfSignedIn(); | 214 void StartArcIfSignedIn(); |
| 214 void OnArcDataRemoved(bool success); | 215 void OnArcDataRemoved(bool success); |
| 216 void OnArcSignInTimeout(); |
| 215 | 217 |
| 216 // Unowned pointer. Keeps current profile. | 218 // Unowned pointer. Keeps current profile. |
| 217 Profile* profile_ = nullptr; | 219 Profile* profile_ = nullptr; |
| 218 | 220 |
| 219 // Registrar used to monitor ARC enabled state. | 221 // Registrar used to monitor ARC enabled state. |
| 220 PrefChangeRegistrar pref_change_registrar_; | 222 PrefChangeRegistrar pref_change_registrar_; |
| 221 | 223 |
| 222 mojo::Binding<AuthHost> binding_; | 224 mojo::Binding<AuthHost> binding_; |
| 223 State state_ = State::NOT_INITIALIZED; | 225 State state_ = State::NOT_INITIALIZED; |
| 224 base::ObserverList<Observer> observer_list_; | 226 base::ObserverList<Observer> observer_list_; |
| 225 std::unique_ptr<ArcAppLauncher> playstore_launcher_; | 227 std::unique_ptr<ArcAppLauncher> playstore_launcher_; |
| 226 std::string auth_code_; | 228 std::string auth_code_; |
| 227 GetAuthCodeCallback auth_callback_; | 229 GetAuthCodeCallback auth_callback_; |
| 228 bool initial_opt_in_ = false; | 230 bool initial_opt_in_ = false; |
| 229 bool disable_arc_from_ui_ = false; | 231 bool disable_arc_from_ui_ = false; |
| 230 UIPage ui_page_ = UIPage::NO_PAGE; | 232 UIPage ui_page_ = UIPage::NO_PAGE; |
| 231 base::string16 ui_page_status_; | 233 base::string16 ui_page_status_; |
| 232 bool clear_required_ = false; | 234 bool clear_required_ = false; |
| 233 bool reenable_arc_ = false; | 235 bool reenable_arc_ = false; |
| 234 bool waiting_for_reply_ = false; | 236 base::OneShotTimer arc_sign_in_timer_; |
| 235 | 237 |
| 236 std::unique_ptr<ArcAuthContext> context_; | 238 std::unique_ptr<ArcAuthContext> context_; |
| 237 std::unique_ptr<ArcAndroidManagementChecker> android_management_checker_; | 239 std::unique_ptr<ArcAndroidManagementChecker> android_management_checker_; |
| 238 | 240 |
| 239 base::Time sign_in_time_; | 241 base::Time sign_in_time_; |
| 240 | 242 |
| 241 base::WeakPtrFactory<ArcAuthService> weak_ptr_factory_; | 243 base::WeakPtrFactory<ArcAuthService> weak_ptr_factory_; |
| 242 | 244 |
| 243 DISALLOW_COPY_AND_ASSIGN(ArcAuthService); | 245 DISALLOW_COPY_AND_ASSIGN(ArcAuthService); |
| 244 }; | 246 }; |
| 245 | 247 |
| 246 std::ostream& operator<<(std::ostream& os, const ArcAuthService::State& state); | 248 std::ostream& operator<<(std::ostream& os, const ArcAuthService::State& state); |
| 247 | 249 |
| 248 } // namespace arc | 250 } // namespace arc |
| 249 | 251 |
| 250 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_AUTH_SERVICE_H_ | 252 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_AUTH_SERVICE_H_ |
| OLD | NEW |