| 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> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "chrome/browser/profiles/avatar_menu.h" | 14 #include "chrome/browser/profiles/avatar_menu.h" |
| 15 #include "chrome/browser/profiles/avatar_menu_observer.h" | 15 #include "chrome/browser/profiles/avatar_menu_observer.h" |
| 16 #include "chrome/browser/profiles/profile_metrics.h" | 16 #include "chrome/browser/profiles/profile_metrics.h" |
| 17 #include "chrome/browser/ui/browser_window.h" | 17 #include "chrome/browser/ui/browser_window.h" |
| 18 #include "chrome/browser/ui/profile_chooser_constants.h" | 18 #include "chrome/browser/ui/profile_chooser_constants.h" |
| 19 #include "components/signin/core/browser/signin_header_helper.h" | 19 #include "components/signin/core/browser/signin_header_helper.h" |
| 20 #include "content/public/browser/web_contents_delegate.h" | 20 #include "content/public/browser/web_contents_delegate.h" |
| 21 #include "google_apis/gaia/oauth2_token_service.h" | 21 #include "google_apis/gaia/oauth2_token_service.h" |
| 22 #include "ui/views/bubble/bubble_dialog_delegate.h" | 22 #include "ui/views/bubble/bubble_dialog_delegate.h" |
| 23 #include "ui/views/controls/button/button.h" | 23 #include "ui/views/controls/button/image_button.h" |
| 24 #include "ui/views/controls/link_listener.h" | 24 #include "ui/views/controls/link_listener.h" |
| 25 #include "ui/views/controls/styled_label_listener.h" | 25 #include "ui/views/controls/styled_label_listener.h" |
| 26 | 26 |
| 27 namespace views { | 27 namespace views { |
| 28 class GridLayout; | 28 class GridLayout; |
| 29 class ImageButton; | |
| 30 class Link; | 29 class Link; |
| 31 class LabelButton; | 30 class LabelButton; |
| 32 } | 31 } |
| 33 | 32 |
| 34 class Browser; | 33 class Browser; |
| 35 | 34 |
| 36 // This bubble view is displayed when the user clicks on the avatar button. | 35 // This bubble view is displayed when the user clicks on the avatar button. |
| 37 // It displays a list of profiles and allows users to switch between profiles. | 36 // It displays a list of profiles and allows users to switch between profiles. |
| 38 class ProfileChooserView : public content::WebContentsDelegate, | 37 class ProfileChooserView : public content::WebContentsDelegate, |
| 39 public views::BubbleDialogDelegateView, | 38 public views::BubbleDialogDelegateView, |
| 40 public views::ButtonListener, | 39 public views::ImageButtonDelegate, |
| 41 public views::LinkListener, | 40 public views::LinkListener, |
| 42 public views::StyledLabelListener, | 41 public views::StyledLabelListener, |
| 43 public AvatarMenuObserver, | 42 public AvatarMenuObserver, |
| 44 public OAuth2TokenService::Observer { | 43 public OAuth2TokenService::Observer { |
| 45 public: | 44 public: |
| 46 // Shows the bubble if one is not already showing. This allows us to easily | 45 // 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 | 46 // 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 | 47 // 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 | 48 // 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. | 49 // the existing bubble will auto-close due to focus loss. |
| (...skipping 29 matching lines...) Expand all Loading... |
| 80 void Init() override; | 79 void Init() override; |
| 81 void OnNativeThemeChanged(const ui::NativeTheme* native_theme) override; | 80 void OnNativeThemeChanged(const ui::NativeTheme* native_theme) override; |
| 82 void WindowClosing() override; | 81 void WindowClosing() override; |
| 83 bool AcceleratorPressed(const ui::Accelerator& accelerator) override; | 82 bool AcceleratorPressed(const ui::Accelerator& accelerator) override; |
| 84 views::View* GetInitiallyFocusedView() override; | 83 views::View* GetInitiallyFocusedView() override; |
| 85 int GetDialogButtons() const override; | 84 int GetDialogButtons() const override; |
| 86 | 85 |
| 87 // content::WebContentsDelegate: | 86 // content::WebContentsDelegate: |
| 88 bool HandleContextMenu(const content::ContextMenuParams& params) override; | 87 bool HandleContextMenu(const content::ContextMenuParams& params) override; |
| 89 | 88 |
| 90 // views::ButtonListener: | 89 // views::ImageButtonDelegate: |
| 91 void ButtonPressed(views::Button* sender, const ui::Event& event) override; | 90 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
| 92 | 91 |
| 93 // views::LinkListener: | 92 // views::LinkListener: |
| 94 void LinkClicked(views::Link* sender, int event_flags) override; | 93 void LinkClicked(views::Link* sender, int event_flags) override; |
| 95 | 94 |
| 96 // views::StyledLabelListener: | 95 // views::StyledLabelListener: |
| 97 void StyledLabelLinkClicked(views::StyledLabel* label, | 96 void StyledLabelLinkClicked(views::StyledLabel* label, |
| 98 const gfx::Range& range, | 97 const gfx::Range& range, |
| 99 int event_flags) override; | 98 int event_flags) override; |
| 100 | 99 |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 // The GAIA service type provided in the response header. | 280 // The GAIA service type provided in the response header. |
| 282 signin::GAIAServiceType gaia_service_type_; | 281 signin::GAIAServiceType gaia_service_type_; |
| 283 | 282 |
| 284 // The current access point of sign in. | 283 // The current access point of sign in. |
| 285 const signin_metrics::AccessPoint access_point_; | 284 const signin_metrics::AccessPoint access_point_; |
| 286 | 285 |
| 287 DISALLOW_COPY_AND_ASSIGN(ProfileChooserView); | 286 DISALLOW_COPY_AND_ASSIGN(ProfileChooserView); |
| 288 }; | 287 }; |
| 289 | 288 |
| 290 #endif // CHROME_BROWSER_UI_VIEWS_PROFILES_PROFILE_CHOOSER_VIEW_H_ | 289 #endif // CHROME_BROWSER_UI_VIEWS_PROFILES_PROFILE_CHOOSER_VIEW_H_ |
| OLD | NEW |