| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 public AvatarMenuObserver, | 46 public AvatarMenuObserver, |
| 47 public OAuth2TokenService::Observer { | 47 public OAuth2TokenService::Observer { |
| 48 public: | 48 public: |
| 49 // Shows the bubble if one is not already showing. This allows us to easily | 49 // Shows the bubble if one is not already showing. This allows us to easily |
| 50 // make a button toggle the bubble on and off when clicked: we unconditionally | 50 // make a button toggle the bubble on and off when clicked: we unconditionally |
| 51 // call this function when the button is clicked and if the bubble isn't | 51 // call this function when the button is clicked and if the bubble isn't |
| 52 // showing it will appear while if it is showing, nothing will happen here and | 52 // showing it will appear while if it is showing, nothing will happen here and |
| 53 // the existing bubble will auto-close due to focus loss. | 53 // the existing bubble will auto-close due to focus loss. |
| 54 static void ShowBubble( | 54 static void ShowBubble( |
| 55 profiles::BubbleViewMode view_mode, | 55 profiles::BubbleViewMode view_mode, |
| 56 profiles::TutorialMode tutorial_mode, |
| 56 const signin::ManageAccountsParams& manage_accounts_params, | 57 const signin::ManageAccountsParams& manage_accounts_params, |
| 57 views::View* anchor_view, | 58 views::View* anchor_view, |
| 58 views::BubbleBorder::Arrow arrow, | 59 views::BubbleBorder::Arrow arrow, |
| 59 views::BubbleBorder::BubbleAlignment border_alignment, | 60 views::BubbleBorder::BubbleAlignment border_alignment, |
| 60 Browser* browser); | 61 Browser* browser); |
| 61 static bool IsShowing(); | 62 static bool IsShowing(); |
| 62 static void Hide(); | 63 static void Hide(); |
| 63 | 64 |
| 64 // We normally close the bubble any time it becomes inactive but this can lead | 65 // We normally close the bubble any time it becomes inactive but this can lead |
| 65 // to flaky tests where unexpected UI events are triggering this behavior. | 66 // to flaky tests where unexpected UI events are triggering this behavior. |
| 66 // Tests should call this with "false" for more consistent operation. | 67 // Tests should call this with "false" for more consistent operation. |
| 67 static void clear_close_on_deactivate_for_testing() { | 68 static void clear_close_on_deactivate_for_testing() { |
| 68 close_on_deactivate_for_testing_ = false; | 69 close_on_deactivate_for_testing_ = false; |
| 69 } | 70 } |
| 70 | 71 |
| 71 private: | 72 private: |
| 72 friend class NewAvatarMenuButtonTest; | 73 friend class NewAvatarMenuButtonTest; |
| 73 FRIEND_TEST_ALL_PREFIXES(NewAvatarMenuButtonTest, SignOut); | 74 FRIEND_TEST_ALL_PREFIXES(NewAvatarMenuButtonTest, SignOut); |
| 74 | 75 |
| 75 typedef std::vector<size_t> Indexes; | 76 typedef std::vector<size_t> Indexes; |
| 76 typedef std::map<views::Button*, int> ButtonIndexes; | 77 typedef std::map<views::Button*, int> ButtonIndexes; |
| 77 typedef std::map<views::Button*, std::string> AccountButtonIndexes; | 78 typedef std::map<views::Button*, std::string> AccountButtonIndexes; |
| 78 | 79 |
| 79 ProfileChooserView(views::View* anchor_view, | 80 ProfileChooserView(views::View* anchor_view, |
| 80 views::BubbleBorder::Arrow arrow, | 81 views::BubbleBorder::Arrow arrow, |
| 81 Browser* browser, | 82 Browser* browser, |
| 82 profiles::BubbleViewMode view_mode, | 83 profiles::BubbleViewMode view_mode, |
| 84 profiles::TutorialMode tutorial_mode, |
| 83 signin::GAIAServiceType service_type); | 85 signin::GAIAServiceType service_type); |
| 84 virtual ~ProfileChooserView(); | 86 virtual ~ProfileChooserView(); |
| 85 | 87 |
| 86 // views::BubbleDelegateView: | 88 // views::BubbleDelegateView: |
| 87 virtual void Init() OVERRIDE; | 89 virtual void Init() OVERRIDE; |
| 88 virtual void WindowClosing() OVERRIDE; | 90 virtual void WindowClosing() OVERRIDE; |
| 89 | 91 |
| 90 // views::ButtonListener: | 92 // views::ButtonListener: |
| 91 virtual void ButtonPressed(views::Button* sender, | 93 virtual void ButtonPressed(views::Button* sender, |
| 92 const ui::Event& event) OVERRIDE; | 94 const ui::Event& event) OVERRIDE; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 111 | 113 |
| 112 static ProfileChooserView* profile_bubble_; | 114 static ProfileChooserView* profile_bubble_; |
| 113 static bool close_on_deactivate_for_testing_; | 115 static bool close_on_deactivate_for_testing_; |
| 114 | 116 |
| 115 void ResetView(); | 117 void ResetView(); |
| 116 | 118 |
| 117 // Shows the bubble with the |view_to_display|. | 119 // Shows the bubble with the |view_to_display|. |
| 118 void ShowView(profiles::BubbleViewMode view_to_display, | 120 void ShowView(profiles::BubbleViewMode view_to_display, |
| 119 AvatarMenu* avatar_menu); | 121 AvatarMenu* avatar_menu); |
| 120 | 122 |
| 121 // Creates the profile chooser view. |tutorial_shown| indicates if a tutorial | 123 // Creates the profile chooser view. |
| 122 // was shown in the last active view. | 124 views::View* CreateProfileChooserView(AvatarMenu* avatar_menu); |
| 123 views::View* CreateProfileChooserView(AvatarMenu* avatar_menu, | |
| 124 profiles::TutorialMode last_tutorial_mode); | |
| 125 | 125 |
| 126 // Creates the main profile card for the profile |avatar_item|. |is_guest| | 126 // Creates the main profile card for the profile |avatar_item|. |is_guest| |
| 127 // is used to determine whether to show any Sign in/Sign out/Manage accounts | 127 // is used to determine whether to show any Sign in/Sign out/Manage accounts |
| 128 // links. | 128 // links. |
| 129 views::View* CreateCurrentProfileView( | 129 views::View* CreateCurrentProfileView( |
| 130 const AvatarMenu::Item& avatar_item, | 130 const AvatarMenu::Item& avatar_item, |
| 131 bool is_guest); | 131 bool is_guest); |
| 132 views::View* CreateGuestProfileView(); | 132 views::View* CreateGuestProfileView(); |
| 133 views::View* CreateOtherProfilesView(const Indexes& avatars_to_show); | 133 views::View* CreateOtherProfilesView(const Indexes& avatars_to_show); |
| 134 views::View* CreateOptionsView(bool enable_lock); | 134 views::View* CreateOptionsView(bool enable_lock); |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 // The current tutorial mode. | 243 // The current tutorial mode. |
| 244 profiles::TutorialMode tutorial_mode_; | 244 profiles::TutorialMode tutorial_mode_; |
| 245 | 245 |
| 246 // The GAIA service type provided in the response header. | 246 // The GAIA service type provided in the response header. |
| 247 signin::GAIAServiceType gaia_service_type_; | 247 signin::GAIAServiceType gaia_service_type_; |
| 248 | 248 |
| 249 DISALLOW_COPY_AND_ASSIGN(ProfileChooserView); | 249 DISALLOW_COPY_AND_ASSIGN(ProfileChooserView); |
| 250 }; | 250 }; |
| 251 | 251 |
| 252 #endif // CHROME_BROWSER_UI_VIEWS_PROFILES_PROFILE_CHOOSER_VIEW_H_ | 252 #endif // CHROME_BROWSER_UI_VIEWS_PROFILES_PROFILE_CHOOSER_VIEW_H_ |
| OLD | NEW |