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/ui/views/profiles/new_avatar_button.h" | 8 #include "chrome/browser/ui/views/profiles/new_avatar_button.h" |
9 #include "ui/views/window/non_client_view.h" | 9 #include "ui/views/window/non_client_view.h" |
10 | 10 |
11 #if defined(ENABLE_MANAGED_USERS) | 11 #if defined(ENABLE_MANAGED_USERS) |
12 class SupervisedUserAvatarLabel; | 12 class SupervisedUserAvatarLabel; |
13 #endif | 13 #endif |
14 class AvatarMenuButton; | 14 class AvatarMenuButton; |
15 class BrowserFrame; | 15 class BrowserFrame; |
16 class BrowserView; | 16 class BrowserView; |
17 class NewAvatarButton; | 17 class NewAvatarButton; |
18 | 18 |
19 // A specialization of the NonClientFrameView object that provides additional | 19 // A specialization of the NonClientFrameView object that provides additional |
20 // Browser-specific methods. | 20 // Browser-specific methods. |
21 class BrowserNonClientFrameView : public views::NonClientFrameView { | 21 class BrowserNonClientFrameView : public views::NonClientFrameView, |
| 22 public ProfileInfoCacheObserver { |
22 public: | 23 public: |
23 BrowserNonClientFrameView(BrowserFrame* frame, BrowserView* browser_view); | 24 BrowserNonClientFrameView(BrowserFrame* frame, BrowserView* browser_view); |
24 virtual ~BrowserNonClientFrameView(); | 25 virtual ~BrowserNonClientFrameView(); |
25 | 26 |
26 AvatarMenuButton* avatar_button() const { return avatar_button_; } | 27 AvatarMenuButton* avatar_button() const { return avatar_button_; } |
27 | 28 |
28 NewAvatarButton* new_avatar_button() const { return new_avatar_button_; } | 29 NewAvatarButton* new_avatar_button() const { return new_avatar_button_; } |
29 | 30 |
30 #if defined(ENABLE_MANAGED_USERS) | 31 #if defined(ENABLE_MANAGED_USERS) |
31 SupervisedUserAvatarLabel* supervised_user_avatar_label() const { | 32 SupervisedUserAvatarLabel* supervised_user_avatar_label() const { |
(...skipping 30 matching lines...) Expand all Loading... |
62 // Updates the title and icon of the avatar button. | 63 // Updates the title and icon of the avatar button. |
63 void UpdateAvatarInfo(); | 64 void UpdateAvatarInfo(); |
64 | 65 |
65 // Updates the title of the avatar button displayed in the caption area. | 66 // Updates the title of the avatar button displayed in the caption area. |
66 // The button uses |style| to match the browser window style and notifies | 67 // The button uses |style| to match the browser window style and notifies |
67 // |listener| when it is clicked. | 68 // |listener| when it is clicked. |
68 void UpdateNewStyleAvatarInfo(views::ButtonListener* listener, | 69 void UpdateNewStyleAvatarInfo(views::ButtonListener* listener, |
69 const NewAvatarButton::AvatarButtonStyle style); | 70 const NewAvatarButton::AvatarButtonStyle style); |
70 | 71 |
71 private: | 72 private: |
| 73 // Draws a taskbar icon if avatar are enabled, erases it otherwise. If |
| 74 // |taskbar_badge_avatar| is NULL, then |avatar| is used. |
| 75 void DrawTaskbarDecoration(const gfx::Image& avatar, |
| 76 const gfx::Image& taskbar_badge_avatar); |
| 77 |
| 78 // Overriden from ProfileInfoCacheObserver. |
| 79 void OnProfileAvatarChanged(const base::FilePath& profile_path) override; |
| 80 |
72 // The frame that hosts this view. | 81 // The frame that hosts this view. |
73 BrowserFrame* frame_; | 82 BrowserFrame* frame_; |
74 | 83 |
75 // The BrowserView hosted within this View. | 84 // The BrowserView hosted within this View. |
76 BrowserView* browser_view_; | 85 BrowserView* browser_view_; |
77 | 86 |
78 // Menu button that displays that either the incognito icon or the profile | 87 // Menu button that displays that either the incognito icon or the profile |
79 // icon. May be NULL for some frame styles. | 88 // icon. May be NULL for some frame styles. |
80 AvatarMenuButton* avatar_button_; | 89 AvatarMenuButton* avatar_button_; |
81 | 90 |
82 #if defined(ENABLE_MANAGED_USERS) | 91 #if defined(ENABLE_MANAGED_USERS) |
83 SupervisedUserAvatarLabel* supervised_user_avatar_label_; | 92 SupervisedUserAvatarLabel* supervised_user_avatar_label_; |
84 #endif | 93 #endif |
85 | 94 |
86 // Menu button that displays the name of the active or guest profile. | 95 // Menu button that displays the name of the active or guest profile. |
87 // May be NULL and will not be displayed for off the record profiles. | 96 // May be NULL and will not be displayed for off the record profiles. |
88 NewAvatarButton* new_avatar_button_; | 97 NewAvatarButton* new_avatar_button_; |
89 }; | 98 }; |
90 | 99 |
91 namespace chrome { | 100 namespace chrome { |
92 | 101 |
93 // Provided by a browser_non_client_frame_view_factory_*.cc implementation | 102 // Provided by a browser_non_client_frame_view_factory_*.cc implementation |
94 BrowserNonClientFrameView* CreateBrowserNonClientFrameView( | 103 BrowserNonClientFrameView* CreateBrowserNonClientFrameView( |
95 BrowserFrame* frame, BrowserView* browser_view); | 104 BrowserFrame* frame, BrowserView* browser_view); |
96 | 105 |
97 } // namespace chrome | 106 } // namespace chrome |
98 | 107 |
99 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_NON_CLIENT_FRAME_VIEW_H_ | 108 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_NON_CLIENT_FRAME_VIEW_H_ |
OLD | NEW |