Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(749)

Unified Diff: chrome/browser/chromeos/arc/arc_auth_service.h

Issue 2472223002: WIP (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..0e93212957df6ecb1c310312c5d9b6471b307999 100644
--- a/chrome/browser/chromeos/arc/arc_auth_service.h
+++ b/chrome/browser/chromeos/arc/arc_auth_service.h
@@ -13,8 +13,10 @@
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
#include "base/timer/timer.h"
+#include "chrome/browser/chromeos/arc/arc_support_host.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/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,10 +38,9 @@ namespace user_prefs {
class PrefRegistrySyncable;
}
-class ArcSupportHost;
-
namespace arc {
+class ArcOptInPreferenceHandler;
class ArcAndroidManagementChecker;
class ArcAuthCodeFetcher;
class ArcAuthContext;
@@ -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;
+ // ArcOptInPreferenceHandlerObserver:
+ void OnMetricsModeChanged(bool enabled, bool managed) override;
+ void OnBackupAndRestoreModeChanged(bool enabled, bool managed) override;
+ void OnLocationServicesModeChanged(bool enabled, bool managed) 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;
+
// Stops ARC without changing ArcEnabled preference.
void StopArc();
@@ -191,24 +197,14 @@ class ArcAuthService : public ArcService,
// on ARC is stopped.
void RemoveArcData();
- // Returns current page that has to be shown in OptIn UI.
- 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_; }
-
ArcSupportHost* support_host() { return support_host_.get(); }
private:
void StartArc();
// TODO: move UI methods/fields to ArcSupportHost.
- void ShowUI(UIPage page, const base::string16& status);
void CloseUI();
- void SetUIPage(UIPage page, const base::string16& status);
void SetState(State state);
void ShutdownBridge();
- void ShutdownBridgeAndCloseUI();
- void ShutdownBridgeAndShowUI(UIPage page, const base::string16& status);
void OnOptInPreferenceChanged();
void StartUI();
void StartAndroidManagementClient();
@@ -243,8 +239,6 @@ class ArcAuthService : public ArcService,
GetAuthCodeCallback auth_callback_;
GetAuthCodeAndAccountTypeCallback auth_account_callback_;
bool initial_opt_in_ = false;
- UIPage ui_page_ = UIPage::NO_PAGE;
- base::string16 ui_page_status_;
bool clear_required_ = false;
bool reenable_arc_ = false;
base::OneShotTimer arc_sign_in_timer_;
@@ -254,6 +248,9 @@ class ArcAuthService : public ArcService,
// 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_;
std::unique_ptr<ArcAndroidManagementChecker> android_management_checker_;

Powered by Google App Engine
This is Rietveld 408576698