| 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> |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 void OnContextReady() override; | 175 void OnContextReady() override; |
| 176 void OnPrepareContextFailed() override; | 176 void OnPrepareContextFailed() override; |
| 177 | 177 |
| 178 // ArcAndroidManagementCheckerDelegate: | 178 // ArcAndroidManagementCheckerDelegate: |
| 179 void OnAndroidManagementChecked( | 179 void OnAndroidManagementChecked( |
| 180 policy::AndroidManagementClient::Result result) override; | 180 policy::AndroidManagementClient::Result result) override; |
| 181 | 181 |
| 182 // Stops ARC without changing ArcEnabled preference. | 182 // Stops ARC without changing ArcEnabled preference. |
| 183 void StopArc(); | 183 void StopArc(); |
| 184 | 184 |
| 185 // StopArc(), then EnableArc(). Between them data clear may happens. |
| 186 // This is a special method to support enterprise device lost case. |
| 187 // This can be called only when ARC is running. |
| 188 void StopAndEnableArc(); |
| 189 |
| 190 // Removes the data if ARC is stopped. Otherwise, queue to remove the data |
| 191 // on ARC is stopped. |
| 192 void RemoveArcData(); |
| 193 |
| 185 // Returns current page that has to be shown in OptIn UI. | 194 // Returns current page that has to be shown in OptIn UI. |
| 186 UIPage ui_page() const { return ui_page_; } | 195 UIPage ui_page() const { return ui_page_; } |
| 187 | 196 |
| 188 // Returns current page status, relevant to the specific page. | 197 // Returns current page status, relevant to the specific page. |
| 189 const base::string16& ui_page_status() { return ui_page_status_; } | 198 const base::string16& ui_page_status() { return ui_page_status_; } |
| 190 | 199 |
| 191 private: | 200 private: |
| 192 void StartArc(); | 201 void StartArc(); |
| 193 void ShowUI(UIPage page, const base::string16& status); | 202 void ShowUI(UIPage page, const base::string16& status); |
| 194 void CloseUI(); | 203 void CloseUI(); |
| 195 void SetUIPage(UIPage page, const base::string16& status); | 204 void SetUIPage(UIPage page, const base::string16& status); |
| 196 void SetState(State state); | 205 void SetState(State state); |
| 197 void ShutdownBridge(); | 206 void ShutdownBridge(); |
| 198 void ShutdownBridgeAndCloseUI(); | 207 void ShutdownBridgeAndCloseUI(); |
| 199 void ShutdownBridgeAndShowUI(UIPage page, const base::string16& status); | 208 void ShutdownBridgeAndShowUI(UIPage page, const base::string16& status); |
| 200 void OnOptInPreferenceChanged(); | 209 void OnOptInPreferenceChanged(); |
| 201 void StartUI(); | 210 void StartUI(); |
| 202 void StartAndroidManagementClient(); | 211 void StartAndroidManagementClient(); |
| 203 void CheckAndroidManagement(bool background_mode); | 212 void CheckAndroidManagement(bool background_mode); |
| 204 void StartArcIfSignedIn(); | 213 void StartArcIfSignedIn(); |
| 214 void OnArcDataRemoved(bool success); |
| 205 | 215 |
| 206 // Unowned pointer. Keeps current profile. | 216 // Unowned pointer. Keeps current profile. |
| 207 Profile* profile_ = nullptr; | 217 Profile* profile_ = nullptr; |
| 208 | 218 |
| 209 // Registrar used to monitor ARC enabled state. | 219 // Registrar used to monitor ARC enabled state. |
| 210 PrefChangeRegistrar pref_change_registrar_; | 220 PrefChangeRegistrar pref_change_registrar_; |
| 211 | 221 |
| 212 mojo::Binding<AuthHost> binding_; | 222 mojo::Binding<AuthHost> binding_; |
| 213 State state_ = State::NOT_INITIALIZED; | 223 State state_ = State::NOT_INITIALIZED; |
| 214 base::ObserverList<Observer> observer_list_; | 224 base::ObserverList<Observer> observer_list_; |
| 215 std::unique_ptr<ArcAppLauncher> playstore_launcher_; | 225 std::unique_ptr<ArcAppLauncher> playstore_launcher_; |
| 216 std::string auth_code_; | 226 std::string auth_code_; |
| 217 GetAuthCodeCallback auth_callback_; | 227 GetAuthCodeCallback auth_callback_; |
| 218 bool initial_opt_in_ = false; | 228 bool initial_opt_in_ = false; |
| 219 bool disable_arc_from_ui_ = false; | 229 bool disable_arc_from_ui_ = false; |
| 220 UIPage ui_page_ = UIPage::NO_PAGE; | 230 UIPage ui_page_ = UIPage::NO_PAGE; |
| 221 base::string16 ui_page_status_; | 231 base::string16 ui_page_status_; |
| 222 bool clear_required_ = false; | 232 bool clear_required_ = false; |
| 233 bool reenable_arc_ = false; |
| 223 bool waiting_for_reply_ = false; | 234 bool waiting_for_reply_ = false; |
| 224 | 235 |
| 225 std::unique_ptr<ArcAuthContext> context_; | 236 std::unique_ptr<ArcAuthContext> context_; |
| 226 std::unique_ptr<ArcAndroidManagementChecker> android_management_checker_; | 237 std::unique_ptr<ArcAndroidManagementChecker> android_management_checker_; |
| 227 | 238 |
| 228 base::Time sign_in_time_; | 239 base::Time sign_in_time_; |
| 229 | 240 |
| 230 base::WeakPtrFactory<ArcAuthService> weak_ptr_factory_; | 241 base::WeakPtrFactory<ArcAuthService> weak_ptr_factory_; |
| 231 | 242 |
| 232 DISALLOW_COPY_AND_ASSIGN(ArcAuthService); | 243 DISALLOW_COPY_AND_ASSIGN(ArcAuthService); |
| 233 }; | 244 }; |
| 234 | 245 |
| 235 std::ostream& operator<<(std::ostream& os, const ArcAuthService::State& state); | 246 std::ostream& operator<<(std::ostream& os, const ArcAuthService::State& state); |
| 236 | 247 |
| 237 } // namespace arc | 248 } // namespace arc |
| 238 | 249 |
| 239 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_AUTH_SERVICE_H_ | 250 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_AUTH_SERVICE_H_ |
| OLD | NEW |