| 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 | |
| 193 // Returns current page that has to be shown in OptIn UI. | 184 // Returns current page that has to be shown in OptIn UI. |
| 194 UIPage ui_page() const { return ui_page_; } | 185 UIPage ui_page() const { return ui_page_; } |
| 195 | 186 |
| 196 // Returns current page status, relevant to the specific page. | 187 // Returns current page status, relevant to the specific page. |
| 197 const base::string16& ui_page_status() { return ui_page_status_; } | 188 const base::string16& ui_page_status() { return ui_page_status_; } |
| 198 | 189 |
| 199 private: | 190 private: |
| 200 void StartArc(); | 191 void StartArc(); |
| 201 void ShowUI(UIPage page, const base::string16& status); | 192 void ShowUI(UIPage page, const base::string16& status); |
| 202 void CloseUI(); | 193 void CloseUI(); |
| 203 void SetUIPage(UIPage page, const base::string16& status); | 194 void SetUIPage(UIPage page, const base::string16& status); |
| 204 void SetState(State state); | 195 void SetState(State state); |
| 205 void ShutdownBridge(); | 196 void ShutdownBridge(); |
| 206 void ShutdownBridgeAndCloseUI(); | 197 void ShutdownBridgeAndCloseUI(); |
| 207 void ShutdownBridgeAndShowUI(UIPage page, const base::string16& status); | 198 void ShutdownBridgeAndShowUI(UIPage page, const base::string16& status); |
| 208 void OnOptInPreferenceChanged(); | 199 void OnOptInPreferenceChanged(); |
| 209 void StartUI(); | 200 void StartUI(); |
| 210 void StartAndroidManagementClient(); | 201 void StartAndroidManagementClient(); |
| 211 void CheckAndroidManagement(bool background_mode); | 202 void CheckAndroidManagement(bool background_mode); |
| 212 void StartArcIfSignedIn(); | 203 void StartArcIfSignedIn(); |
| 213 void OnArcDataRemoved(bool success); | |
| 214 | 204 |
| 215 // Unowned pointer. Keeps current profile. | 205 // Unowned pointer. Keeps current profile. |
| 216 Profile* profile_ = nullptr; | 206 Profile* profile_ = nullptr; |
| 217 | 207 |
| 218 // Registrar used to monitor ARC enabled state. | 208 // Registrar used to monitor ARC enabled state. |
| 219 PrefChangeRegistrar pref_change_registrar_; | 209 PrefChangeRegistrar pref_change_registrar_; |
| 220 | 210 |
| 221 mojo::Binding<AuthHost> binding_; | 211 mojo::Binding<AuthHost> binding_; |
| 222 State state_ = State::NOT_INITIALIZED; | 212 State state_ = State::NOT_INITIALIZED; |
| 223 base::ObserverList<Observer> observer_list_; | 213 base::ObserverList<Observer> observer_list_; |
| 224 std::unique_ptr<ArcAppLauncher> playstore_launcher_; | 214 std::unique_ptr<ArcAppLauncher> playstore_launcher_; |
| 225 std::string auth_code_; | 215 std::string auth_code_; |
| 226 GetAuthCodeCallback auth_callback_; | 216 GetAuthCodeCallback auth_callback_; |
| 227 bool initial_opt_in_ = false; | 217 bool initial_opt_in_ = false; |
| 228 bool disable_arc_from_ui_ = false; | 218 bool disable_arc_from_ui_ = false; |
| 229 UIPage ui_page_ = UIPage::NO_PAGE; | 219 UIPage ui_page_ = UIPage::NO_PAGE; |
| 230 base::string16 ui_page_status_; | 220 base::string16 ui_page_status_; |
| 231 bool clear_required_ = false; | 221 bool clear_required_ = false; |
| 232 bool reenable_arc_ = false; | |
| 233 bool waiting_for_reply_ = false; | 222 bool waiting_for_reply_ = false; |
| 234 | 223 |
| 235 std::unique_ptr<ArcAuthContext> context_; | 224 std::unique_ptr<ArcAuthContext> context_; |
| 236 std::unique_ptr<ArcAndroidManagementChecker> android_management_checker_; | 225 std::unique_ptr<ArcAndroidManagementChecker> android_management_checker_; |
| 237 | 226 |
| 238 base::Time sign_in_time_; | 227 base::Time sign_in_time_; |
| 239 | 228 |
| 240 base::WeakPtrFactory<ArcAuthService> weak_ptr_factory_; | 229 base::WeakPtrFactory<ArcAuthService> weak_ptr_factory_; |
| 241 | 230 |
| 242 DISALLOW_COPY_AND_ASSIGN(ArcAuthService); | 231 DISALLOW_COPY_AND_ASSIGN(ArcAuthService); |
| 243 }; | 232 }; |
| 244 | 233 |
| 245 std::ostream& operator<<(std::ostream& os, const ArcAuthService::State& state); | 234 std::ostream& operator<<(std::ostream& os, const ArcAuthService::State& state); |
| 246 | 235 |
| 247 } // namespace arc | 236 } // namespace arc |
| 248 | 237 |
| 249 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_AUTH_SERVICE_H_ | 238 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_AUTH_SERVICE_H_ |
| OLD | NEW |