| OLD | NEW |
| 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 "chrome/browser/profiles/profile_info_cache_observer.h" | 8 #include "chrome/browser/profiles/profile_info_cache_observer.h" |
| 9 #include "components/signin/core/browser/signin_error_controller.h" | 9 #include "components/signin/core/browser/signin_error_controller.h" |
| 10 #include "ui/views/controls/button/label_button.h" | 10 #include "ui/views/controls/button/label_button.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 THEMED_BUTTON, // Used in a themed browser window. | 21 THEMED_BUTTON, // Used in a themed browser window. |
| 22 NATIVE_BUTTON, // Used in a native aero or metro window. | 22 NATIVE_BUTTON, // Used in a native aero or metro window. |
| 23 }; | 23 }; |
| 24 | 24 |
| 25 NewAvatarButton(views::ButtonListener* listener, | 25 NewAvatarButton(views::ButtonListener* listener, |
| 26 AvatarButtonStyle button_style, | 26 AvatarButtonStyle button_style, |
| 27 Browser* browser); | 27 Browser* browser); |
| 28 virtual ~NewAvatarButton(); | 28 virtual ~NewAvatarButton(); |
| 29 | 29 |
| 30 // Views::LabelButton | 30 // Views::LabelButton |
| 31 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; | 31 virtual bool OnMousePressed(const ui::MouseEvent& event) override; |
| 32 virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE; | 32 virtual void OnMouseReleased(const ui::MouseEvent& event) override; |
| 33 | 33 |
| 34 private: | 34 private: |
| 35 friend class NewAvatarMenuButtonTest; | 35 friend class NewAvatarMenuButtonTest; |
| 36 friend class ProfileChooserViewBrowserTest; | 36 friend class ProfileChooserViewBrowserTest; |
| 37 FRIEND_TEST_ALL_PREFIXES(NewAvatarMenuButtonTest, SignOut); | 37 FRIEND_TEST_ALL_PREFIXES(NewAvatarMenuButtonTest, SignOut); |
| 38 FRIEND_TEST_ALL_PREFIXES(ProfileChooserViewBrowserTest, ViewProfileUMA); | 38 FRIEND_TEST_ALL_PREFIXES(ProfileChooserViewBrowserTest, ViewProfileUMA); |
| 39 | 39 |
| 40 // ProfileInfoCacheObserver: | 40 // ProfileInfoCacheObserver: |
| 41 virtual void OnProfileAdded(const base::FilePath& profile_path) OVERRIDE; | 41 virtual void OnProfileAdded(const base::FilePath& profile_path) override; |
| 42 virtual void OnProfileWasRemoved( | 42 virtual void OnProfileWasRemoved( |
| 43 const base::FilePath& profile_path, | 43 const base::FilePath& profile_path, |
| 44 const base::string16& profile_name) OVERRIDE; | 44 const base::string16& profile_name) override; |
| 45 virtual void OnProfileNameChanged( | 45 virtual void OnProfileNameChanged( |
| 46 const base::FilePath& profile_path, | 46 const base::FilePath& profile_path, |
| 47 const base::string16& old_profile_name) OVERRIDE; | 47 const base::string16& old_profile_name) override; |
| 48 virtual void OnProfileAvatarChanged( | 48 virtual void OnProfileAvatarChanged( |
| 49 const base::FilePath& profile_path) OVERRIDE; | 49 const base::FilePath& profile_path) override; |
| 50 virtual void OnProfileSupervisedUserIdChanged( | 50 virtual void OnProfileSupervisedUserIdChanged( |
| 51 const base::FilePath& profile_path) OVERRIDE; | 51 const base::FilePath& profile_path) override; |
| 52 | 52 |
| 53 // SigninErrorController::Observer: | 53 // SigninErrorController::Observer: |
| 54 virtual void OnErrorChanged() OVERRIDE; | 54 virtual void OnErrorChanged() override; |
| 55 | 55 |
| 56 // Called when the profile info cache has changed, which means we might | 56 // Called when the profile info cache has changed, which means we might |
| 57 // have to update the icon/text of the button. | 57 // have to update the icon/text of the button. |
| 58 void UpdateAvatarButtonAndRelayoutParent(); | 58 void UpdateAvatarButtonAndRelayoutParent(); |
| 59 | 59 |
| 60 Browser* browser_; | 60 Browser* browser_; |
| 61 | 61 |
| 62 // Whether the signed in profile has an authentication error. Used to display | 62 // Whether the signed in profile has an authentication error. Used to display |
| 63 // an error icon next to the button text. | 63 // an error icon next to the button text. |
| 64 bool has_auth_error_; | 64 bool has_auth_error_; |
| 65 | 65 |
| 66 // 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. |
| 67 // Different assets are used depending on the OS version. | 67 // Different assets are used depending on the OS version. |
| 68 gfx::ImageSkia generic_avatar_; | 68 gfx::ImageSkia generic_avatar_; |
| 69 | 69 |
| 70 // This is used to check if the bubble was showing during the mouse pressed | 70 // This is used to check if the bubble was showing during the mouse pressed |
| 71 // event. If this is true then the mouse released event is ignored to prevent | 71 // event. If this is true then the mouse released event is ignored to prevent |
| 72 // the bubble from reshowing. | 72 // the bubble from reshowing. |
| 73 bool suppress_mouse_released_action_; | 73 bool suppress_mouse_released_action_; |
| 74 | 74 |
| 75 DISALLOW_COPY_AND_ASSIGN(NewAvatarButton); | 75 DISALLOW_COPY_AND_ASSIGN(NewAvatarButton); |
| 76 }; | 76 }; |
| 77 | 77 |
| 78 #endif // CHROME_BROWSER_UI_VIEWS_PROFILES_NEW_AVATAR_BUTTON_H_ | 78 #endif // CHROME_BROWSER_UI_VIEWS_PROFILES_NEW_AVATAR_BUTTON_H_ |
| OLD | NEW |