- add sources.
[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/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   // Insets around the tabstrip.
22   struct TabStripInsets {
23     TabStripInsets() : top(0), left(0), right(0) {}
24     TabStripInsets(int top, int left, int right)
25         : top(top),
26           left(left),
27           right(right) {}
28
29     int top;
30     int left;
31     int right;
32   };
33
34   BrowserNonClientFrameView(BrowserFrame* frame, BrowserView* browser_view);
35   virtual ~BrowserNonClientFrameView();
36
37   AvatarMenuButton* avatar_button() const { return avatar_button_; }
38
39   NewAvatarButton* new_avatar_button() const { return new_avatar_button_; }
40
41   AvatarLabel* avatar_label() const { return avatar_label_; }
42
43   // Returns the bounds within which the TabStrip should be laid out.
44   virtual gfx::Rect GetBoundsForTabStrip(views::View* tabstrip) const = 0;
45
46   // Returns the TabStripInsets within the window at which the tab strip is
47   // positioned. If |as_restored| is true, this is calculated as if we were in
48   // restored mode regardless of the current mode.
49   virtual TabStripInsets GetTabStripInsets(bool force_restored) const = 0;
50
51   // Returns the amount that the theme background should be inset.
52   virtual int GetThemeBackgroundXInset() const = 0;
53
54   // Updates the throbber.
55   virtual void UpdateThrobber(bool running) = 0;
56
57   // Overriden from views::View.
58   virtual void VisibilityChanged(views::View* starting_from,
59                                  bool is_visible) OVERRIDE;
60   virtual void OnThemeChanged() OVERRIDE;
61
62  protected:
63   BrowserView* browser_view() const { return browser_view_; }
64   BrowserFrame* frame() const { return frame_; }
65
66   // Updates the title and icon of the avatar button.
67   void UpdateAvatarInfo();
68
69   // Updates the title of the avatar button displayed in the caption area.
70   // The button uses |style| to match the browser window style and notifies
71   // |listener| when it is clicked.
72   void UpdateNewStyleAvatarInfo(views::ButtonListener* listener,
73                                 const NewAvatarButton::AvatarButtonStyle style);
74
75   // Anchor and show the ProfileChooser bubble under the avatar button in
76   // the caption area.
77   void ShowProfileChooserViewBubble();
78
79  private:
80   // The frame that hosts this view.
81   BrowserFrame* frame_;
82
83   // The BrowserView hosted within this View.
84   BrowserView* browser_view_;
85
86   // Menu button that displays that either the incognito icon or the profile
87   // icon.  May be NULL for some frame styles.
88   AvatarMenuButton* avatar_button_;
89
90   // Avatar label that is used for a managed user.
91   AvatarLabel* avatar_label_;
92
93   // Menu button that displays the name of the active or guest profile.
94   // May be NULL and will not be displayed for off the record profiles.
95   NewAvatarButton* new_avatar_button_;
96 };
97
98 namespace chrome {
99
100 // Provided by a browser_non_client_frame_view_factory_*.cc implementation
101 BrowserNonClientFrameView* CreateBrowserNonClientFrameView(
102     BrowserFrame* frame, BrowserView* browser_view);
103
104 }  // namespace chrome
105
106 #endif  // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_NON_CLIENT_FRAME_VIEW_H_