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

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

Issue 1136693002: Chrome user menu shouldn't close if a tab steals focus (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address roger's comments Created 5 years, 7 months 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
OLDNEW
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 19 matching lines...) Expand all
30 30
31 namespace views { 31 namespace views {
32 class GridLayout; 32 class GridLayout;
33 class ImageButton; 33 class ImageButton;
34 class Link; 34 class Link;
35 class LabelButton; 35 class LabelButton;
36 } 36 }
37 37
38 class Browser; 38 class Browser;
39 39
40 enum ShowingType {
Roger Tawa OOO till Jul 10th 2015/05/15 14:29:17 Please add a comment explaining how this is used.
gogerald1 2015/05/19 23:35:12 Done.
41 IS_NOT_SHOWING = 0,
42 IS_SHOWING = 1,
43 IS_SHOWING_IN_ANOTHER_BROWSER = 2,
44 };
45
40 // This bubble view is displayed when the user clicks on the avatar button. 46 // This bubble view is displayed when the user clicks on the avatar button.
41 // It displays a list of profiles and allows users to switch between profiles. 47 // It displays a list of profiles and allows users to switch between profiles.
42 class ProfileChooserView : public content::WebContentsDelegate, 48 class ProfileChooserView : public content::WebContentsDelegate,
43 public views::BubbleDelegateView, 49 public views::BubbleDelegateView,
44 public views::ButtonListener, 50 public views::ButtonListener,
45 public views::LinkListener, 51 public views::LinkListener,
46 public views::StyledLabelListener, 52 public views::StyledLabelListener,
47 public views::TextfieldController, 53 public views::TextfieldController,
48 public AvatarMenuObserver, 54 public AvatarMenuObserver,
49 public OAuth2TokenService::Observer { 55 public OAuth2TokenService::Observer {
50 public: 56 public:
51 // Shows the bubble if one is not already showing. This allows us to easily 57 // Shows the bubble if one is not already showing. This allows us to easily
52 // make a button toggle the bubble on and off when clicked: we unconditionally 58 // make a button toggle the bubble on and off when clicked: we unconditionally
53 // call this function when the button is clicked and if the bubble isn't 59 // call this function when the button is clicked and if the bubble isn't
54 // showing it will appear while if it is showing, nothing will happen here and 60 // showing it will appear while if it is showing, nothing will happen here and
55 // the existing bubble will auto-close due to focus loss. 61 // the existing bubble will auto-close due to focus loss.
56 static void ShowBubble( 62 static void ShowBubble(
57 profiles::BubbleViewMode view_mode, 63 profiles::BubbleViewMode view_mode,
58 profiles::TutorialMode tutorial_mode, 64 profiles::TutorialMode tutorial_mode,
59 const signin::ManageAccountsParams& manage_accounts_params, 65 const signin::ManageAccountsParams& manage_accounts_params,
60 views::View* anchor_view, 66 views::View* anchor_view,
61 views::BubbleBorder::Arrow arrow, 67 views::BubbleBorder::Arrow arrow,
62 views::BubbleBorder::BubbleAlignment border_alignment, 68 views::BubbleBorder::BubbleAlignment border_alignment,
63 Browser* browser); 69 Browser* browser);
64 static bool IsShowing(); 70 static bool IsShowing();
71 static ShowingType IsShowingInBrowser(const Browser* browser);
65 static void Hide(); 72 static void Hide();
66 73
67 private: 74 private:
68 friend class ProfileChooserViewExtensionsTest; 75 friend class ProfileChooserViewExtensionsTest;
69 76
70 typedef std::vector<size_t> Indexes; 77 typedef std::vector<size_t> Indexes;
71 typedef std::map<views::Button*, int> ButtonIndexes; 78 typedef std::map<views::Button*, int> ButtonIndexes;
72 typedef std::map<views::Button*, std::string> AccountButtonIndexes; 79 typedef std::map<views::Button*, std::string> AccountButtonIndexes;
73 80
74 ProfileChooserView(views::View* anchor_view, 81 ProfileChooserView(views::View* anchor_view,
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 // The current tutorial mode. 268 // The current tutorial mode.
262 profiles::TutorialMode tutorial_mode_; 269 profiles::TutorialMode tutorial_mode_;
263 270
264 // The GAIA service type provided in the response header. 271 // The GAIA service type provided in the response header.
265 signin::GAIAServiceType gaia_service_type_; 272 signin::GAIAServiceType gaia_service_type_;
266 273
267 DISALLOW_COPY_AND_ASSIGN(ProfileChooserView); 274 DISALLOW_COPY_AND_ASSIGN(ProfileChooserView);
268 }; 275 };
269 276
270 #endif // CHROME_BROWSER_UI_VIEWS_PROFILES_PROFILE_CHOOSER_VIEW_H_ 277 #endif // CHROME_BROWSER_UI_VIEWS_PROFILES_PROFILE_CHOOSER_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698