• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 class AvatarLabel;
12 class AvatarMenuButton;
13 class BrowserFrame;
14 class BrowserView;
15 class NewAvatarButton;
16 
17 // A specialization of the NonClientFrameView object that provides additional
18 // Browser-specific methods.
19 class BrowserNonClientFrameView : public views::NonClientFrameView {
20  public:
21   BrowserNonClientFrameView(BrowserFrame* frame, BrowserView* browser_view);
22   virtual ~BrowserNonClientFrameView();
23 
avatar_button()24   AvatarMenuButton* avatar_button() const { return avatar_button_; }
25 
new_avatar_button()26   NewAvatarButton* new_avatar_button() const { return new_avatar_button_; }
27 
avatar_label()28   AvatarLabel* avatar_label() const { return avatar_label_; }
29 
30   // Retrieves the bounds, in non-client view coordinates within which the
31   // TabStrip should be laid out.
32   virtual gfx::Rect GetBoundsForTabStrip(views::View* tabstrip) const = 0;
33 
34   // 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
36   // topmost view is the tab strip for tabbed browser windows, the toolbar for
37   // popups, the web contents for app windows and varies for fullscreen windows.
38   virtual int GetTopInset() const = 0;
39 
40   // Returns the amount that the theme background should be inset.
41   virtual int GetThemeBackgroundXInset() const = 0;
42 
43   // Updates the throbber.
44   virtual void UpdateThrobber(bool running) = 0;
45 
46   // Overriden from views::View.
47   virtual void VisibilityChanged(views::View* starting_from,
48                                  bool is_visible) OVERRIDE;
49   virtual void OnThemeChanged() OVERRIDE;
50 
51  protected:
browser_view()52   BrowserView* browser_view() const { return browser_view_; }
frame()53   BrowserFrame* frame() const { return frame_; }
54 
55   // Updates the title and icon of the avatar button.
56   void UpdateAvatarInfo();
57 
58   // Updates the title of the avatar button displayed in the caption area.
59   // The button uses |style| to match the browser window style and notifies
60   // |listener| when it is clicked.
61   void UpdateNewStyleAvatarInfo(views::ButtonListener* listener,
62                                 const NewAvatarButton::AvatarButtonStyle style);
63 
64  private:
65   // The frame that hosts this view.
66   BrowserFrame* frame_;
67 
68   // The BrowserView hosted within this View.
69   BrowserView* browser_view_;
70 
71   // Menu button that displays that either the incognito icon or the profile
72   // icon.  May be NULL for some frame styles.
73   AvatarMenuButton* avatar_button_;
74 
75   // Avatar label that is used for a supervised user.
76   AvatarLabel* avatar_label_;
77 
78   // Menu button that displays the name of the active or guest profile.
79   // May be NULL and will not be displayed for off the record profiles.
80   NewAvatarButton* new_avatar_button_;
81 };
82 
83 namespace chrome {
84 
85 // Provided by a browser_non_client_frame_view_factory_*.cc implementation
86 BrowserNonClientFrameView* CreateBrowserNonClientFrameView(
87     BrowserFrame* frame, BrowserView* browser_view);
88 
89 }  // namespace chrome
90 
91 #endif  // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_NON_CLIENT_FRAME_VIEW_H_
92