| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_GLASS_BROWSER_FRAME_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_FRAME_GLASS_BROWSER_FRAME_VIEW_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_FRAME_GLASS_BROWSER_FRAME_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_FRAME_GLASS_BROWSER_FRAME_VIEW_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "chrome/browser/prefs/pref_member.h" | 10 #include "chrome/browser/prefs/pref_member.h" |
| 11 #include "chrome/browser/ui/views/frame/browser_frame_win.h" | 11 #include "chrome/browser/ui/views/frame/browser_frame_win.h" |
| 12 #include "chrome/browser/ui/views/frame/browser_non_client_frame_view.h" | 12 #include "chrome/browser/ui/views/frame/browser_non_client_frame_view.h" |
| 13 #include "views/controls/button/button.h" | 13 #include "views/controls/button/button.h" |
| 14 #include "views/window/non_client_view.h" | 14 #include "views/window/non_client_view.h" |
| 15 | 15 |
| 16 class BrowserView; | 16 class BrowserView; |
| 17 class ProfileMenuButton; | 17 class AvatarMenuButton; |
| 18 class ProfileMenuModel; | |
| 19 class ProfileTagView; | |
| 20 class SkBitmap; | 18 class SkBitmap; |
| 21 | 19 |
| 22 class GlassBrowserFrameView : public BrowserNonClientFrameView, | 20 class GlassBrowserFrameView : public BrowserNonClientFrameView, |
| 23 public NotificationObserver { | 21 public NotificationObserver { |
| 24 public: | 22 public: |
| 25 // Constructs a non-client view for an BrowserFrame. | 23 // Constructs a non-client view for an BrowserFrame. |
| 26 GlassBrowserFrameView(BrowserFrame* frame, BrowserView* browser_view); | 24 GlassBrowserFrameView(BrowserFrame* frame, BrowserView* browser_view); |
| 27 virtual ~GlassBrowserFrameView(); | 25 virtual ~GlassBrowserFrameView(); |
| 28 | 26 |
| 29 // Overridden from BrowserNonClientFrameView: | 27 // Overridden from BrowserNonClientFrameView: |
| (...skipping 29 matching lines...) Expand all Loading... |
| 59 | 57 |
| 60 // Returns the height of the entire nonclient top border, including the window | 58 // Returns the height of the entire nonclient top border, including the window |
| 61 // frame, any title area, and any connected client edge. If |restored| is | 59 // frame, any title area, and any connected client edge. If |restored| is |
| 62 // true, acts as if the window is restored regardless of the real mode. If | 60 // true, acts as if the window is restored regardless of the real mode. If |
| 63 // |ignore_vertical_tabs| is true, acts as if vertical tabs are off regardless | 61 // |ignore_vertical_tabs| is true, acts as if vertical tabs are off regardless |
| 64 // of the real state. | 62 // of the real state. |
| 65 int NonClientTopBorderHeight(bool restored, bool ignore_vertical_tabs) const; | 63 int NonClientTopBorderHeight(bool restored, bool ignore_vertical_tabs) const; |
| 66 | 64 |
| 67 // Paint various sub-components of this view. | 65 // Paint various sub-components of this view. |
| 68 void PaintToolbarBackground(gfx::Canvas* canvas); | 66 void PaintToolbarBackground(gfx::Canvas* canvas); |
| 69 void PaintOTRAvatar(gfx::Canvas* canvas); | |
| 70 void PaintRestoredClientEdge(gfx::Canvas* canvas); | 67 void PaintRestoredClientEdge(gfx::Canvas* canvas); |
| 71 | 68 |
| 72 // Layout various sub-components of this view. | 69 // Layout various sub-components of this view. |
| 73 void LayoutOTRAvatar(); | 70 void LayoutAvatar(); |
| 74 void LayoutClientView(); | 71 void LayoutClientView(); |
| 75 void LayoutProfileTag(); | |
| 76 | 72 |
| 77 // Returns the bounds of the client area for the specified view size. | 73 // Returns the bounds of the client area for the specified view size. |
| 78 gfx::Rect CalculateClientAreaBounds(int width, int height) const; | 74 gfx::Rect CalculateClientAreaBounds(int width, int height) const; |
| 79 | 75 |
| 80 // Starts/Stops the window throbber running. | 76 // Starts/Stops the window throbber running. |
| 81 void StartThrobber(); | 77 void StartThrobber(); |
| 82 void StopThrobber(); | 78 void StopThrobber(); |
| 83 | 79 |
| 84 // Displays the next throbber frame. | 80 // Displays the next throbber frame. |
| 85 void DisplayNextThrobberFrame(); | 81 void DisplayNextThrobberFrame(); |
| 86 | 82 |
| 87 // NotificationObserver implementation: | 83 // NotificationObserver implementation: |
| 88 virtual void Observe(NotificationType type, | 84 virtual void Observe(NotificationType type, |
| 89 const NotificationSource& source, | 85 const NotificationSource& source, |
| 90 const NotificationDetails& details) OVERRIDE; | 86 const NotificationDetails& details) OVERRIDE; |
| 91 | 87 |
| 92 // Receive notifications when the user's Google services user name changes. | 88 // Receive notifications when the user's Google services user name changes. |
| 93 void RegisterLoginNotifications(); | 89 void RegisterLoginNotifications(); |
| 94 | 90 |
| 95 // Returns true if the ProfileButton has been created. | 91 // The layout rect of the avatar icon, if visible. |
| 96 bool show_profile_button() const { return profile_button_.get() != NULL; } | 92 gfx::Rect avatar_bounds_; |
| 97 | |
| 98 // The layout rect of the OTR avatar icon, if visible. | |
| 99 gfx::Rect otr_avatar_bounds_; | |
| 100 | 93 |
| 101 // The frame that hosts this view. | 94 // The frame that hosts this view. |
| 102 BrowserFrame* frame_; | 95 BrowserFrame* frame_; |
| 103 | 96 |
| 104 // The BrowserView hosted within this View. | 97 // The BrowserView hosted within this View. |
| 105 BrowserView* browser_view_; | 98 BrowserView* browser_view_; |
| 106 | 99 |
| 107 // The bounds of the ClientView. | 100 // The bounds of the ClientView. |
| 108 gfx::Rect client_view_bounds_; | 101 gfx::Rect client_view_bounds_; |
| 109 | 102 |
| 110 // Menu button that displays user's name and multi-profile menu. | 103 // Menu button that displays that either the incognito icon or the profile |
| 111 scoped_ptr<ProfileMenuButton> profile_button_; | 104 // icon. |
| 112 | 105 scoped_ptr<AvatarMenuButton> avatar_button_; |
| 113 // Image tag displayed on frame beneath profile_button_. | |
| 114 scoped_ptr<ProfileTagView> profile_tag_; | |
| 115 | 106 |
| 116 // Whether or not the window throbber is currently animating. | 107 // Whether or not the window throbber is currently animating. |
| 117 bool throbber_running_; | 108 bool throbber_running_; |
| 118 | 109 |
| 119 // The index of the current frame of the throbber animation. | 110 // The index of the current frame of the throbber animation. |
| 120 int throbber_frame_; | 111 int throbber_frame_; |
| 121 | 112 |
| 122 // The Google services user name associated with this BrowserView's profile. | 113 // The Google services user name associated with this BrowserView's profile. |
| 123 StringPrefMember username_pref_; | 114 StringPrefMember username_pref_; |
| 124 | 115 |
| 125 static const int kThrobberIconCount = 24; | 116 static const int kThrobberIconCount = 24; |
| 126 static HICON throbber_icons_[kThrobberIconCount]; | 117 static HICON throbber_icons_[kThrobberIconCount]; |
| 127 static void InitThrobberIcons(); | 118 static void InitThrobberIcons(); |
| 128 | 119 |
| 129 DISALLOW_COPY_AND_ASSIGN(GlassBrowserFrameView); | 120 DISALLOW_COPY_AND_ASSIGN(GlassBrowserFrameView); |
| 130 }; | 121 }; |
| 131 | 122 |
| 132 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_GLASS_BROWSER_FRAME_VIEW_H_ | 123 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_GLASS_BROWSER_FRAME_VIEW_H_ |
| OLD | NEW |