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

Side by Side Diff: chrome/browser/ui/views/frame/browser_non_client_frame_view.h

Issue 1972033002: Simplify some old avatar menu button code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix test Created 4 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_FRAME_BROWSER_NON_CLIENT_FRAME_VIEW_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_NON_CLIENT_FRAME_VIEW_H_
6 #define CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_NON_CLIENT_FRAME_VIEW_H_ 6 #define CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_NON_CLIENT_FRAME_VIEW_H_
7 7
8 #include "chrome/browser/profiles/profile_attributes_storage.h" 8 #include "chrome/browser/profiles/profile_attributes_storage.h"
9 #include "chrome/browser/ui/views/profiles/profile_indicator_icon.h"
9 #include "ui/views/window/non_client_view.h" 10 #include "ui/views/window/non_client_view.h"
10 11
11 class AvatarMenuButton;
12 class BrowserFrame; 12 class BrowserFrame;
13 class BrowserView; 13 class BrowserView;
14 14
15 // A specialization of the NonClientFrameView object that provides additional 15 // A specialization of the NonClientFrameView object that provides additional
16 // Browser-specific methods. 16 // Browser-specific methods.
17 class BrowserNonClientFrameView : public views::NonClientFrameView, 17 class BrowserNonClientFrameView : public views::NonClientFrameView,
18 public ProfileAttributesStorage::Observer { 18 public ProfileAttributesStorage::Observer {
19 public: 19 public:
20 BrowserNonClientFrameView(BrowserFrame* frame, BrowserView* browser_view); 20 BrowserNonClientFrameView(BrowserFrame* frame, BrowserView* browser_view);
21 ~BrowserNonClientFrameView() override; 21 ~BrowserNonClientFrameView() override;
22 22
23 BrowserView* browser_view() const { return browser_view_; } 23 BrowserView* browser_view() const { return browser_view_; }
24 BrowserFrame* frame() const { return frame_; } 24 BrowserFrame* frame() const { return frame_; }
25 AvatarMenuButton* avatar_button() const { return avatar_button_; }
26 25
27 // Called when BrowserView creates all it's child views. 26 // Called when BrowserView creates all it's child views.
28 virtual void OnBrowserViewInitViewsComplete(); 27 virtual void OnBrowserViewInitViewsComplete();
29 28
30 // Retrieves the bounds, in non-client view coordinates within which the 29 // Retrieves the bounds, in non-client view coordinates within which the
31 // TabStrip should be laid out. 30 // TabStrip should be laid out.
32 virtual gfx::Rect GetBoundsForTabStrip(views::View* tabstrip) const = 0; 31 virtual gfx::Rect GetBoundsForTabStrip(views::View* tabstrip) const = 0;
33 32
34 // Returns the inset of the topmost view in the client view from the top of 33 // Returns the inset of the topmost view in the client view from the top of
35 // the non-client view. The topmost view depends on the window type. The 34 // the non-client view. The topmost view depends on the window type. The
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 SkColor GetFrameColor(bool active) const; 74 SkColor GetFrameColor(bool active) const;
76 gfx::ImageSkia GetFrameImage(bool active) const; 75 gfx::ImageSkia GetFrameImage(bool active) const;
77 gfx::ImageSkia GetFrameOverlayImage(bool active) const; 76 gfx::ImageSkia GetFrameOverlayImage(bool active) const;
78 77
79 // Convenience versions of the above which use ShouldPaintAsActive() for 78 // Convenience versions of the above which use ShouldPaintAsActive() for
80 // |active|. 79 // |active|.
81 SkColor GetFrameColor() const; 80 SkColor GetFrameColor() const;
82 gfx::ImageSkia GetFrameImage() const; 81 gfx::ImageSkia GetFrameImage() const;
83 gfx::ImageSkia GetFrameOverlayImage() const; 82 gfx::ImageSkia GetFrameOverlayImage() const;
84 83
85 // Update the profile switcher button if one should exist. Otherwise, update 84 // Update the profile switcher button if one should exist. Otherwise, update
Peter Kasting 2016/05/17 03:51:42 Nit: While here: Update -> Updates (2 places)
Evan Stade 2016/05/17 18:13:09 Done.
86 // the incognito avatar, or profile avatar for teleported frames in ChromeOS. 85 // the icon that indicates incognito (or a teleported window in ChromeOS).
87 virtual void UpdateAvatar() = 0; 86 virtual void UpdateProfileIcons() = 0;
88 87
89 // Updates the title and icon of the old avatar button. 88 // Updates the icon that indicates incognito/teleportation state.
90 void UpdateOldAvatarButton(); 89 void UpdateProfileIndicatorIcon();
90
91 views::View* profile_indicator() const { return profile_indicator_; }
Peter Kasting 2016/05/17 03:51:42 Const accessors shouldn't return non-const pointer
Evan Stade 2016/05/17 18:13:09 Done.
91 92
92 private: 93 private:
93 // views::NonClientFrameView: 94 // views::NonClientFrameView:
94 void ViewHierarchyChanged( 95 void ViewHierarchyChanged(
95 const ViewHierarchyChangedDetails& details) override; 96 const ViewHierarchyChangedDetails& details) override;
96 void ActivationChanged(bool active) override; 97 void ActivationChanged(bool active) override;
97 98
98 // ProfileAttributesStorage::Observer: 99 // ProfileAttributesStorage::Observer:
99 void OnProfileAdded(const base::FilePath& profile_path) override; 100 void OnProfileAdded(const base::FilePath& profile_path) override;
100 void OnProfileWasRemoved(const base::FilePath& profile_path, 101 void OnProfileWasRemoved(const base::FilePath& profile_path,
101 const base::string16& profile_name) override; 102 const base::string16& profile_name) override;
102 void OnProfileAvatarChanged(const base::FilePath& profile_path) override; 103 void OnProfileAvatarChanged(const base::FilePath& profile_path) override;
103 104
104 // Gets a theme provider that should be non-null even before we're added to a 105 // Gets a theme provider that should be non-null even before we're added to a
105 // view hierarchy. 106 // view hierarchy.
106 const ui::ThemeProvider* GetThemeProviderForProfile() const; 107 const ui::ThemeProvider* GetThemeProviderForProfile() const;
107 108
108 // Draws a taskbar icon if avatars are enabled, erases it otherwise. 109 // Draws a taskbar icon if avatars are enabled, erases it otherwise.
109 void UpdateTaskbarDecoration(); 110 void UpdateTaskbarDecoration();
110 111
111 // The frame that hosts this view. 112 // The frame that hosts this view.
112 BrowserFrame* frame_; 113 BrowserFrame* frame_;
113 114
114 // The BrowserView hosted within this View. 115 // The BrowserView hosted within this View.
115 BrowserView* browser_view_; 116 BrowserView* browser_view_;
116 117
117 // Menu button that displays the incognito icon. May be null for some frame 118 // On desktop, this is used to show an incognito indicator. On CrOS, it's also
Peter Kasting 2016/05/17 03:51:42 Nit: indicator -> icon?
Evan Stade 2016/05/17 18:13:09 Done.
118 // styles. TODO(anthonyvd): simplify/rename. 119 // used for teleported windows (in multi-profile mode).
119 AvatarMenuButton* avatar_button_ = nullptr; 120 ProfileIndicatorIcon* profile_indicator_ = nullptr;
Peter Kasting 2016/05/17 03:51:42 Nit: I would make the type name and member name ma
Evan Stade 2016/05/17 18:13:09 done
120 121
121 DISALLOW_COPY_AND_ASSIGN(BrowserNonClientFrameView); 122 DISALLOW_COPY_AND_ASSIGN(BrowserNonClientFrameView);
122 }; 123 };
123 124
124 namespace chrome { 125 namespace chrome {
125 126
126 // Provided by a browser_non_client_frame_view_factory_*.cc implementation 127 // Provided by a browser_non_client_frame_view_factory_*.cc implementation
127 BrowserNonClientFrameView* CreateBrowserNonClientFrameView( 128 BrowserNonClientFrameView* CreateBrowserNonClientFrameView(
128 BrowserFrame* frame, BrowserView* browser_view); 129 BrowserFrame* frame, BrowserView* browser_view);
129 130
130 } // namespace chrome 131 } // namespace chrome
131 132
132 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_NON_CLIENT_FRAME_VIEW_H_ 133 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_NON_CLIENT_FRAME_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698