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
3 // found in the LICENSE file.
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_
8 #include "chrome/browser/ui/views/profiles/new_avatar_button.h"
9 #include "ui/views/window/non_client_view.h"
11 #if defined(ENABLE_MANAGED_USERS)
12 class SupervisedUserAvatarLabel;
14 class AvatarMenuButton;
17 class NewAvatarButton;
19 // A specialization of the NonClientFrameView object that provides additional
20 // Browser-specific methods.
21 class BrowserNonClientFrameView : public views::NonClientFrameView,
22 public ProfileInfoCacheObserver {
24 BrowserNonClientFrameView(BrowserFrame* frame, BrowserView* browser_view);
25 ~BrowserNonClientFrameView() override;
27 AvatarMenuButton* avatar_button() const { return avatar_button_; }
29 NewAvatarButton* new_avatar_button() const { return new_avatar_button_; }
31 #if defined(ENABLE_MANAGED_USERS)
32 SupervisedUserAvatarLabel* supervised_user_avatar_label() const {
33 return supervised_user_avatar_label_;
36 void OnThemeChanged() override;
39 // Retrieves the bounds, in non-client view coordinates within which the
40 // TabStrip should be laid out.
41 virtual gfx::Rect GetBoundsForTabStrip(views::View* tabstrip) const = 0;
43 // Returns the inset of the topmost view in the client view from the top of
44 // the non-client view. The topmost view depends on the window type. The
45 // topmost view is the tab strip for tabbed browser windows, the toolbar for
46 // popups, the web contents for app windows and varies for fullscreen windows.
47 virtual int GetTopInset() const = 0;
49 // Returns the amount that the theme background should be inset.
50 virtual int GetThemeBackgroundXInset() const = 0;
52 // Updates the throbber.
53 virtual void UpdateThrobber(bool running) = 0;
55 // Overriden from views::View.
56 void VisibilityChanged(views::View* starting_from, bool is_visible) override;
59 BrowserView* browser_view() const { return browser_view_; }
60 BrowserFrame* frame() const { return frame_; }
62 // Updates the title and icon of the avatar button.
63 void UpdateAvatarInfo();
65 // 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 // |listener| when it is clicked.
68 void UpdateNewStyleAvatarInfo(views::ButtonListener* listener,
69 const NewAvatarButton::AvatarButtonStyle style);
72 // Draws a taskbar icon if avatar are enabled, erases it otherwise. If
73 // |taskbar_badge_avatar| is NULL, then |avatar| is used.
74 void DrawTaskbarDecoration(const gfx::Image& avatar,
75 const gfx::Image& taskbar_badge_avatar);
77 // Overriden from ProfileInfoCacheObserver.
78 void OnProfileAdded(const base::FilePath& profile_path) override;
79 void OnProfileWasRemoved(const base::FilePath& profile_path,
80 const base::string16& profile_name) override;
81 void OnProfileAvatarChanged(const base::FilePath& profile_path) override;
83 // The frame that hosts this view.
86 // The BrowserView hosted within this View.
87 BrowserView* browser_view_;
89 // Menu button that displays that either the incognito icon or the profile
90 // icon. May be NULL for some frame styles.
91 AvatarMenuButton* avatar_button_;
93 #if defined(ENABLE_MANAGED_USERS)
94 SupervisedUserAvatarLabel* supervised_user_avatar_label_;
97 // Menu button that displays the name of the active or guest profile.
98 // May be NULL and will not be displayed for off the record profiles.
99 NewAvatarButton* new_avatar_button_;
104 // Provided by a browser_non_client_frame_view_factory_*.cc implementation
105 BrowserNonClientFrameView* CreateBrowserNonClientFrameView(
106 BrowserFrame* frame, BrowserView* browser_view);
108 } // namespace chrome
110 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_NON_CLIENT_FRAME_VIEW_H_