| 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 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 TUTORIAL_MODE_PREVIEW_ENABLED, // The welcome-to-mirror tutorial shown. | 66 TUTORIAL_MODE_PREVIEW_ENABLED, // The welcome-to-mirror tutorial shown. |
| 67 TUTORIAL_MODE_SEND_FEEDBACK // The send-feedback tutorial shown. | 67 TUTORIAL_MODE_SEND_FEEDBACK // The send-feedback tutorial shown. |
| 68 }; | 68 }; |
| 69 | 69 |
| 70 // Shows the bubble if one is not already showing. This allows us to easily | 70 // Shows the bubble if one is not already showing. This allows us to easily |
| 71 // make a button toggle the bubble on and off when clicked: we unconditionally | 71 // make a button toggle the bubble on and off when clicked: we unconditionally |
| 72 // call this function when the button is clicked and if the bubble isn't | 72 // call this function when the button is clicked and if the bubble isn't |
| 73 // showing it will appear while if it is showing, nothing will happen here and | 73 // showing it will appear while if it is showing, nothing will happen here and |
| 74 // the existing bubble will auto-close due to focus loss. | 74 // the existing bubble will auto-close due to focus loss. |
| 75 static void ShowBubble(BubbleViewMode view_mode, | 75 static void ShowBubble(BubbleViewMode view_mode, |
| 76 signin::GAIA_SERVICE_TYPE service_type, |
| 76 views::View* anchor_view, | 77 views::View* anchor_view, |
| 77 views::BubbleBorder::Arrow arrow, | 78 views::BubbleBorder::Arrow arrow, |
| 78 views::BubbleBorder::BubbleAlignment border_alignment, | 79 views::BubbleBorder::BubbleAlignment border_alignment, |
| 79 const gfx::Rect& anchor_rect, | 80 const gfx::Rect& anchor_rect, |
| 80 Browser* browser); | 81 Browser* browser); |
| 81 static bool IsShowing(); | 82 static bool IsShowing(); |
| 82 static void Hide(); | 83 static void Hide(); |
| 83 | 84 |
| 84 // We normally close the bubble any time it becomes inactive but this can lead | 85 // We normally close the bubble any time it becomes inactive but this can lead |
| 85 // to flaky tests where unexpected UI events are triggering this behavior. | 86 // to flaky tests where unexpected UI events are triggering this behavior. |
| 86 // Tests should call this with "false" for more consistent operation. | 87 // Tests should call this with "false" for more consistent operation. |
| 87 static void clear_close_on_deactivate_for_testing() { | 88 static void clear_close_on_deactivate_for_testing() { |
| 88 close_on_deactivate_for_testing_ = false; | 89 close_on_deactivate_for_testing_ = false; |
| 89 } | 90 } |
| 90 | 91 |
| 91 private: | 92 private: |
| 92 friend class NewAvatarMenuButtonTest; | 93 friend class NewAvatarMenuButtonTest; |
| 93 FRIEND_TEST_ALL_PREFIXES(NewAvatarMenuButtonTest, SignOut); | 94 FRIEND_TEST_ALL_PREFIXES(NewAvatarMenuButtonTest, SignOut); |
| 94 | 95 |
| 95 typedef std::vector<size_t> Indexes; | 96 typedef std::vector<size_t> Indexes; |
| 96 typedef std::map<views::Button*, int> ButtonIndexes; | 97 typedef std::map<views::Button*, int> ButtonIndexes; |
| 97 typedef std::map<views::Button*, std::string> AccountButtonIndexes; | 98 typedef std::map<views::Button*, std::string> AccountButtonIndexes; |
| 98 | 99 |
| 99 ProfileChooserView(views::View* anchor_view, | 100 ProfileChooserView(views::View* anchor_view, |
| 100 views::BubbleBorder::Arrow arrow, | 101 views::BubbleBorder::Arrow arrow, |
| 101 const gfx::Rect& anchor_rect, | 102 const gfx::Rect& anchor_rect, |
| 102 Browser* browser, | 103 Browser* browser, |
| 103 BubbleViewMode view_mode); | 104 BubbleViewMode view_mode, |
| 105 signin::GAIA_SERVICE_TYPE service_type); |
| 104 virtual ~ProfileChooserView(); | 106 virtual ~ProfileChooserView(); |
| 105 | 107 |
| 106 // views::BubbleDelegateView: | 108 // views::BubbleDelegateView: |
| 107 virtual void Init() OVERRIDE; | 109 virtual void Init() OVERRIDE; |
| 108 virtual void WindowClosing() OVERRIDE; | 110 virtual void WindowClosing() OVERRIDE; |
| 109 | 111 |
| 110 // views::ButtonListener: | 112 // views::ButtonListener: |
| 111 virtual void ButtonPressed(views::Button* sender, | 113 virtual void ButtonPressed(views::Button* sender, |
| 112 const ui::Event& event) OVERRIDE; | 114 const ui::Event& event) OVERRIDE; |
| 113 | 115 |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 | 247 |
| 246 // Records the account id to remove. | 248 // Records the account id to remove. |
| 247 std::string account_id_to_remove_; | 249 std::string account_id_to_remove_; |
| 248 | 250 |
| 249 // Active view mode. | 251 // Active view mode. |
| 250 BubbleViewMode view_mode_; | 252 BubbleViewMode view_mode_; |
| 251 | 253 |
| 252 // The current tutorial mode. | 254 // The current tutorial mode. |
| 253 TutorialMode tutorial_mode_; | 255 TutorialMode tutorial_mode_; |
| 254 | 256 |
| 257 // The GAIA service type provided in the response header. |
| 258 const signin::GAIA_SERVICE_TYPE gaia_service_type_; |
| 259 |
| 255 DISALLOW_COPY_AND_ASSIGN(ProfileChooserView); | 260 DISALLOW_COPY_AND_ASSIGN(ProfileChooserView); |
| 256 }; | 261 }; |
| 257 | 262 |
| 258 #endif // CHROME_BROWSER_UI_VIEWS_PROFILES_PROFILE_CHOOSER_VIEW_H_ | 263 #endif // CHROME_BROWSER_UI_VIEWS_PROFILES_PROFILE_CHOOSER_VIEW_H_ |
| OLD | NEW |