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/menu_button.h" | 10 #include "ui/views/controls/button/menu_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 const base::string16& profile_name, | 26 const base::string16& profile_name, |
27 AvatarButtonStyle button_style, | 27 AvatarButtonStyle button_style, |
28 Browser* browser); | 28 Browser* browser); |
29 virtual ~NewAvatarButton(); | 29 virtual ~NewAvatarButton(); |
30 | 30 |
31 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; | |
msw
2014/08/20 21:12:36
nit: add comment "// views::MenuButton:"
Mike Lerman
2014/08/21 15:15:36
Done.
| |
32 | |
33 // If this is the second click on the avatar button then the avatar button was | |
34 // showing on the pressed event and is hidden now. Prevent the bubble from | |
35 // reshowing. | |
36 bool IsMouseReleaseActionSuppressed(); | |
37 | |
31 private: | 38 private: |
32 friend class NewAvatarMenuButtonTest; | 39 friend class NewAvatarMenuButtonTest; |
33 friend class ProfileChooserViewBrowserTest; | 40 friend class ProfileChooserViewBrowserTest; |
34 FRIEND_TEST_ALL_PREFIXES(NewAvatarMenuButtonTest, SignOut); | 41 FRIEND_TEST_ALL_PREFIXES(NewAvatarMenuButtonTest, SignOut); |
35 FRIEND_TEST_ALL_PREFIXES(ProfileChooserViewBrowserTest, ViewProfileUMA); | 42 FRIEND_TEST_ALL_PREFIXES(ProfileChooserViewBrowserTest, ViewProfileUMA); |
36 | 43 |
37 // ProfileInfoCacheObserver: | 44 // ProfileInfoCacheObserver: |
38 virtual void OnProfileAdded(const base::FilePath& profile_path) OVERRIDE; | 45 virtual void OnProfileAdded(const base::FilePath& profile_path) OVERRIDE; |
39 virtual void OnProfileWasRemoved( | 46 virtual void OnProfileWasRemoved( |
40 const base::FilePath& profile_path, | 47 const base::FilePath& profile_path, |
41 const base::string16& profile_name) OVERRIDE; | 48 const base::string16& profile_name) OVERRIDE; |
42 virtual void OnProfileNameChanged( | 49 virtual void OnProfileNameChanged( |
43 const base::FilePath& profile_path, | 50 const base::FilePath& profile_path, |
44 const base::string16& old_profile_name) OVERRIDE; | 51 const base::string16& old_profile_name) OVERRIDE; |
45 virtual void OnProfileSupervisedUserIdChanged( | 52 virtual void OnProfileSupervisedUserIdChanged( |
46 const base::FilePath& profile_path) OVERRIDE; | 53 const base::FilePath& profile_path) OVERRIDE; |
47 | 54 |
48 // SigninErrorController::Observer: | 55 // SigninErrorController::Observer: |
49 virtual void OnErrorChanged() OVERRIDE; | 56 virtual void OnErrorChanged() OVERRIDE; |
50 | 57 |
51 // Called when the profile info cache has changed, which means we might | 58 // Called when the profile info cache has changed, which means we might |
52 // have to re-display the profile name. | 59 // have to re-display the profile name. |
53 void UpdateAvatarButtonAndRelayoutParent(); | 60 void UpdateAvatarButtonAndRelayoutParent(); |
54 | 61 |
55 Browser* browser_; | 62 Browser* browser_; |
56 | 63 |
64 // This is used to check if the profile chooser view was showing during the | |
msw
2014/08/20 21:12:36
nit: s/profile chooser view/bubble/, ditto below f
Mike Lerman
2014/08/21 15:15:36
Done.
| |
65 // mouse pressed event. If this is true then the mouse released event is | |
66 // ignored to prevent the profile chooser from reshowing. | |
67 bool suppress_mouse_released_action_; | |
68 | |
57 DISALLOW_COPY_AND_ASSIGN(NewAvatarButton); | 69 DISALLOW_COPY_AND_ASSIGN(NewAvatarButton); |
58 }; | 70 }; |
59 | 71 |
60 #endif // CHROME_BROWSER_UI_VIEWS_PROFILES_NEW_AVATAR_BUTTON_H_ | 72 #endif // CHROME_BROWSER_UI_VIEWS_PROFILES_NEW_AVATAR_BUTTON_H_ |
OLD | NEW |