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_OPAQUE_BROWSER_FRAME_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_FRAME_OPAQUE_BROWSER_FRAME_VIEW_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_FRAME_OPAQUE_BROWSER_FRAME_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_FRAME_OPAQUE_BROWSER_FRAME_VIEW_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "chrome/browser/ui/view_ids.h" | 10 #include "chrome/browser/ui/view_ids.h" |
11 #include "chrome/browser/ui/views/frame/avatar_button_manager.h" | 11 #include "chrome/browser/ui/views/frame/avatar_button_manager.h" |
12 #include "chrome/browser/ui/views/frame/browser_frame.h" | 12 #include "chrome/browser/ui/views/frame/browser_frame.h" |
13 #include "chrome/browser/ui/views/frame/browser_non_client_frame_view.h" | 13 #include "chrome/browser/ui/views/frame/browser_non_client_frame_view.h" |
14 #include "chrome/browser/ui/views/frame/opaque_browser_frame_view_layout_delegat
e.h" | 14 #include "chrome/browser/ui/views/frame/opaque_browser_frame_view_layout_delegat
e.h" |
15 #include "chrome/browser/ui/views/tab_icon_view_model.h" | 15 #include "chrome/browser/ui/views/tab_icon_view_model.h" |
16 #include "ui/views/controls/button/button.h" | 16 #include "ui/views/controls/button/button.h" |
17 #include "ui/views/controls/button/menu_button_listener.h" | 17 #include "ui/views/controls/button/menu_button_listener.h" |
18 #include "ui/views/window/non_client_view.h" | 18 #include "ui/views/window/non_client_view.h" |
19 | 19 |
20 class BrowserView; | 20 class BrowserView; |
21 class OpaqueBrowserFrameViewLayout; | 21 class OpaqueBrowserFrameViewLayout; |
22 class OpaqueBrowserFrameViewPlatformSpecific; | 22 class OpaqueBrowserFrameViewPlatformSpecific; |
23 class TabIconView; | 23 class TabIconView; |
24 | 24 |
25 namespace views { | 25 namespace views { |
26 class ImageButton; | 26 class CustomButton; |
27 class FrameBackground; | 27 class FrameBackground; |
28 class Label; | 28 class Label; |
29 } | 29 } |
30 | 30 |
31 class OpaqueBrowserFrameView : public BrowserNonClientFrameView, | 31 class OpaqueBrowserFrameView : public BrowserNonClientFrameView, |
32 public views::ButtonListener, | 32 public views::ButtonListener, |
33 public views::MenuButtonListener, | 33 public views::MenuButtonListener, |
34 public TabIconViewModel, | 34 public TabIconViewModel, |
35 public OpaqueBrowserFrameViewLayoutDelegate { | 35 public OpaqueBrowserFrameViewLayoutDelegate { |
36 public: | 36 public: |
37 // Constructs a non-client view for an BrowserFrame. | 37 // Constructs a non-client view for an BrowserFrame. |
38 OpaqueBrowserFrameView(BrowserFrame* frame, BrowserView* browser_view); | 38 OpaqueBrowserFrameView(BrowserFrame* frame, BrowserView* browser_view); |
39 ~OpaqueBrowserFrameView() override; | 39 ~OpaqueBrowserFrameView() override; |
40 | 40 |
| 41 using BrowserNonClientFrameView::GetFrameColor; |
| 42 |
41 // BrowserNonClientFrameView: | 43 // BrowserNonClientFrameView: |
42 gfx::Rect GetBoundsForTabStrip(views::View* tabstrip) const override; | 44 gfx::Rect GetBoundsForTabStrip(views::View* tabstrip) const override; |
43 int GetTopInset(bool restored) const override; | 45 int GetTopInset(bool restored) const override; |
44 int GetThemeBackgroundXInset() const override; | 46 int GetThemeBackgroundXInset() const override; |
45 void UpdateThrobber(bool running) override; | 47 void UpdateThrobber(bool running) override; |
46 gfx::Size GetMinimumSize() const override; | 48 gfx::Size GetMinimumSize() const override; |
47 views::View* GetProfileSwitcherView() const override; | 49 views::View* GetProfileSwitcherView() const override; |
48 | 50 |
49 // views::NonClientFrameView: | 51 // views::NonClientFrameView: |
50 gfx::Rect GetBoundsForClientView() const override; | 52 gfx::Rect GetBoundsForClientView() const override; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 bool IsMaximized() const override; | 87 bool IsMaximized() const override; |
86 bool IsMinimized() const override; | 88 bool IsMinimized() const override; |
87 bool IsFullscreen() const override; | 89 bool IsFullscreen() const override; |
88 bool IsTabStripVisible() const override; | 90 bool IsTabStripVisible() const override; |
89 int GetTabStripHeight() const override; | 91 int GetTabStripHeight() const override; |
90 bool IsToolbarVisible() const override; | 92 bool IsToolbarVisible() const override; |
91 gfx::Size GetTabstripPreferredSize() const override; | 93 gfx::Size GetTabstripPreferredSize() const override; |
92 int GetToolbarLeadingCornerClientWidth() const override; | 94 int GetToolbarLeadingCornerClientWidth() const override; |
93 | 95 |
94 protected: | 96 protected: |
95 views::ImageButton* minimize_button() const { return minimize_button_; } | 97 views::CustomButton* minimize_button() const { return minimize_button_; } |
96 views::ImageButton* maximize_button() const { return maximize_button_; } | 98 views::CustomButton* maximize_button() const { return maximize_button_; } |
97 views::ImageButton* restore_button() const { return restore_button_; } | 99 views::CustomButton* restore_button() const { return restore_button_; } |
98 views::ImageButton* close_button() const { return close_button_; } | 100 views::CustomButton* close_button() const { return close_button_; } |
99 | 101 |
100 // views::View: | 102 // views::View: |
101 void OnPaint(gfx::Canvas* canvas) override; | 103 void OnPaint(gfx::Canvas* canvas) override; |
102 | 104 |
103 // BrowserNonClientFrameView: | 105 // BrowserNonClientFrameView: |
104 bool ShouldPaintAsThemed() const override; | 106 bool ShouldPaintAsThemed() const override; |
105 void UpdateAvatar() override; | 107 void UpdateAvatar() override; |
106 | 108 |
107 private: | 109 private: |
108 // views::NonClientFrameView: | 110 // views::NonClientFrameView: |
109 bool DoesIntersectRect(const views::View* target, | 111 bool DoesIntersectRect(const views::View* target, |
110 const gfx::Rect& rect) const override; | 112 const gfx::Rect& rect) const override; |
111 | 113 |
112 // Creates, adds and returns a new image button with |this| as its listener. | 114 // Creates, adds and returns a new image button with |this| as its listener. |
113 // Memory is owned by the caller. | 115 // Memory is owned by the caller. |
114 views::ImageButton* InitWindowCaptionButton(int normal_image_id, | 116 views::CustomButton* InitWindowCaptionButton(int normal_image_id, |
115 int hot_image_id, | 117 int hot_image_id, |
116 int pushed_image_id, | 118 int pushed_image_id, |
117 int mask_image_id, | 119 int mask_image_id, |
118 int accessibility_string_id, | 120 int accessibility_string_id, |
119 ViewID view_id); | 121 ViewID view_id); |
120 | 122 |
121 // Returns the thickness of the border that makes up the window frame edges. | 123 // Returns the thickness of the border that makes up the window frame edges. |
122 // This does not include any client edge. If |restored| is true, this is | 124 // This does not include any client edge. If |restored| is true, this is |
123 // calculated as if the window was restored, regardless of its current state. | 125 // calculated as if the window was restored, regardless of its current state. |
124 int FrameBorderThickness(bool restored) const; | 126 int FrameBorderThickness(bool restored) const; |
125 | 127 |
126 // Returns true if the specified point is within the avatar menu buttons. | 128 // Returns true if the specified point is within the avatar menu buttons. |
127 bool IsWithinAvatarMenuButtons(const gfx::Point& point) const; | 129 bool IsWithinAvatarMenuButtons(const gfx::Point& point) const; |
128 | 130 |
129 // Returns the thickness of the entire nonclient left, right, and bottom | 131 // Returns the thickness of the entire nonclient left, right, and bottom |
(...skipping 22 matching lines...) Expand all Loading... |
152 int w, | 154 int w, |
153 int h, | 155 int h, |
154 bool draw_bottom, | 156 bool draw_bottom, |
155 SkColor color, | 157 SkColor color, |
156 gfx::Canvas* canvas) const; | 158 gfx::Canvas* canvas) const; |
157 | 159 |
158 // Our layout manager also calculates various bounds. | 160 // Our layout manager also calculates various bounds. |
159 OpaqueBrowserFrameViewLayout* layout_; | 161 OpaqueBrowserFrameViewLayout* layout_; |
160 | 162 |
161 // Window controls. | 163 // Window controls. |
162 views::ImageButton* minimize_button_; | 164 views::CustomButton* minimize_button_; |
163 views::ImageButton* maximize_button_; | 165 views::CustomButton* maximize_button_; |
164 views::ImageButton* restore_button_; | 166 views::CustomButton* restore_button_; |
165 views::ImageButton* close_button_; | 167 views::CustomButton* close_button_; |
166 | 168 |
167 // The window icon and title. | 169 // The window icon and title. |
168 TabIconView* window_icon_; | 170 TabIconView* window_icon_; |
169 views::Label* window_title_; | 171 views::Label* window_title_; |
170 | 172 |
171 // Wrapper around the in-frame avatar switcher. | 173 // Wrapper around the in-frame avatar switcher. |
172 AvatarButtonManager profile_switcher_; | 174 AvatarButtonManager profile_switcher_; |
173 | 175 |
174 // Background painter for the window frame. | 176 // Background painter for the window frame. |
175 scoped_ptr<views::FrameBackground> frame_background_; | 177 scoped_ptr<views::FrameBackground> frame_background_; |
176 | 178 |
177 // Observer that handles platform dependent configuration. | 179 // Observer that handles platform dependent configuration. |
178 scoped_ptr<OpaqueBrowserFrameViewPlatformSpecific> platform_observer_; | 180 scoped_ptr<OpaqueBrowserFrameViewPlatformSpecific> platform_observer_; |
179 | 181 |
180 DISALLOW_COPY_AND_ASSIGN(OpaqueBrowserFrameView); | 182 DISALLOW_COPY_AND_ASSIGN(OpaqueBrowserFrameView); |
181 }; | 183 }; |
182 | 184 |
183 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_OPAQUE_BROWSER_FRAME_VIEW_H_ | 185 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_OPAQUE_BROWSER_FRAME_VIEW_H_ |
OLD | NEW |