Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / ui / views / frame / browser_non_client_frame_view.h
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.
4
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_
7
8 #include "chrome/browser/ui/views/profiles/new_avatar_button.h"
9 #include "ui/views/window/non_client_view.h"
10
11 #if defined(ENABLE_MANAGED_USERS)
12 class SupervisedUserAvatarLabel;
13 #endif
14 class AvatarMenuButton;
15 class BrowserFrame;
16 class BrowserView;
17 class NewAvatarButton;
18
19 // A specialization of the NonClientFrameView object that provides additional
20 // Browser-specific methods.
21 class BrowserNonClientFrameView : public views::NonClientFrameView,
22                                   public ProfileInfoCacheObserver {
23  public:
24   BrowserNonClientFrameView(BrowserFrame* frame, BrowserView* browser_view);
25   ~BrowserNonClientFrameView() override;
26
27   AvatarMenuButton* avatar_button() const { return avatar_button_; }
28
29   NewAvatarButton* new_avatar_button() const { return new_avatar_button_; }
30
31 #if defined(ENABLE_MANAGED_USERS)
32   SupervisedUserAvatarLabel* supervised_user_avatar_label() const {
33     return supervised_user_avatar_label_;
34   }
35
36   void OnThemeChanged() override;
37 #endif
38
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;
42
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;
48
49   // Returns the amount that the theme background should be inset.
50   virtual int GetThemeBackgroundXInset() const = 0;
51
52   // Updates the throbber.
53   virtual void UpdateThrobber(bool running) = 0;
54
55   // Overriden from views::View.
56   void VisibilityChanged(views::View* starting_from, bool is_visible) override;
57
58  protected:
59   BrowserView* browser_view() const { return browser_view_; }
60   BrowserFrame* frame() const { return frame_; }
61
62   // Updates the title and icon of the avatar button.
63   void UpdateAvatarInfo();
64
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);
70
71  private:
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);
76
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;
82
83   // The frame that hosts this view.
84   BrowserFrame* frame_;
85
86   // The BrowserView hosted within this View.
87   BrowserView* browser_view_;
88
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_;
92
93 #if defined(ENABLE_MANAGED_USERS)
94   SupervisedUserAvatarLabel* supervised_user_avatar_label_;
95 #endif
96
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_;
100 };
101
102 namespace chrome {
103
104 // Provided by a browser_non_client_frame_view_factory_*.cc implementation
105 BrowserNonClientFrameView* CreateBrowserNonClientFrameView(
106     BrowserFrame* frame, BrowserView* browser_view);
107
108 }  // namespace chrome
109
110 #endif  // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_NON_CLIENT_FRAME_VIEW_H_