| Index: chrome/browser/chromeos/arc/arc_auth_service.h
|
| diff --git a/chrome/browser/chromeos/arc/arc_auth_service.h b/chrome/browser/chromeos/arc/arc_auth_service.h
|
| index 28074f8f4e43e2267b1dffb755317129d0700c63..5e927de137f6d080a4a71ae596d553ed7a6da7bb 100644
|
| --- a/chrome/browser/chromeos/arc/arc_auth_service.h
|
| +++ b/chrome/browser/chromeos/arc/arc_auth_service.h
|
| @@ -15,6 +15,8 @@
|
| #include "base/timer/timer.h"
|
| #include "chrome/browser/chromeos/arc/arc_auth_code_fetcher_delegate.h"
|
| #include "chrome/browser/chromeos/arc/arc_auth_context_delegate.h"
|
| +#include "chrome/browser/chromeos/arc/arc_support_host.h"
|
| +#include "chrome/browser/chromeos/arc/optin/arc_optin_preference_handler_observer.h"
|
| #include "chrome/browser/chromeos/policy/android_management_client.h"
|
| #include "components/arc/arc_bridge_service.h"
|
| #include "components/arc/arc_service.h"
|
| @@ -36,13 +38,12 @@ namespace user_prefs {
|
| class PrefRegistrySyncable;
|
| }
|
|
|
| -class ArcSupportHost;
|
| -
|
| namespace arc {
|
|
|
| class ArcAndroidManagementChecker;
|
| class ArcAuthCodeFetcher;
|
| class ArcAuthContext;
|
| +class ArcOptInPreferenceHandler;
|
| enum class ProvisioningResult : int;
|
|
|
| // This class proxies the request from the client to fetch an auth code from
|
| @@ -51,6 +52,8 @@ class ArcAuthService : public ArcService,
|
| public mojom::AuthHost,
|
| public ArcBridgeService::Observer,
|
| public InstanceHolder<mojom::AuthInstance>::Observer,
|
| + public ArcSupportHost::Observer,
|
| + public ArcOptInPreferenceHandlerObserver,
|
| public ArcAuthContextDelegate,
|
| public ArcAuthCodeFetcherDelegate,
|
| public sync_preferences::PrefServiceSyncableObserver,
|
| @@ -63,16 +66,6 @@ class ArcAuthService : public ArcService,
|
| ACTIVE, // ARC is running.
|
| };
|
|
|
| - enum class UIPage {
|
| - NO_PAGE, // Hide everything.
|
| - TERMS, // Terms content page.
|
| - LSO_PROGRESS, // LSO loading progress page.
|
| - LSO, // LSO page to enter user's credentials.
|
| - START_PROGRESS, // Arc starting progress page.
|
| - ERROR, // Arc start error page.
|
| - ERROR_WITH_FEEDBACK, // Arc start error page, plus feedback button.
|
| - };
|
| -
|
| class Observer {
|
| public:
|
| virtual ~Observer() = default;
|
| @@ -179,6 +172,19 @@ class ArcAuthService : public ArcService,
|
| void OnAuthCodeSuccess(const std::string& auth_code) override;
|
| void OnAuthCodeFailed() override;
|
|
|
| + // ArcSupportHost::Observer:
|
| + void OnWindowClosed() override;
|
| + void OnTermsAgreed(bool is_metrics_enabled,
|
| + bool is_backup_and_restore_enabled,
|
| + bool is_location_service_enabled) override;
|
| + void OnAuthSucceeded(const std::string& auth_code) override;
|
| + void OnSendFeedbackClicked() override;
|
| +
|
| + // arc::ArcOptInPreferenceHandlerObserver:
|
| + void OnMetricsModeChanged(bool enabled, bool managed) override;
|
| + void OnBackupAndRestoreModeChanged(bool enabled, bool managed) override;
|
| + void OnLocationServicesModeChanged(bool enabled, bool managed) override;
|
| +
|
| // Stops ARC without changing ArcEnabled preference.
|
| void StopArc();
|
|
|
| @@ -192,7 +198,7 @@ class ArcAuthService : public ArcService,
|
| void RemoveArcData();
|
|
|
| // Returns current page that has to be shown in OptIn UI.
|
| - UIPage ui_page() const { return ui_page_; }
|
| + ArcSupportHost::UIPage ui_page() const { return ui_page_; }
|
|
|
| // Returns current page status, relevant to the specific page.
|
| const base::string16& ui_page_status() const { return ui_page_status_; }
|
| @@ -202,13 +208,14 @@ class ArcAuthService : public ArcService,
|
| private:
|
| void StartArc();
|
| // TODO: move UI methods/fields to ArcSupportHost.
|
| - void ShowUI(UIPage page, const base::string16& status);
|
| + void ShowUI(ArcSupportHost::UIPage page, const base::string16& status);
|
| void CloseUI();
|
| - void SetUIPage(UIPage page, const base::string16& status);
|
| + void SetUIPage(ArcSupportHost::UIPage page, const base::string16& status);
|
| void SetState(State state);
|
| void ShutdownBridge();
|
| void ShutdownBridgeAndCloseUI();
|
| - void ShutdownBridgeAndShowUI(UIPage page, const base::string16& status);
|
| + void ShutdownBridgeAndShowUI(ArcSupportHost::UIPage page,
|
| + const base::string16& status);
|
| void OnOptInPreferenceChanged();
|
| void StartUI();
|
| void StartAndroidManagementClient();
|
| @@ -243,7 +250,7 @@ class ArcAuthService : public ArcService,
|
| GetAuthCodeCallback auth_callback_;
|
| GetAuthCodeAndAccountTypeCallback auth_account_callback_;
|
| bool initial_opt_in_ = false;
|
| - UIPage ui_page_ = UIPage::NO_PAGE;
|
| + ArcSupportHost::UIPage ui_page_ = ArcSupportHost::UIPage::NO_PAGE;
|
| base::string16 ui_page_status_;
|
| bool clear_required_ = false;
|
| bool reenable_arc_ = false;
|
| @@ -253,6 +260,8 @@ class ArcAuthService : public ArcService,
|
| // This should be moved to ArcSessionManager when the refactoring is
|
| // done.
|
| std::unique_ptr<ArcSupportHost> support_host_;
|
| + // Handles preferences and metrics mode.
|
| + std::unique_ptr<arc::ArcOptInPreferenceHandler> preference_handler_;
|
|
|
| std::unique_ptr<ArcAuthContext> context_;
|
| std::unique_ptr<ArcAuthCodeFetcher> auth_code_fetcher_;
|
|
|