Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(468)

Side by Side Diff: chrome/browser/ui/views/profile_chooser_view.h

Issue 58183002: Auto refresh avatar bubble after adding a secondary account (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: move initialization of view_mode_ to constructor Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/ui/views/profile_chooser_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_PROFILE_CHOOSER_VIEW_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_PROFILE_CHOOSER_VIEW_H_
6 #define CHROME_BROWSER_UI_VIEWS_PROFILE_CHOOSER_VIEW_H_ 6 #define CHROME_BROWSER_UI_VIEWS_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 "google_apis/gaia/oauth2_token_service.h"
13 #include "ui/views/bubble/bubble_delegate.h" 14 #include "ui/views/bubble/bubble_delegate.h"
14 #include "ui/views/controls/button/button.h" 15 #include "ui/views/controls/button/button.h"
15 #include "ui/views/controls/link_listener.h" 16 #include "ui/views/controls/link_listener.h"
16 #include "ui/views/controls/styled_label_listener.h" 17 #include "ui/views/controls/styled_label_listener.h"
17 18
18 namespace gfx { 19 namespace gfx {
19 class Image; 20 class Image;
20 } 21 }
21 22
22 namespace views { 23 namespace views {
23 class Link; 24 class Link;
24 class TextButton; 25 class TextButton;
25 class LabelButton; 26 class LabelButton;
26 } 27 }
27 28
28 class Browser; 29 class Browser;
29 class ProfileItemView; 30 class ProfileItemView;
30 31
31 // This bubble view is displayed when the user clicks on the avatar button. 32 // This bubble view is displayed when the user clicks on the avatar button.
32 // It displays a list of profiles and allows users to switch between profiles. 33 // It displays a list of profiles and allows users to switch between profiles.
33 class ProfileChooserView : public views::BubbleDelegateView, 34 class ProfileChooserView : public views::BubbleDelegateView,
34 public views::ButtonListener, 35 public views::ButtonListener,
35 public views::LinkListener, 36 public views::LinkListener,
36 public AvatarMenuObserver { 37 public AvatarMenuObserver,
38 public OAuth2TokenService::Observer {
37 public: 39 public:
38 // Shows the bubble if one is not already showing. This allows us to easily 40 // Shows the bubble if one is not already showing. This allows us to easily
39 // make a button toggle the bubble on and off when clicked: we unconditionally 41 // make a button toggle the bubble on and off when clicked: we unconditionally
40 // call this function when the button is clicked and if the bubble isn't 42 // call this function when the button is clicked and if the bubble isn't
41 // showing it will appear while if it is showing, nothing will happen here and 43 // showing it will appear while if it is showing, nothing will happen here and
42 // the existing bubble will auto-close due to focus loss. 44 // the existing bubble will auto-close due to focus loss.
43 static void ShowBubble(views::View* anchor_view, 45 static void ShowBubble(views::View* anchor_view,
44 views::BubbleBorder::Arrow arrow, 46 views::BubbleBorder::Arrow arrow,
45 views::BubbleBorder::BubbleAlignment border_alignment, 47 views::BubbleBorder::BubbleAlignment border_alignment,
46 const gfx::Rect& anchor_rect, 48 const gfx::Rect& anchor_rect,
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 // ButtonListener: 85 // ButtonListener:
84 virtual void ButtonPressed(views::Button* sender, 86 virtual void ButtonPressed(views::Button* sender,
85 const ui::Event& event) OVERRIDE; 87 const ui::Event& event) OVERRIDE;
86 88
87 // LinkListener: 89 // LinkListener:
88 virtual void LinkClicked(views::Link* sender, int event_flags) OVERRIDE; 90 virtual void LinkClicked(views::Link* sender, int event_flags) OVERRIDE;
89 91
90 // AvatarMenuObserver: 92 // AvatarMenuObserver:
91 virtual void OnAvatarMenuChanged(AvatarMenu* avatar_menu) OVERRIDE; 93 virtual void OnAvatarMenuChanged(AvatarMenu* avatar_menu) OVERRIDE;
92 94
95 // OAuth2TokenService::Observer overrides.
96 virtual void OnRefreshTokenAvailable(const std::string& account_id) OVERRIDE;
97 virtual void OnRefreshTokenRevoked(const std::string& account_id) OVERRIDE;
98
93 static ProfileChooserView* profile_bubble_; 99 static ProfileChooserView* profile_bubble_;
94 static bool close_on_deactivate_; 100 static bool close_on_deactivate_;
95 101
96 void ResetLinksAndButtons(); 102 void ResetLinksAndButtons();
97 103
98 // Shows either the profile chooser or the account management views. 104 // Shows either the profile chooser or the account management views.
99 void ShowView(BubbleViewMode view_to_display, 105 void ShowView(BubbleViewMode view_to_display,
100 AvatarMenu* avatar_menu); 106 AvatarMenu* avatar_menu);
101 107
102 // Creates the main profile card for the profile |avatar_item|. |is_guest| 108 // Creates the main profile card for the profile |avatar_item|. |is_guest|
(...skipping 24 matching lines...) Expand all
127 views::Link* signin_current_profile_link_; 133 views::Link* signin_current_profile_link_;
128 views::Link* change_photo_link_; 134 views::Link* change_photo_link_;
129 135
130 // Action buttons. 136 // Action buttons.
131 views::TextButton* guest_button_; 137 views::TextButton* guest_button_;
132 views::TextButton* end_guest_button_; 138 views::TextButton* end_guest_button_;
133 views::TextButton* add_user_button_; 139 views::TextButton* add_user_button_;
134 views::TextButton* users_button_; 140 views::TextButton* users_button_;
135 views::LabelButton* add_account_button_; 141 views::LabelButton* add_account_button_;
136 142
143 // Active view mode.
144 BubbleViewMode view_mode_;
145
137 DISALLOW_COPY_AND_ASSIGN(ProfileChooserView); 146 DISALLOW_COPY_AND_ASSIGN(ProfileChooserView);
138 }; 147 };
139 148
140 #endif // CHROME_BROWSER_UI_VIEWS_PROFILE_CHOOSER_VIEW_H_ 149 #endif // CHROME_BROWSER_UI_VIEWS_PROFILE_CHOOSER_VIEW_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/views/profile_chooser_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698