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

Side by Side Diff: chrome/browser/ui/views/frame/avatar_button_manager.h

Issue 2832823002: Update avatar button to MD (Closed)
Patch Set: Rebased on CL 2833363002 Created 3 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_UI_VIEWS_FRAME_AVATAR_BUTTON_MANAGER_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_FRAME_AVATAR_BUTTON_MANAGER_H_
6 #define CHROME_BROWSER_UI_VIEWS_FRAME_AVATAR_BUTTON_MANAGER_H_ 6 #define CHROME_BROWSER_UI_VIEWS_FRAME_AVATAR_BUTTON_MANAGER_H_
7 7
8 #include "chrome/browser/ui/views/profiles/avatar_button_delegate.h" 8 #include "chrome/browser/ui/views/profiles/avatar_button_delegate.h"
9 #include "chrome/browser/ui/views/profiles/avatar_button_style.h" 9 #include "chrome/browser/ui/views/profiles/avatar_button_style.h"
Peter Kasting 2017/04/26 02:09:53 Nit: Seems like you could forward-declare AvatarBu
10 #include "chrome/browser/ui/views/profiles/new_avatar_button.h"
11 #include "ui/views/controls/button/menu_button.h"
Peter Kasting 2017/04/26 02:09:53 Nit: Seems like you shouldn't need this (we should
emx 2017/04/27 16:30:58 Done.
10 12
11 class BrowserNonClientFrameView; 13 class BrowserNonClientFrameView;
12 14
13 // Manages an avatar button displayed in a browser frame. The button displays 15 // Manages an avatar button displayed in a browser frame. The button displays
14 // the name of the active or guest profile, and may be null. 16 // the name of the active or guest profile, and may be null.
15 class AvatarButtonManager : public AvatarButtonDelegate { 17 class AvatarButtonManager : public AvatarButtonDelegate {
16 public: 18 public:
17 explicit AvatarButtonManager(BrowserNonClientFrameView* frame_view); 19 explicit AvatarButtonManager(BrowserNonClientFrameView* frame_view);
18 20
19 // Adds or removes the avatar button from the frame, based on the BrowserView 21 // Adds or removes the avatar button from the frame, based on the BrowserView
20 // properties. 22 // properties.
21 void Update(AvatarButtonStyle style); 23 void Update(AvatarButtonStyle style);
22 24
23 // Gets the avatar button as a view::View. 25 AvatarButton* button() const { return button_; }
Peter Kasting 2017/04/26 02:09:53 Const methods should not return non-const pointers
24 views::View* view() const { return view_; }
25 26
26 private:
27 // AvatarButtonDelegate: 27 // AvatarButtonDelegate:
28 void ButtonPreferredSizeChanged() override; 28 void ButtonPreferredSizeChanged() override;
29 29
30 // views::ButtonListener: 30 private:
31 void ButtonPressed(views::Button* sender, const ui::Event& event) override; 31 // views::MenuButtonListener:
Peter Kasting 2017/04/26 02:09:53 Nit: You don't directly inherit from AvatarButtonD
emx 2017/04/27 16:30:58 Done.
32 void OnMenuButtonClicked(views::MenuButton* source,
33 const gfx::Point& point,
34 const ui::Event* event) override;
32 35
33 BrowserNonClientFrameView* frame_view_; // Weak. Owns |this|. 36 BrowserNonClientFrameView* frame_view_; // Weak. Owns |this|.
34 37
35 // Menu button that displays the name of the active or guest profile. 38 // Menu button that displays the name of the active or guest profile.
36 // May be null and will not be displayed for off the record profiles. 39 // May be null and will not be displayed for off the record profiles.
37 views::View* view_; // Owned by views hierarchy. 40 AvatarButton* button_; // Owned by views hierarchy.
38 41
39 DISALLOW_COPY_AND_ASSIGN(AvatarButtonManager); 42 DISALLOW_COPY_AND_ASSIGN(AvatarButtonManager);
40 }; 43 };
41 44
42 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_AVATAR_BUTTON_MANAGER_H_ 45 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_AVATAR_BUTTON_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698