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/profiles/profile_metrics.h" |
14 #include "chrome/browser/ui/browser_window.h" | 14 #include "chrome/browser/ui/browser_window.h" |
15 #include "chrome/browser/ui/profile_chooser_constants.h" | 15 #include "chrome/browser/ui/profile_chooser_constants.h" |
16 #include "content/public/browser/web_contents_delegate.h" | |
16 #include "google_apis/gaia/oauth2_token_service.h" | 17 #include "google_apis/gaia/oauth2_token_service.h" |
17 #include "ui/views/bubble/bubble_delegate.h" | 18 #include "ui/views/bubble/bubble_delegate.h" |
18 #include "ui/views/controls/button/button.h" | 19 #include "ui/views/controls/button/button.h" |
19 #include "ui/views/controls/link_listener.h" | 20 #include "ui/views/controls/link_listener.h" |
20 #include "ui/views/controls/styled_label_listener.h" | 21 #include "ui/views/controls/styled_label_listener.h" |
21 #include "ui/views/controls/textfield/textfield_controller.h" | 22 #include "ui/views/controls/textfield/textfield_controller.h" |
22 | 23 |
23 class EditableProfilePhoto; | 24 class EditableProfilePhoto; |
24 class EditableProfileName; | 25 class EditableProfileName; |
25 | 26 |
26 namespace gfx { | 27 namespace gfx { |
27 class Image; | 28 class Image; |
28 } | 29 } |
29 | 30 |
30 namespace views { | 31 namespace views { |
31 class GridLayout; | 32 class GridLayout; |
32 class ImageButton; | 33 class ImageButton; |
33 class Link; | 34 class Link; |
34 class LabelButton; | 35 class LabelButton; |
35 } | 36 } |
36 | 37 |
37 class Browser; | 38 class Browser; |
38 | 39 |
39 // This bubble view is displayed when the user clicks on the avatar button. | 40 // This bubble view is displayed when the user clicks on the avatar button. |
40 // It displays a list of profiles and allows users to switch between profiles. | 41 // It displays a list of profiles and allows users to switch between profiles. |
41 class ProfileChooserView : public views::BubbleDelegateView, | 42 class ProfileChooserView : public content::WebContentsDelegate, |
43 public views::BubbleDelegateView, | |
42 public views::ButtonListener, | 44 public views::ButtonListener, |
43 public views::LinkListener, | 45 public views::LinkListener, |
44 public views::StyledLabelListener, | 46 public views::StyledLabelListener, |
45 public views::TextfieldController, | 47 public views::TextfieldController, |
46 public AvatarMenuObserver, | 48 public AvatarMenuObserver, |
47 public OAuth2TokenService::Observer { | 49 public OAuth2TokenService::Observer { |
48 public: | 50 public: |
49 // Shows the bubble if one is not already showing. This allows us to easily | 51 // 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 | 52 // 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 | 53 // call this function when the button is clicked and if the bubble isn't |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
83 profiles::BubbleViewMode view_mode, | 85 profiles::BubbleViewMode view_mode, |
84 profiles::TutorialMode tutorial_mode, | 86 profiles::TutorialMode tutorial_mode, |
85 signin::GAIAServiceType service_type); | 87 signin::GAIAServiceType service_type); |
86 virtual ~ProfileChooserView(); | 88 virtual ~ProfileChooserView(); |
87 | 89 |
88 // views::BubbleDelegateView: | 90 // views::BubbleDelegateView: |
89 virtual void Init() override; | 91 virtual void Init() override; |
90 virtual void WindowClosing() override; | 92 virtual void WindowClosing() override; |
91 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) override; | 93 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) override; |
92 | 94 |
95 // Overridden from content::WebContentsDelegate. | |
Alexei Svitkine (slow)
2014/10/28 18:27:23
Nit: Remove "Overridden from " prefix from comment
guohui
2014/10/28 18:53:40
Done.
| |
96 bool HandleContextMenu(const content::ContextMenuParams& params) override; | |
97 | |
93 // views::ButtonListener: | 98 // views::ButtonListener: |
94 virtual void ButtonPressed(views::Button* sender, | 99 virtual void ButtonPressed(views::Button* sender, |
95 const ui::Event& event) override; | 100 const ui::Event& event) override; |
96 | 101 |
97 // views::LinkListener: | 102 // views::LinkListener: |
98 virtual void LinkClicked(views::Link* sender, int event_flags) override; | 103 virtual void LinkClicked(views::Link* sender, int event_flags) override; |
99 | 104 |
100 // views::StyledLabelListener: | 105 // views::StyledLabelListener: |
101 virtual void StyledLabelLinkClicked( | 106 virtual void StyledLabelLinkClicked( |
102 const gfx::Range& range, int event_flags) override; | 107 const gfx::Range& range, int event_flags) override; |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
251 // The current tutorial mode. | 256 // The current tutorial mode. |
252 profiles::TutorialMode tutorial_mode_; | 257 profiles::TutorialMode tutorial_mode_; |
253 | 258 |
254 // The GAIA service type provided in the response header. | 259 // The GAIA service type provided in the response header. |
255 signin::GAIAServiceType gaia_service_type_; | 260 signin::GAIAServiceType gaia_service_type_; |
256 | 261 |
257 DISALLOW_COPY_AND_ASSIGN(ProfileChooserView); | 262 DISALLOW_COPY_AND_ASSIGN(ProfileChooserView); |
258 }; | 263 }; |
259 | 264 |
260 #endif // CHROME_BROWSER_UI_VIEWS_PROFILES_PROFILE_CHOOSER_VIEW_H_ | 265 #endif // CHROME_BROWSER_UI_VIEWS_PROFILES_PROFILE_CHOOSER_VIEW_H_ |
OLD | NEW |