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

Side by Side Diff: chrome/browser/ui/views/profiles/new_avatar_button.h

Issue 2832223003: Update profile switcher button on Linux. (Closed)
Patch Set: self review Created 3 years, 7 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_PROFILES_NEW_AVATAR_BUTTON_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_PROFILES_NEW_AVATAR_BUTTON_H_
6 #define CHROME_BROWSER_UI_VIEWS_PROFILES_NEW_AVATAR_BUTTON_H_ 6 #define CHROME_BROWSER_UI_VIEWS_PROFILES_NEW_AVATAR_BUTTON_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "chrome/browser/profiles/profile_attributes_storage.h" 9 #include "chrome/browser/profiles/profile_attributes_storage.h"
10 #include "chrome/browser/ui/avatar_button_error_controller.h" 10 #include "chrome/browser/ui/avatar_button_error_controller.h"
11 #include "chrome/browser/ui/avatar_button_error_controller_delegate.h" 11 #include "chrome/browser/ui/avatar_button_error_controller_delegate.h"
12 #include "chrome/browser/ui/views/profiles/avatar_button_style.h" 12 #include "chrome/browser/ui/views/profiles/avatar_button_style.h"
13 #include "ui/views/controls/button/label_button.h" 13 #include "ui/views/controls/button/label_button.h"
14 #include "ui/views/widget/widget_observer.h"
14 15
15 class AvatarButtonDelegate; 16 class AvatarButtonDelegate;
16 class Profile; 17 class Profile;
17 18
18 // Avatar button that displays the active profile's name in the caption area. 19 // Avatar button that displays the active profile's name in the caption area.
19 class NewAvatarButton : public views::LabelButton, 20 class NewAvatarButton : public views::LabelButton,
20 public AvatarButtonErrorControllerDelegate, 21 public AvatarButtonErrorControllerDelegate,
21 public ProfileAttributesStorage::Observer { 22 public ProfileAttributesStorage::Observer,
23 public views::WidgetObserver {
22 public: 24 public:
23 NewAvatarButton(AvatarButtonDelegate* delegate, 25 NewAvatarButton(AvatarButtonDelegate* delegate,
24 AvatarButtonStyle button_style, 26 AvatarButtonStyle button_style,
25 Profile* profile); 27 Profile* profile);
26 ~NewAvatarButton() override; 28 ~NewAvatarButton() override;
27 29
28 // Views::LabelButton 30 // views::LabelButton
29 bool OnMousePressed(const ui::MouseEvent& event) override; 31 bool OnMousePressed(const ui::MouseEvent& event) override;
30 void OnMouseReleased(const ui::MouseEvent& event) override; 32 void OnMouseReleased(const ui::MouseEvent& event) override;
31
32 // Views
33 void OnGestureEvent(ui::GestureEvent* event) override; 33 void OnGestureEvent(ui::GestureEvent* event) override;
34 SkColor GetInkDropBaseColor() const override;
35 std::unique_ptr<views::InkDropMask> CreateInkDropMask() const override;
36 void NotifyClick(const ui::Event& event) override;
34 37
35 private: 38 private:
36 friend class ProfileChooserViewExtensionsTest; 39 friend class ProfileChooserViewExtensionsTest;
37 40
38 // AvatarButtonErrorControllerDelegate: 41 // AvatarButtonErrorControllerDelegate:
39 void OnAvatarErrorChanged() override; 42 void OnAvatarErrorChanged() override;
40 43
41 // ProfileAttributesStorage::Observer: 44 // ProfileAttributesStorage::Observer:
42 void OnProfileAdded(const base::FilePath& profile_path) override; 45 void OnProfileAdded(const base::FilePath& profile_path) override;
43 void OnProfileWasRemoved(const base::FilePath& profile_path, 46 void OnProfileWasRemoved(const base::FilePath& profile_path,
44 const base::string16& profile_name) override; 47 const base::string16& profile_name) override;
45 void OnProfileNameChanged(const base::FilePath& profile_path, 48 void OnProfileNameChanged(const base::FilePath& profile_path,
46 const base::string16& old_profile_name) override; 49 const base::string16& old_profile_name) override;
47 void OnProfileSupervisedUserIdChanged( 50 void OnProfileSupervisedUserIdChanged(
48 const base::FilePath& profile_path) override; 51 const base::FilePath& profile_path) override;
49 52
53 // views::WidgetObserver
54 void OnWidgetClosing(views::Widget* widget) override;
Peter Kasting 2017/04/27 02:13:18 Nit: Per recent chromium-dev discussion, make over
55
50 // Called when the profile info cache or signin/sync error has changed, which 56 // Called when the profile info cache or signin/sync error has changed, which
51 // means we might have to update the icon/text of the button. 57 // means we might have to update the icon/text of the button.
52 void Update(); 58 void Update();
53 59
54 AvatarButtonDelegate* delegate_; 60 AvatarButtonDelegate* delegate_;
55 AvatarButtonErrorController error_controller_; 61 AvatarButtonErrorController error_controller_;
56 Profile* profile_; 62 Profile* profile_;
57 63
58 // The icon displayed instead of the profile name in the local profile case. 64 // The icon displayed instead of the profile name in the local profile case.
59 // Different assets are used depending on the OS version. 65 // Different assets are used depending on the OS version.
60 gfx::ImageSkia generic_avatar_; 66 gfx::ImageSkia generic_avatar_;
61 67
62 // This is used to check if the bubble was showing during the mouse pressed 68 // This is used to check if the bubble was showing during the mouse pressed
63 // event. If this is true then the mouse released event is ignored to prevent 69 // event. If this is true then the mouse released event is ignored to prevent
64 // the bubble from reshowing. 70 // the bubble from reshowing.
65 bool suppress_mouse_released_action_; 71 bool suppress_mouse_released_action_;
66 72
67 DISALLOW_COPY_AND_ASSIGN(NewAvatarButton); 73 DISALLOW_COPY_AND_ASSIGN(NewAvatarButton);
68 }; 74 };
69 75
70 #endif // CHROME_BROWSER_UI_VIEWS_PROFILES_NEW_AVATAR_BUTTON_H_ 76 #endif // CHROME_BROWSER_UI_VIEWS_PROFILES_NEW_AVATAR_BUTTON_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698