OLD | NEW |
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_info_cache_observer.h" | 8 #include "chrome/browser/profiles/profile_attributes_storage.h" |
9 #include "ui/views/window/non_client_view.h" | 9 #include "ui/views/window/non_client_view.h" |
10 | 10 |
11 class AvatarMenuButton; | 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 ProfileInfoCacheObserver { | 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_; } | 25 AvatarMenuButton* avatar_button() const { return avatar_button_; } |
26 | 26 |
27 // Called when BrowserView creates all it's child views. | 27 // Called when BrowserView creates all it's child views. |
28 virtual void OnBrowserViewInitViewsComplete(); | 28 virtual void OnBrowserViewInitViewsComplete(); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 #endif | 72 #endif |
73 | 73 |
74 // Update the profile switcher button if one should exist. Otherwise, update | 74 // Update the profile switcher button if one should exist. Otherwise, update |
75 // the incognito avatar, or profile avatar for teleported frames in ChromeOS. | 75 // the incognito avatar, or profile avatar for teleported frames in ChromeOS. |
76 virtual void UpdateAvatar() = 0; | 76 virtual void UpdateAvatar() = 0; |
77 | 77 |
78 // Updates the title and icon of the old avatar button. | 78 // Updates the title and icon of the old avatar button. |
79 void UpdateOldAvatarButton(); | 79 void UpdateOldAvatarButton(); |
80 | 80 |
81 private: | 81 private: |
82 // Overriden from ProfileInfoCacheObserver. | 82 // Overriden from ProfileAttributesStorage::Observer. |
83 void OnProfileAdded(const base::FilePath& profile_path) override; | 83 void OnProfileAdded(const base::FilePath& profile_path) override; |
84 void OnProfileWasRemoved(const base::FilePath& profile_path, | 84 void OnProfileWasRemoved(const base::FilePath& profile_path, |
85 const base::string16& profile_name) override; | 85 const base::string16& profile_name) override; |
86 void OnProfileAvatarChanged(const base::FilePath& profile_path) override; | 86 void OnProfileAvatarChanged(const base::FilePath& profile_path) override; |
87 | 87 |
88 // Draws a taskbar icon if avatars are enabled, erases it otherwise. | 88 // Draws a taskbar icon if avatars are enabled, erases it otherwise. |
89 void UpdateTaskbarDecoration(); | 89 void UpdateTaskbarDecoration(); |
90 | 90 |
91 // The frame that hosts this view. | 91 // The frame that hosts this view. |
92 BrowserFrame* frame_; | 92 BrowserFrame* frame_; |
93 | 93 |
94 // The BrowserView hosted within this View. | 94 // The BrowserView hosted within this View. |
95 BrowserView* browser_view_; | 95 BrowserView* browser_view_; |
96 | 96 |
97 // Menu button that displays the incognito icon. May be null for some frame | 97 // Menu button that displays the incognito icon. May be null for some frame |
98 // styles. TODO(anthonyvd): simplify/rename. | 98 // styles. TODO(anthonyvd): simplify/rename. |
99 AvatarMenuButton* avatar_button_; | 99 AvatarMenuButton* avatar_button_ = nullptr; |
100 }; | 100 }; |
101 | 101 |
102 namespace chrome { | 102 namespace chrome { |
103 | 103 |
104 // Provided by a browser_non_client_frame_view_factory_*.cc implementation | 104 // Provided by a browser_non_client_frame_view_factory_*.cc implementation |
105 BrowserNonClientFrameView* CreateBrowserNonClientFrameView( | 105 BrowserNonClientFrameView* CreateBrowserNonClientFrameView( |
106 BrowserFrame* frame, BrowserView* browser_view); | 106 BrowserFrame* frame, BrowserView* browser_view); |
107 | 107 |
108 } // namespace chrome | 108 } // namespace chrome |
109 | 109 |
110 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_NON_CLIENT_FRAME_VIEW_H_ | 110 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_NON_CLIENT_FRAME_VIEW_H_ |
OLD | NEW |