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

Unified Diff: chrome/browser/ui/views/profiles/avatar_base_controller.h

Issue 1009403002: Refactor the avatar button/icon class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nits Created 5 years, 9 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
Index: chrome/browser/ui/views/profiles/avatar_base_controller.h
diff --git a/chrome/browser/ui/views/profiles/avatar_base_controller.h b/chrome/browser/ui/views/profiles/avatar_base_controller.h
new file mode 100644
index 0000000000000000000000000000000000000000..f285c34d7c0fa62bc759c29dabe27be6f16d4b2c
--- /dev/null
+++ b/chrome/browser/ui/views/profiles/avatar_base_controller.h
@@ -0,0 +1,42 @@
+// Copyright 2015 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_VIEWS_PROFILES_AVATAR_BASE_CONTROLLER_H_
+#define CHROME_BROWSER_UI_VIEWS_PROFILES_AVATAR_BASE_CONTROLLER_H_
noms (inactive) 2015/03/26 15:26:56 nit: I think Mac UI files are "controllers" but no
yao 2015/03/26 18:45:01 Changed to avatar_base_button.
noms (inactive) 2015/03/30 14:54:54 Will you do the other renames in a separate CL?
yao 2015/03/30 15:02:16 This file has been reverted/deleted. I though I
noms (inactive) 2015/03/30 15:04:00 I had suggested renaming new_avatar_button to avat
yao 2015/03/30 23:12:12 Ic, I misunderstood your initial comments, but now
noms (inactive) 2015/03/31 20:47:06 Sounds good!
+
+#include "chrome/browser/profiles/profile_info_cache_observer.h"
+
+class Browser;
+
+// This view controller manages the button that sits in the top of the window
noms (inactive) 2015/03/26 15:26:56 nit: . at the end of the comment
noms (inactive) 2015/03/26 15:26:56 nit: This view (no controller)
yao 2015/03/26 18:45:01 Done.
yao 2015/03/26 18:45:01 Done.
+// frame and displays the active profile's info when using multi-profiles
+class AvatarBaseController : public ProfileInfoCacheObserver {
+ public:
+ explicit AvatarBaseController(Browser* browser);
+ ~AvatarBaseController() override;
+
+ protected:
+ Browser* browser() const {return browser_;}
+
+ private:
+ // ProfileInfoCacheObserver:
+ void OnProfileAdded(const base::FilePath& profile_path) override;
+ void OnProfileWasRemoved(const base::FilePath& profile_path,
+ const base::string16& profile_name) override;
+ void OnProfileNameChanged(const base::FilePath& profile_path,
+ const base::string16& old_profile_name) override;
+ void OnProfileAvatarChanged(const base::FilePath& profile_path) override;
+ void OnProfileSupervisedUserIdChanged(
+ const base::FilePath& profile_path) override;
+
+ // Called when the profile info cache has changed, which means we might
+ // have to update the icon/text of the button.
+ virtual void Update();
+
+ Browser* browser_;
+
+ DISALLOW_COPY_AND_ASSIGN(AvatarBaseController);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_PROFILES_AVATAR_BASE_CONTROLLER_H_

Powered by Google App Engine
This is Rietveld 408576698