| 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 39d3e8a426fc97eb88a1047121d98e32b1ab6313..8092f6090cde23dd27dc2855342210a28592af3b 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;
|
| @@ -184,6 +177,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();
|
|
|
| @@ -197,7 +203,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_; }
|
| @@ -210,13 +216,14 @@ class ArcAuthService : public ArcService,
|
|
|
| void StartArc();
|
| // TODO(hidehiko): 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();
|
| @@ -251,7 +258,7 @@ class ArcAuthService : public ArcService,
|
| base::ObserverList<Observer> observer_list_;
|
| std::unique_ptr<ArcAppLauncher> playstore_launcher_;
|
| std::string auth_code_;
|
| - 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;
|
| @@ -264,6 +271,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_;
|
|
|