| 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/new_avatar_button.h" |
| 8 #include "ui/views/window/non_client_view.h" | 9 #include "ui/views/window/non_client_view.h" |
| 9 | 10 |
| 10 class AvatarLabel; | 11 class AvatarLabel; |
| 11 class AvatarMenuButton; | 12 class AvatarMenuButton; |
| 12 class BrowserFrame; | 13 class BrowserFrame; |
| 13 class BrowserView; | 14 class BrowserView; |
| 15 class NewAvatarButton; |
| 14 | 16 |
| 15 // A specialization of the NonClientFrameView object that provides additional | 17 // A specialization of the NonClientFrameView object that provides additional |
| 16 // Browser-specific methods. | 18 // Browser-specific methods. |
| 17 class BrowserNonClientFrameView : public views::NonClientFrameView { | 19 class BrowserNonClientFrameView : public views::NonClientFrameView { |
| 18 public: | 20 public: |
| 19 // Insets around the tabstrip. | 21 // Insets around the tabstrip. |
| 20 struct TabStripInsets { | 22 struct TabStripInsets { |
| 21 TabStripInsets() : top(0), left(0), right(0) {} | 23 TabStripInsets() : top(0), left(0), right(0) {} |
| 22 TabStripInsets(int top, int left, int right) | 24 TabStripInsets(int top, int left, int right) |
| 23 : top(top), | 25 : top(top), |
| 24 left(left), | 26 left(left), |
| 25 right(right) {} | 27 right(right) {} |
| 26 | 28 |
| 27 int top; | 29 int top; |
| 28 int left; | 30 int left; |
| 29 int right; | 31 int right; |
| 30 }; | 32 }; |
| 31 | 33 |
| 32 BrowserNonClientFrameView(BrowserFrame* frame, BrowserView* browser_view); | 34 BrowserNonClientFrameView(BrowserFrame* frame, BrowserView* browser_view); |
| 33 virtual ~BrowserNonClientFrameView(); | 35 virtual ~BrowserNonClientFrameView(); |
| 34 | 36 |
| 35 AvatarMenuButton* avatar_button() const { return avatar_button_; } | 37 AvatarMenuButton* avatar_button() const { return avatar_button_; } |
| 36 | 38 |
| 39 NewAvatarButton* new_avatar_button() const { return new_avatar_button_; } |
| 40 |
| 37 AvatarLabel* avatar_label() const { return avatar_label_; } | 41 AvatarLabel* avatar_label() const { return avatar_label_; } |
| 38 | 42 |
| 39 // Returns the bounds within which the TabStrip should be laid out. | 43 // Returns the bounds within which the TabStrip should be laid out. |
| 40 virtual gfx::Rect GetBoundsForTabStrip(views::View* tabstrip) const = 0; | 44 virtual gfx::Rect GetBoundsForTabStrip(views::View* tabstrip) const = 0; |
| 41 | 45 |
| 42 // Returns the TabStripInsets within the window at which the tab strip is | 46 // Returns the TabStripInsets within the window at which the tab strip is |
| 43 // positioned. If |as_restored| is true, this is calculated as if we were in | 47 // positioned. If |as_restored| is true, this is calculated as if we were in |
| 44 // restored mode regardless of the current mode. | 48 // restored mode regardless of the current mode. |
| 45 virtual TabStripInsets GetTabStripInsets(bool force_restored) const = 0; | 49 virtual TabStripInsets GetTabStripInsets(bool force_restored) const = 0; |
| 46 | 50 |
| 47 // Returns the amount that the theme background should be inset. | 51 // Returns the amount that the theme background should be inset. |
| 48 virtual int GetThemeBackgroundXInset() const = 0; | 52 virtual int GetThemeBackgroundXInset() const = 0; |
| 49 | 53 |
| 50 // Updates the throbber. | 54 // Updates the throbber. |
| 51 virtual void UpdateThrobber(bool running) = 0; | 55 virtual void UpdateThrobber(bool running) = 0; |
| 52 | 56 |
| 53 // Overriden from views::View. | 57 // Overriden from views::View. |
| 54 virtual void VisibilityChanged(views::View* starting_from, | 58 virtual void VisibilityChanged(views::View* starting_from, |
| 55 bool is_visible) OVERRIDE; | 59 bool is_visible) OVERRIDE; |
| 56 virtual void OnThemeChanged() OVERRIDE; | 60 virtual void OnThemeChanged() OVERRIDE; |
| 57 | 61 |
| 58 protected: | 62 protected: |
| 59 BrowserView* browser_view() const { return browser_view_; } | 63 BrowserView* browser_view() const { return browser_view_; } |
| 60 BrowserFrame* frame() const { return frame_; } | 64 BrowserFrame* frame() const { return frame_; } |
| 61 | 65 |
| 62 // Updates the title and icon of the avatar button. | 66 // Updates the title and icon of the avatar button. |
| 63 void UpdateAvatarInfo(); | 67 void UpdateAvatarInfo(); |
| 64 | 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 |
| 65 private: | 79 private: |
| 66 // The frame that hosts this view. | 80 // The frame that hosts this view. |
| 67 BrowserFrame* frame_; | 81 BrowserFrame* frame_; |
| 68 | 82 |
| 69 // The BrowserView hosted within this View. | 83 // The BrowserView hosted within this View. |
| 70 BrowserView* browser_view_; | 84 BrowserView* browser_view_; |
| 71 | 85 |
| 72 // Menu button that displays that either the incognito icon or the profile | 86 // Menu button that displays that either the incognito icon or the profile |
| 73 // icon. May be NULL for some frame styles. | 87 // icon. May be NULL for some frame styles. |
| 74 AvatarMenuButton* avatar_button_; | 88 AvatarMenuButton* avatar_button_; |
| 75 | 89 |
| 76 // Avatar label that is used for a managed user. | 90 // Avatar label that is used for a managed user. |
| 77 AvatarLabel* avatar_label_; | 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_; |
| 78 }; | 96 }; |
| 79 | 97 |
| 80 namespace chrome { | 98 namespace chrome { |
| 81 | 99 |
| 82 // Provided by a browser_non_client_frame_view_factory_*.cc implementation | 100 // Provided by a browser_non_client_frame_view_factory_*.cc implementation |
| 83 BrowserNonClientFrameView* CreateBrowserNonClientFrameView( | 101 BrowserNonClientFrameView* CreateBrowserNonClientFrameView( |
| 84 BrowserFrame* frame, BrowserView* browser_view); | 102 BrowserFrame* frame, BrowserView* browser_view); |
| 85 | 103 |
| 86 } // namespace chrome | 104 } // namespace chrome |
| 87 | 105 |
| 88 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_NON_CLIENT_FRAME_VIEW_H_ | 106 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_BROWSER_NON_CLIENT_FRAME_VIEW_H_ |
| OLD | NEW |