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