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

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

Issue 2851543002: Update avatar button to MD (part 1) (Closed)
Patch Set: Fixed TODO comments 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_AVATAR_BUTTON_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_PROFILES_AVATAR_BUTTON_H_
6 #define CHROME_BROWSER_UI_VIEWS_PROFILES_AVATAR_BUTTON_H_ 6 #define CHROME_BROWSER_UI_VIEWS_PROFILES_AVATAR_BUTTON_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/scoped_observer.h"
9 #include "chrome/browser/profiles/profile_attributes_storage.h" 10 #include "chrome/browser/profiles/profile_attributes_storage.h"
10 #include "chrome/browser/ui/avatar_button_error_controller.h" 11 #include "chrome/browser/ui/avatar_button_error_controller.h"
11 #include "chrome/browser/ui/avatar_button_error_controller_delegate.h" 12 #include "chrome/browser/ui/avatar_button_error_controller_delegate.h"
12 #include "chrome/browser/ui/views/profiles/avatar_button_style.h" 13 #include "chrome/browser/ui/views/profiles/avatar_button_style.h"
13 #include "ui/views/controls/button/label_button.h" 14 #include "ui/views/controls/button/label_button.h"
14 15
15 class AvatarButtonDelegate;
16 class Profile; 16 class Profile;
17 17
18 // Avatar button that displays the active profile's name in the caption area. 18 // Base class for avatar buttons that display the active profile's name in the
19 class NewAvatarButton : public views::LabelButton, 19 // caption area.
20 public AvatarButtonErrorControllerDelegate, 20 class AvatarButton : public views::LabelButton,
21 public ProfileAttributesStorage::Observer { 21 public AvatarButtonErrorControllerDelegate,
22 public ProfileAttributesStorage::Observer {
22 public: 23 public:
23 NewAvatarButton(AvatarButtonDelegate* delegate, 24 AvatarButton(views::ButtonListener* listener,
24 AvatarButtonStyle button_style, 25 AvatarButtonStyle button_style,
25 Profile* profile); 26 Profile* profile);
26 ~NewAvatarButton() override; 27 ~AvatarButton() override;
27 28
28 // Views::LabelButton 29 // views::LabelButton:
29 bool OnMousePressed(const ui::MouseEvent& event) override; 30 void OnGestureEvent(ui::GestureEvent* event) override;
30 void OnMouseReleased(const ui::MouseEvent& event) override; 31 gfx::Size GetMinimumSize() const override;
32 gfx::Size GetPreferredSize() const override;
33 std::unique_ptr<views::InkDropHighlight> CreateInkDropHighlight()
34 const override;
31 35
32 // Views 36 protected:
33 void OnGestureEvent(ui::GestureEvent* event) override; 37 // views::LabelButton:
38 bool ShouldUseFloodFillInkDrop() const override;
34 39
35 private: 40 private:
36 friend class ProfileChooserViewExtensionsTest; 41 friend class ProfileChooserViewExtensionsTest;
37 42
38 // AvatarButtonErrorControllerDelegate: 43 // AvatarButtonErrorControllerDelegate:
39 void OnAvatarErrorChanged() override; 44 void OnAvatarErrorChanged() override;
40 45
41 // ProfileAttributesStorage::Observer: 46 // ProfileAttributesStorage::Observer:
42 void OnProfileAdded(const base::FilePath& profile_path) override; 47 void OnProfileAdded(const base::FilePath& profile_path) override;
43 void OnProfileWasRemoved(const base::FilePath& profile_path, 48 void OnProfileWasRemoved(const base::FilePath& profile_path,
44 const base::string16& profile_name) override; 49 const base::string16& profile_name) override;
45 void OnProfileNameChanged(const base::FilePath& profile_path, 50 void OnProfileNameChanged(const base::FilePath& profile_path,
46 const base::string16& old_profile_name) override; 51 const base::string16& old_profile_name) override;
47 void OnProfileSupervisedUserIdChanged( 52 void OnProfileSupervisedUserIdChanged(
48 const base::FilePath& profile_path) override; 53 const base::FilePath& profile_path) override;
49 54
50 // Called when the profile info cache or signin/sync error has changed, which 55 // 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. 56 // means we might have to update the icon/text of the button.
52 void Update(); 57 void Update();
53 58
54 AvatarButtonDelegate* delegate_; 59 // Sets generic_avatar_ to the image with the specified IDR.
60 void SetButtonAvatar(int avatar_idr);
61
55 AvatarButtonErrorController error_controller_; 62 AvatarButtonErrorController error_controller_;
56 Profile* profile_; 63 Profile* profile_;
64 ScopedObserver<ProfileAttributesStorage, AvatarButton> profile_observer_;
57 65
58 // The icon displayed instead of the profile name in the local profile case. 66 // The icon displayed instead of the profile name in the local profile case.
59 // Different assets are used depending on the OS version. 67 // Different assets are used depending on the OS version.
60 gfx::ImageSkia generic_avatar_; 68 gfx::ImageSkia generic_avatar_;
61 69
62 // This is used to check if the bubble was showing during the mouse pressed 70 // True to use the Windows 10 native (non-themed) button, which is drawn using
63 // event. If this is true then the mouse released event is ignored to prevent 71 // a vector icon and can change height to slide atop the tabstrip. False to
64 // the bubble from reshowing. 72 // use the old PNG, fixed-size icon button or a themed button.
65 bool suppress_mouse_released_action_; 73 bool use_win10_native_button_;
66 74
67 DISALLOW_COPY_AND_ASSIGN(NewAvatarButton); 75 DISALLOW_COPY_AND_ASSIGN(AvatarButton);
68 }; 76 };
69 77
70 #endif // CHROME_BROWSER_UI_VIEWS_PROFILES_AVATAR_BUTTON_H_ 78 #endif // CHROME_BROWSER_UI_VIEWS_PROFILES_AVATAR_BUTTON_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/frame/glass_browser_frame_view.cc ('k') | chrome/browser/ui/views/profiles/avatar_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698