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_PROFILE_CHOOSER_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_PROFILES_PROFILE_CHOOSER_VIEW_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_PROFILES_PROFILE_CHOOSER_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_PROFILES_PROFILE_CHOOSER_VIEW_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "chrome/browser/profiles/avatar_menu.h" | 11 #include "chrome/browser/profiles/avatar_menu.h" |
12 #include "chrome/browser/profiles/avatar_menu_observer.h" | 12 #include "chrome/browser/profiles/avatar_menu_observer.h" |
13 #include "chrome/browser/profiles/profile_metrics.h" | |
13 #include "chrome/browser/ui/browser_window.h" | 14 #include "chrome/browser/ui/browser_window.h" |
14 #include "google_apis/gaia/oauth2_token_service.h" | 15 #include "google_apis/gaia/oauth2_token_service.h" |
15 #include "ui/views/bubble/bubble_delegate.h" | 16 #include "ui/views/bubble/bubble_delegate.h" |
16 #include "ui/views/controls/button/button.h" | 17 #include "ui/views/controls/button/button.h" |
17 #include "ui/views/controls/link_listener.h" | 18 #include "ui/views/controls/link_listener.h" |
18 #include "ui/views/controls/styled_label_listener.h" | 19 #include "ui/views/controls/styled_label_listener.h" |
19 #include "ui/views/controls/textfield/textfield_controller.h" | 20 #include "ui/views/controls/textfield/textfield_controller.h" |
20 | 21 |
21 class EditableProfilePhoto; | 22 class EditableProfilePhoto; |
22 class EditableProfileName; | 23 class EditableProfileName; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
68 TUTORIAL_MODE_PREVIEW_ENABLED, // The welcome-to-mirror tutorial shown. | 69 TUTORIAL_MODE_PREVIEW_ENABLED, // The welcome-to-mirror tutorial shown. |
69 TUTORIAL_MODE_SEND_FEEDBACK // The send-feedback tutorial shown. | 70 TUTORIAL_MODE_SEND_FEEDBACK // The send-feedback tutorial shown. |
70 }; | 71 }; |
71 | 72 |
72 // Shows the bubble if one is not already showing. This allows us to easily | 73 // Shows the bubble if one is not already showing. This allows us to easily |
73 // make a button toggle the bubble on and off when clicked: we unconditionally | 74 // make a button toggle the bubble on and off when clicked: we unconditionally |
74 // call this function when the button is clicked and if the bubble isn't | 75 // call this function when the button is clicked and if the bubble isn't |
75 // showing it will appear while if it is showing, nothing will happen here and | 76 // showing it will appear while if it is showing, nothing will happen here and |
76 // the existing bubble will auto-close due to focus loss. | 77 // the existing bubble will auto-close due to focus loss. |
77 static void ShowBubble(BubbleViewMode view_mode, | 78 static void ShowBubble(BubbleViewMode view_mode, |
79 signin::GAIA_SERVICE_TYPE service_type, | |
78 views::View* anchor_view, | 80 views::View* anchor_view, |
79 views::BubbleBorder::Arrow arrow, | 81 views::BubbleBorder::Arrow arrow, |
80 views::BubbleBorder::BubbleAlignment border_alignment, | 82 views::BubbleBorder::BubbleAlignment border_alignment, |
81 const gfx::Rect& anchor_rect, | 83 const gfx::Rect& anchor_rect, |
82 Browser* browser); | 84 Browser* browser); |
83 static bool IsShowing(); | 85 static bool IsShowing(); |
84 static void Hide(); | 86 static void Hide(); |
85 | 87 |
86 // We normally close the bubble any time it becomes inactive but this can lead | 88 // We normally close the bubble any time it becomes inactive but this can lead |
87 // to flaky tests where unexpected UI events are triggering this behavior. | 89 // to flaky tests where unexpected UI events are triggering this behavior. |
88 // Tests should call this with "false" for more consistent operation. | 90 // Tests should call this with "false" for more consistent operation. |
89 static void clear_close_on_deactivate_for_testing() { | 91 static void clear_close_on_deactivate_for_testing() { |
90 close_on_deactivate_for_testing_ = false; | 92 close_on_deactivate_for_testing_ = false; |
91 } | 93 } |
92 | 94 |
93 private: | 95 private: |
94 friend class NewAvatarMenuButtonTest; | 96 friend class NewAvatarMenuButtonTest; |
95 FRIEND_TEST_ALL_PREFIXES(NewAvatarMenuButtonTest, SignOut); | 97 FRIEND_TEST_ALL_PREFIXES(NewAvatarMenuButtonTest, SignOut); |
96 | 98 |
97 typedef std::vector<size_t> Indexes; | 99 typedef std::vector<size_t> Indexes; |
98 typedef std::map<views::Button*, int> ButtonIndexes; | 100 typedef std::map<views::Button*, int> ButtonIndexes; |
99 typedef std::map<views::Button*, std::string> AccountButtonIndexes; | 101 typedef std::map<views::Button*, std::string> AccountButtonIndexes; |
100 | 102 |
101 ProfileChooserView(views::View* anchor_view, | 103 ProfileChooserView(views::View* anchor_view, |
102 views::BubbleBorder::Arrow arrow, | 104 views::BubbleBorder::Arrow arrow, |
103 const gfx::Rect& anchor_rect, | 105 const gfx::Rect& anchor_rect, |
104 Browser* browser, | 106 Browser* browser, |
105 BubbleViewMode view_mode); | 107 BubbleViewMode view_mode, |
108 signin::GAIA_SERVICE_TYPE service_type); | |
106 virtual ~ProfileChooserView(); | 109 virtual ~ProfileChooserView(); |
107 | 110 |
108 // views::BubbleDelegateView: | 111 // views::BubbleDelegateView: |
109 virtual void Init() OVERRIDE; | 112 virtual void Init() OVERRIDE; |
110 virtual void WindowClosing() OVERRIDE; | 113 virtual void WindowClosing() OVERRIDE; |
111 | 114 |
112 // views::ButtonListener: | 115 // views::ButtonListener: |
113 virtual void ButtonPressed(views::Button* sender, | 116 virtual void ButtonPressed(views::Button* sender, |
114 const ui::Event& event) OVERRIDE; | 117 const ui::Event& event) OVERRIDE; |
115 | 118 |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
197 TutorialMode tutorial_mode, | 200 TutorialMode tutorial_mode, |
198 const base::string16& title_text, | 201 const base::string16& title_text, |
199 const base::string16& content_text, | 202 const base::string16& content_text, |
200 const base::string16& link_text, | 203 const base::string16& link_text, |
201 const base::string16& button_text, | 204 const base::string16& button_text, |
202 views::Link** link, | 205 views::Link** link, |
203 views::LabelButton** button); | 206 views::LabelButton** button); |
204 | 207 |
205 views::View* CreateEndPreviewView(); | 208 views::View* CreateEndPreviewView(); |
206 | 209 |
210 // Clean-up done after an action was performed in the ProfileChooser. | |
211 void PostActionPerformed(ProfileMetrics::ProfileDesktopMenu action_performed); | |
212 | |
207 scoped_ptr<AvatarMenu> avatar_menu_; | 213 scoped_ptr<AvatarMenu> avatar_menu_; |
208 Browser* browser_; | 214 Browser* browser_; |
209 | 215 |
210 // Other profiles used in the "fast profile switcher" view. | 216 // Other profiles used in the "fast profile switcher" view. |
211 ButtonIndexes open_other_profile_indexes_map_; | 217 ButtonIndexes open_other_profile_indexes_map_; |
212 | 218 |
213 // Buttons associated with the current profile. | 219 // Buttons associated with the current profile. |
214 AccountButtonIndexes delete_account_button_map_; | 220 AccountButtonIndexes delete_account_button_map_; |
215 AccountButtonIndexes reauth_account_button_map_; | 221 AccountButtonIndexes reauth_account_button_map_; |
216 | 222 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
249 | 255 |
250 // Records the account id to remove. | 256 // Records the account id to remove. |
251 std::string account_id_to_remove_; | 257 std::string account_id_to_remove_; |
252 | 258 |
253 // Active view mode. | 259 // Active view mode. |
254 BubbleViewMode view_mode_; | 260 BubbleViewMode view_mode_; |
255 | 261 |
256 // The current tutorial mode. | 262 // The current tutorial mode. |
257 TutorialMode tutorial_mode_; | 263 TutorialMode tutorial_mode_; |
258 | 264 |
265 // The GAIA service type provided in the response header. | |
266 signin::GAIA_SERVICE_TYPE gaia_service_type_; | |
sky
2014/05/23 19:55:22
const
Mike Lerman
2014/05/23 20:13:04
It originally was but I am now re-assigning the va
| |
267 | |
259 DISALLOW_COPY_AND_ASSIGN(ProfileChooserView); | 268 DISALLOW_COPY_AND_ASSIGN(ProfileChooserView); |
260 }; | 269 }; |
261 | 270 |
262 #endif // CHROME_BROWSER_UI_VIEWS_PROFILES_PROFILE_CHOOSER_VIEW_H_ | 271 #endif // CHROME_BROWSER_UI_VIEWS_PROFILES_PROFILE_CHOOSER_VIEW_H_ |
OLD | NEW |