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

Unified Diff: chrome/browser/ui/avatar_button_error_controller.h

Issue 2179283002: Refactored signin/sync error controllers for the avatar button (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: New refactoring Created 4 years, 5 months 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
« no previous file with comments | « chrome/browser/sync/sync_ui_util.cc ('k') | chrome/browser/ui/avatar_button_error_controller.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/avatar_button_error_controller.h
diff --git a/chrome/browser/ui/avatar_button_error_controller.h b/chrome/browser/ui/avatar_button_error_controller.h
new file mode 100644
index 0000000000000000000000000000000000000000..560abd63ebfef4b842dae4a2f74fd8fd4d3b6f0d
--- /dev/null
+++ b/chrome/browser/ui/avatar_button_error_controller.h
@@ -0,0 +1,75 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_AVATAR_BUTTON_ERROR_CONTROLLER_H_
+#define CHROME_BROWSER_UI_AVATAR_BUTTON_ERROR_CONTROLLER_H_
+
+#include "components/signin/core/browser/signin_error_controller.h"
+#include "components/sync_driver/sync_error_controller.h"
+
+class Profile;
+
+// Keeps track of the signin and sync errors that should be exposed to the user
+// in the avatar button.
+class AvatarButtonErrorController {
+ public:
+ explicit AvatarButtonErrorController(Profile* profile);
+ virtual ~AvatarButtonErrorController() {}
+
+ void UpdateSigninError(bool has_signin_error);
sky 2016/08/01 15:55:26 The two Update functions are meant for internal us
Jane 2016/08/01 19:10:32 Done.
+ void UpdateSyncError(bool has_sync_error);
+ bool HasAvatarError() { return has_signin_error_ || has_sync_error_; }
+
+ // Explicitly requests an update to the signin/sync errors.
+ void GetAvatarErrorUpdate();
+
+ private:
+ class AvatarSigninErrorController : public SigninErrorController::Observer {
sky 2016/08/01 15:55:26 Please add description. Also, this class is an inn
Jane 2016/08/01 19:10:32 Done.
+ public:
+ AvatarSigninErrorController(
+ Profile* profile,
+ AvatarButtonErrorController* avatar_button_error_controller);
+ ~AvatarSigninErrorController() override;
+
+ // SigninErrorController::Observer:
+ void OnErrorChanged() override;
+
+ private:
+ Profile* profile_;
+ AvatarButtonErrorController* avatar_button_error_controller_;
+
+ DISALLOW_COPY_AND_ASSIGN(AvatarSigninErrorController);
+ };
+
+ class AvatarSyncErrorController : public SyncErrorController::Observer {
+ public:
+ AvatarSyncErrorController(
+ Profile* profile,
+ AvatarButtonErrorController* avatar_button_error_controller);
+ ~AvatarSyncErrorController() override;
+
+ // SyncErrorController::Observer:
+ void OnErrorChanged() override;
+
+ private:
+ SyncErrorController* GetSyncErrorControllerIfNeeded();
+
+ Profile* profile_;
+ AvatarButtonErrorController* avatar_button_error_controller_;
+
+ DISALLOW_COPY_AND_ASSIGN(AvatarSyncErrorController);
+ };
+
+ virtual void OnAvatarErrorChanged() = 0;
sky 2016/08/01 15:55:26 Does this really work? OnAvatarErrorChanged is in
Jane 2016/08/01 19:10:32 Ah, I see what you mean! Thanks for the detailed e
+
+ AvatarSigninErrorController avatar_signin_error_controller_;
+ AvatarSyncErrorController avatar_sync_error_controller_;
+
+ bool has_signin_error_;
+ bool has_sync_error_;
+
+ DISALLOW_COPY_AND_ASSIGN(AvatarButtonErrorController);
+};
+
+#endif // CHROME_BROWSER_UI_AVATAR_BUTTON_ERROR_CONTROLLER_H_
« no previous file with comments | « chrome/browser/sync/sync_ui_util.cc ('k') | chrome/browser/ui/avatar_button_error_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698