OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_PROFILE_CHOOSER_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_PROFILE_CHOOSER_VIEW_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_PROFILE_CHOOSER_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_PROFILE_CHOOSER_VIEW_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 25 matching lines...) Expand all Loading... | |
36 // showing it will appear while if it is showing, nothing will happen here and | 36 // showing it will appear while if it is showing, nothing will happen here and |
37 // the existing bubble will auto-close due to focus loss. | 37 // the existing bubble will auto-close due to focus loss. |
38 static void ShowBubble(views::View* anchor_view, | 38 static void ShowBubble(views::View* anchor_view, |
39 views::BubbleBorder::Arrow arrow, | 39 views::BubbleBorder::Arrow arrow, |
40 views::BubbleBorder::BubbleAlignment border_alignment, | 40 views::BubbleBorder::BubbleAlignment border_alignment, |
41 const gfx::Rect& anchor_rect, | 41 const gfx::Rect& anchor_rect, |
42 Browser* browser); | 42 Browser* browser); |
43 static bool IsShowing(); | 43 static bool IsShowing(); |
44 static void Hide(); | 44 static void Hide(); |
45 | 45 |
46 // We normally close the bubble any time it becomes inactive but this can lead | |
47 // to flaky tests where unexpected UI events are triggering this behavior. | |
48 // Tests should call this with "false" for more consistent operation. | |
49 static void set_close_on_deactiavte(bool close) { | |
noms
2013/07/25 19:22:42
Blurg. Typo! :(
| |
50 close_on_deactivate_ = close; | |
51 } | |
52 | |
46 private: | 53 private: |
47 friend class AvatarMenuButtonTest; | 54 friend class AvatarMenuButtonTest; |
48 FRIEND_TEST_ALL_PREFIXES(AvatarMenuButtonTest, NewSignOut); | 55 FRIEND_TEST_ALL_PREFIXES(AvatarMenuButtonTest, NewSignOut); |
49 FRIEND_TEST_ALL_PREFIXES(AvatarMenuButtonTest, LaunchUserManagerScreen); | 56 FRIEND_TEST_ALL_PREFIXES(AvatarMenuButtonTest, LaunchUserManagerScreen); |
50 | 57 |
51 typedef std::vector<size_t> Indexes; | 58 typedef std::vector<size_t> Indexes; |
52 typedef std::map<views::View*, int> ViewIndexes; | 59 typedef std::map<views::View*, int> ViewIndexes; |
53 | 60 |
54 ProfileChooserView(views::View* anchor_view, | 61 ProfileChooserView(views::View* anchor_view, |
55 views::BubbleBorder::Arrow arrow, | 62 views::BubbleBorder::Arrow arrow, |
56 const gfx::Rect& anchor_rect, | 63 const gfx::Rect& anchor_rect, |
57 Browser* browser); | 64 Browser* browser); |
58 virtual ~ProfileChooserView(); | 65 virtual ~ProfileChooserView(); |
59 | 66 |
60 // BubbleDelegateView: | 67 // BubbleDelegateView: |
61 virtual void Init() OVERRIDE; | 68 virtual void Init() OVERRIDE; |
62 virtual void WindowClosing() OVERRIDE; | 69 virtual void WindowClosing() OVERRIDE; |
63 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; | 70 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; |
64 virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE; | 71 virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE; |
65 | 72 |
66 // ButtonListener: | 73 // ButtonListener: |
67 virtual void ButtonPressed(views::Button* sender, | 74 virtual void ButtonPressed(views::Button* sender, |
68 const ui::Event& event) OVERRIDE; | 75 const ui::Event& event) OVERRIDE; |
69 | 76 |
70 // AvatarMenuModelObserver: | 77 // AvatarMenuModelObserver: |
71 virtual void OnAvatarMenuModelChanged( | 78 virtual void OnAvatarMenuModelChanged( |
72 AvatarMenuModel* avatar_menu_model) OVERRIDE; | 79 AvatarMenuModel* avatar_menu_model) OVERRIDE; |
73 | 80 |
74 static ProfileChooserView* profile_bubble_; | 81 static ProfileChooserView* profile_bubble_; |
82 static bool close_on_deactivate_; | |
75 | 83 |
76 views::View* CreateProfileImageView(const gfx::Image& icon, int side); | 84 views::View* CreateProfileImageView(const gfx::Image& icon, int side); |
77 views::View* CreateProfileCardView(size_t avatar_to_show); | 85 views::View* CreateProfileCardView(size_t avatar_to_show); |
78 views::View* CreateCurrentProfileView(size_t avatars_to_show); | 86 views::View* CreateCurrentProfileView(size_t avatars_to_show); |
79 views::View* CreateOtherProfilesView(const Indexes& avatars_to_show); | 87 views::View* CreateOtherProfilesView(const Indexes& avatars_to_show); |
80 views::View* CreateOptionsView(); | 88 views::View* CreateOptionsView(); |
81 | 89 |
82 scoped_ptr<AvatarMenuModel> avatar_menu_model_; | 90 scoped_ptr<AvatarMenuModel> avatar_menu_model_; |
83 Browser* browser_; | 91 Browser* browser_; |
84 views::View* current_profile_view_; | 92 views::View* current_profile_view_; |
85 views::LabelButton* guest_button_view_; | 93 views::LabelButton* guest_button_view_; |
86 views::LabelButton* users_button_view_; | 94 views::LabelButton* users_button_view_; |
87 ViewIndexes open_other_profile_indexes_map_; | 95 ViewIndexes open_other_profile_indexes_map_; |
88 views::View* other_profiles_view_; | 96 views::View* other_profiles_view_; |
89 views::View* signout_current_profile_view_; | 97 views::View* signout_current_profile_view_; |
90 | 98 |
91 DISALLOW_COPY_AND_ASSIGN(ProfileChooserView); | 99 DISALLOW_COPY_AND_ASSIGN(ProfileChooserView); |
92 }; | 100 }; |
93 | 101 |
94 #endif // CHROME_BROWSER_UI_VIEWS_PROFILE_CHOOSER_VIEW_H_ | 102 #endif // CHROME_BROWSER_UI_VIEWS_PROFILE_CHOOSER_VIEW_H_ |
OLD | NEW |