| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 public AvatarMenuObserver, | 43 public AvatarMenuObserver, |
| 44 public OAuth2TokenService::Observer { | 44 public OAuth2TokenService::Observer { |
| 45 public: | 45 public: |
| 46 // Shows the bubble if one is not already showing. This allows us to easily | 46 // Shows the bubble if one is not already showing. This allows us to easily |
| 47 // make a button toggle the bubble on and off when clicked: we unconditionally | 47 // make a button toggle the bubble on and off when clicked: we unconditionally |
| 48 // call this function when the button is clicked and if the bubble isn't | 48 // call this function when the button is clicked and if the bubble isn't |
| 49 // showing it will appear while if it is showing, nothing will happen here and | 49 // showing it will appear while if it is showing, nothing will happen here and |
| 50 // the existing bubble will auto-close due to focus loss. | 50 // the existing bubble will auto-close due to focus loss. |
| 51 static void ShowBubble( | 51 static void ShowBubble( |
| 52 profiles::BubbleViewMode view_mode, | 52 profiles::BubbleViewMode view_mode, |
| 53 profiles::TutorialMode tutorial_mode, | |
| 54 const signin::ManageAccountsParams& manage_accounts_params, | 53 const signin::ManageAccountsParams& manage_accounts_params, |
| 55 signin_metrics::AccessPoint access_point, | 54 signin_metrics::AccessPoint access_point, |
| 56 views::View* anchor_view, | 55 views::View* anchor_view, |
| 57 Browser* browser, | 56 Browser* browser, |
| 58 bool is_source_keyboard); | 57 bool is_source_keyboard); |
| 59 static bool IsShowing(); | 58 static bool IsShowing(); |
| 60 static views::Widget* GetCurrentBubbleWidget(); | 59 static views::Widget* GetCurrentBubbleWidget(); |
| 61 static void Hide(); | 60 static void Hide(); |
| 62 | 61 |
| 63 const Browser* browser() const { return browser_; } | 62 const Browser* browser() const { return browser_; } |
| 64 | 63 |
| 65 private: | 64 private: |
| 66 friend class ProfileChooserViewExtensionsTest; | 65 friend class ProfileChooserViewExtensionsTest; |
| 67 | 66 |
| 68 typedef std::vector<size_t> Indexes; | 67 typedef std::vector<size_t> Indexes; |
| 69 typedef std::map<views::Button*, int> ButtonIndexes; | 68 typedef std::map<views::Button*, int> ButtonIndexes; |
| 70 typedef std::map<views::Button*, std::string> AccountButtonIndexes; | 69 typedef std::map<views::Button*, std::string> AccountButtonIndexes; |
| 71 | 70 |
| 72 ProfileChooserView(views::View* anchor_view, | 71 ProfileChooserView(views::View* anchor_view, |
| 73 Browser* browser, | 72 Browser* browser, |
| 74 profiles::BubbleViewMode view_mode, | 73 profiles::BubbleViewMode view_mode, |
| 75 profiles::TutorialMode tutorial_mode, | |
| 76 signin::GAIAServiceType service_type, | 74 signin::GAIAServiceType service_type, |
| 77 signin_metrics::AccessPoint access_point); | 75 signin_metrics::AccessPoint access_point); |
| 78 ~ProfileChooserView() override; | 76 ~ProfileChooserView() override; |
| 79 | 77 |
| 80 // views::BubbleDialogDelegateView: | 78 // views::BubbleDialogDelegateView: |
| 81 void Init() override; | 79 void Init() override; |
| 82 void OnNativeThemeChanged(const ui::NativeTheme* native_theme) override; | 80 void OnNativeThemeChanged(const ui::NativeTheme* native_theme) override; |
| 83 void WindowClosing() override; | 81 void WindowClosing() override; |
| 84 bool AcceleratorPressed(const ui::Accelerator& accelerator) override; | 82 bool AcceleratorPressed(const ui::Accelerator& accelerator) override; |
| 85 views::View* GetInitiallyFocusedView() override; | 83 views::View* GetInitiallyFocusedView() override; |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 bool is_primary_account, | 143 bool is_primary_account, |
| 146 bool reauth_required, | 144 bool reauth_required, |
| 147 int width); | 145 int width); |
| 148 | 146 |
| 149 // Creates a view to confirm account removal for |account_id_to_remove_|. | 147 // Creates a view to confirm account removal for |account_id_to_remove_|. |
| 150 views::View* CreateAccountRemovalView(); | 148 views::View* CreateAccountRemovalView(); |
| 151 | 149 |
| 152 // Removes the currently selected account and attempts to restart Chrome. | 150 // Removes the currently selected account and attempts to restart Chrome. |
| 153 void RemoveAccount(); | 151 void RemoveAccount(); |
| 154 | 152 |
| 155 // Close the tutorial card. | |
| 156 void DismissTutorial(); | |
| 157 | |
| 158 // Creates a tutorial card to introduce an upgrade user to the new avatar | |
| 159 // menu. |avatar_item| refers to the current profile. | |
| 160 views::View* CreateWelcomeUpgradeTutorialView( | |
| 161 const AvatarMenu::Item& avatar_item); | |
| 162 | |
| 163 // Creates a tutorial card to have the user confirm the last Chrome signin, | |
| 164 // Chrome sync will be delayed until the user either dismisses the tutorial, | |
| 165 // or configures sync through the "Settings" link. | |
| 166 views::View* CreateSigninConfirmationView(); | |
| 167 | |
| 168 // Creates a tutorial card to show the errors in the last Chrome signin. | |
| 169 views::View* CreateSigninErrorView(); | |
| 170 | |
| 171 views::View* CreateTutorialViewIfNeeded(const AvatarMenu::Item& item); | |
| 172 | |
| 173 // Creates a tutorial card. If |stack_button| is true, places the button above | |
| 174 // the link otherwise places both on the same row with the link left aligned | |
| 175 // and button right aligned. The method sets |link| to point to the newly | |
| 176 // create link, |button| to the newly created button, and |tutorial_mode_| to | |
| 177 // the given |tutorial_mode|. | |
| 178 views::View* CreateTutorialView( | |
| 179 profiles::TutorialMode tutorial_mode, | |
| 180 const base::string16& title_text, | |
| 181 const base::string16& content_text, | |
| 182 const base::string16& link_text, | |
| 183 const base::string16& button_text, | |
| 184 bool stack_button, | |
| 185 views::Link** link, | |
| 186 views::LabelButton** button, | |
| 187 views::ImageButton** close_button); | |
| 188 | |
| 189 // Creates a header for signin and sync error surfacing for the user menu. | 153 // Creates a header for signin and sync error surfacing for the user menu. |
| 190 views::View* CreateSyncErrorViewIfNeeded(); | 154 views::View* CreateSyncErrorViewIfNeeded(); |
| 191 | 155 |
| 192 // Create a view that shows various options for an upgrade user who is not | 156 // Create a view that shows various options for an upgrade user who is not |
| 193 // the same person as the currently signed in user. | 157 // the same person as the currently signed in user. |
| 194 views::View* CreateSwitchUserView(); | 158 views::View* CreateSwitchUserView(); |
| 195 | 159 |
| 196 bool ShouldShowGoIncognito() const; | 160 bool ShouldShowGoIncognito() const; |
| 197 | 161 |
| 198 // Clean-up done after an action was performed in the ProfileChooser. | 162 // Clean-up done after an action was performed in the ProfileChooser. |
| 199 void PostActionPerformed(ProfileMetrics::ProfileDesktopMenu action_performed); | 163 void PostActionPerformed(ProfileMetrics::ProfileDesktopMenu action_performed); |
| 200 | 164 |
| 201 std::unique_ptr<AvatarMenu> avatar_menu_; | 165 std::unique_ptr<AvatarMenu> avatar_menu_; |
| 202 Browser* browser_; | 166 Browser* browser_; |
| 203 | 167 |
| 204 // Other profiles used in the "fast profile switcher" view. | 168 // Other profiles used in the "fast profile switcher" view. |
| 205 ButtonIndexes open_other_profile_indexes_map_; | 169 ButtonIndexes open_other_profile_indexes_map_; |
| 206 | 170 |
| 207 // Buttons associated with the current profile. | 171 // Buttons associated with the current profile. |
| 208 AccountButtonIndexes delete_account_button_map_; | 172 AccountButtonIndexes delete_account_button_map_; |
| 209 AccountButtonIndexes reauth_account_button_map_; | 173 AccountButtonIndexes reauth_account_button_map_; |
| 210 | 174 |
| 211 // Links and buttons displayed in the tutorial card. | |
| 212 views::LabelButton* tutorial_sync_settings_ok_button_; | |
| 213 views::Link* tutorial_sync_settings_link_; | |
| 214 views::LabelButton* tutorial_see_whats_new_button_; | |
| 215 views::Link* tutorial_not_you_link_; | |
| 216 views::Link* tutorial_learn_more_link_; | |
| 217 views::ImageButton* tutorial_close_button_; | |
| 218 | |
| 219 // Buttons in the signin/sync error header on top of the desktop user menu. | 175 // Buttons in the signin/sync error header on top of the desktop user menu. |
| 220 views::LabelButton* sync_error_signin_button_; | 176 views::LabelButton* sync_error_signin_button_; |
| 221 views::LabelButton* sync_error_passphrase_button_; | 177 views::LabelButton* sync_error_passphrase_button_; |
| 222 views::LabelButton* sync_error_upgrade_button_; | 178 views::LabelButton* sync_error_upgrade_button_; |
| 223 views::LabelButton* sync_error_signin_again_button_; | 179 views::LabelButton* sync_error_signin_again_button_; |
| 224 views::LabelButton* sync_error_signout_button_; | 180 views::LabelButton* sync_error_signout_button_; |
| 225 | 181 |
| 226 // Links and buttons displayed in the active profile card. | 182 // Links and buttons displayed in the active profile card. |
| 227 views::Link* manage_accounts_link_; | 183 views::Link* manage_accounts_link_; |
| 228 views::LabelButton* manage_accounts_button_; | 184 views::LabelButton* manage_accounts_button_; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 253 views::LabelButton* add_person_button_; | 209 views::LabelButton* add_person_button_; |
| 254 views::LabelButton* disconnect_button_; | 210 views::LabelButton* disconnect_button_; |
| 255 views::ImageButton* switch_user_cancel_button_; | 211 views::ImageButton* switch_user_cancel_button_; |
| 256 | 212 |
| 257 // Records the account id to remove. | 213 // Records the account id to remove. |
| 258 std::string account_id_to_remove_; | 214 std::string account_id_to_remove_; |
| 259 | 215 |
| 260 // Active view mode. | 216 // Active view mode. |
| 261 profiles::BubbleViewMode view_mode_; | 217 profiles::BubbleViewMode view_mode_; |
| 262 | 218 |
| 263 // The current tutorial mode. | |
| 264 profiles::TutorialMode tutorial_mode_; | |
| 265 | |
| 266 // The GAIA service type provided in the response header. | 219 // The GAIA service type provided in the response header. |
| 267 signin::GAIAServiceType gaia_service_type_; | 220 signin::GAIAServiceType gaia_service_type_; |
| 268 | 221 |
| 269 // The current access point of sign in. | 222 // The current access point of sign in. |
| 270 const signin_metrics::AccessPoint access_point_; | 223 const signin_metrics::AccessPoint access_point_; |
| 271 | 224 |
| 272 DISALLOW_COPY_AND_ASSIGN(ProfileChooserView); | 225 DISALLOW_COPY_AND_ASSIGN(ProfileChooserView); |
| 273 }; | 226 }; |
| 274 | 227 |
| 275 #endif // CHROME_BROWSER_UI_VIEWS_PROFILES_PROFILE_CHOOSER_VIEW_H_ | 228 #endif // CHROME_BROWSER_UI_VIEWS_PROFILES_PROFILE_CHOOSER_VIEW_H_ |
| OLD | NEW |