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

Unified Diff: chrome/browser/ui/views/frame/avatar_button_bridge.h

Issue 1608843002: Start untangling the avatar switcher from BrowserNonClientFrameView (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@20160119-MacViewsBrowser-Compile
Patch Set: various selfnits Created 4 years, 11 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/frame/avatar_button_bridge.h
diff --git a/chrome/browser/ui/views/frame/avatar_button_bridge.h b/chrome/browser/ui/views/frame/avatar_button_bridge.h
new file mode 100644
index 0000000000000000000000000000000000000000..b2206552cfa221bb40e139942f2865ebabb24309
--- /dev/null
+++ b/chrome/browser/ui/views/frame/avatar_button_bridge.h
@@ -0,0 +1,39 @@
+// 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_VIEWS_FRAME_AVATAR_BUTTON_BRIDGE_H_
+#define CHROME_BROWSER_UI_VIEWS_FRAME_AVATAR_BUTTON_BRIDGE_H_
+
+#include "chrome/browser/ui/views/profiles/avatar_button_style.h"
+#include "ui/views/controls/button/button.h"
+
+class BrowserNonClientFrameView;
+
+// Wrapper for an avatar button displayed in a browser frame. The button
+// displays the name of the active or guest profile, and may be null.
+class AvatarButtonBridge : public views::ButtonListener {
sky 2016/01/20 17:05:36 I'm curious why you're naming this with bridge. It
tapted 2016/01/21 01:33:21 Yeah - Bridge doesn't really fit. I've gone with A
+ public:
+ explicit AvatarButtonBridge(BrowserNonClientFrameView* frame_view);
+
+ // Adds or removes the avatar button from the frame, based on the BrowserView
+ // properties.
+ void Update(AvatarButtonStyle style);
+
+ // Gets the avatar button as a view::View.
+ views::View* view() const { return view_; }
+
+ private:
+ // views::ButtonListener:
+ void ButtonPressed(views::Button* sender, const ui::Event& event) override;
+
+ BrowserNonClientFrameView* frame_view_; // Weak. Owns |this|.
+
+ // Menu button that displays the name of the active or guest profile.
+ // May be null and will not be displayed for off the record profiles.
+ views::View* view_; // Owned by views hierarchy.
+
+ DISALLOW_COPY_AND_ASSIGN(AvatarButtonBridge);
+};
+
+#endif // CHROME_BROWSER_UI_VIEWS_FRAME_AVATAR_BUTTON_BRIDGE_H_

Powered by Google App Engine
This is Rietveld 408576698