Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(220)

Side by Side Diff: chrome/browser/ui/panels/panel_browser_window_gtk.cc

Issue 10483010: Change the visual appearance of panel on GTK per new UI design. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: revert nine_box changes completely Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #include "chrome/browser/ui/panels/panel_browser_window_gtk.h" 5 #include "chrome/browser/ui/panels/panel_browser_window_gtk.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "chrome/browser/ui/browser.h" 8 #include "chrome/browser/ui/browser.h"
9 #include "chrome/browser/ui/browser_list.h" 9 #include "chrome/browser/ui/browser_list.h"
10 #include "chrome/browser/ui/browser_window.h" 10 #include "chrome/browser/ui/browser_window.h"
11 #include "chrome/browser/ui/gtk/browser_titlebar.h" 11 #include "chrome/browser/ui/gtk/browser_titlebar.h"
12 #include "chrome/browser/ui/gtk/custom_button.h" 12 #include "chrome/browser/ui/gtk/custom_button.h"
13 #include "chrome/browser/ui/gtk/gtk_theme_service.h" 13 #include "chrome/browser/ui/gtk/gtk_theme_service.h"
14 #include "chrome/browser/ui/gtk/nine_box.h"
15 #include "chrome/browser/ui/panels/panel.h" 14 #include "chrome/browser/ui/panels/panel.h"
16 #include "chrome/browser/ui/panels/panel_bounds_animation.h" 15 #include "chrome/browser/ui/panels/panel_bounds_animation.h"
17 #include "chrome/browser/ui/panels/panel_browser_titlebar_gtk.h" 16 #include "chrome/browser/ui/panels/panel_browser_titlebar_gtk.h"
17 #include "chrome/browser/ui/panels/panel_constants.h"
18 #include "chrome/browser/ui/panels/panel_drag_gtk.h" 18 #include "chrome/browser/ui/panels/panel_drag_gtk.h"
19 #include "chrome/browser/ui/panels/panel_manager.h" 19 #include "chrome/browser/ui/panels/panel_manager.h"
20 #include "chrome/browser/ui/panels/panel_strip.h" 20 #include "chrome/browser/ui/panels/panel_strip.h"
21 #include "chrome/common/chrome_notification_types.h" 21 #include "chrome/common/chrome_notification_types.h"
22 #include "content/public/browser/native_web_keyboard_event.h" 22 #include "content/public/browser/native_web_keyboard_event.h"
23 #include "content/public/browser/notification_service.h" 23 #include "content/public/browser/notification_service.h"
24 #include "grit/theme_resources_standard.h" 24 #include "grit/theme_resources_standard.h"
25 #include "grit/ui_resources.h" 25 #include "grit/ui_resources.h"
26 #include "third_party/skia/include/core/SkShader.h" 26 #include "ui/base/gtk/gtk_compat.h"
27 #include "ui/gfx/canvas.h" 27 #include "ui/gfx/canvas.h"
28 #include "ui/gfx/image/cairo_cached_surface.h" 28 #include "ui/gfx/image/cairo_cached_surface.h"
29 #include "ui/gfx/image/image.h" 29 #include "ui/gfx/image/image.h"
30 #include "ui/gfx/skia_util.h"
31 30
32 using content::NativeWebKeyboardEvent; 31 using content::NativeWebKeyboardEvent;
33 using content::WebContents; 32 using content::WebContents;
34 33
35 namespace { 34 namespace {
36 35
37 // Colors used to draw titlebar and frame for drawing attention under default 36 // Colors used to draw frame background under default theme.
38 // theme. It is also used in non-default theme since attention color is not 37 const SkColor kActiveBackgroundDefaultColor = SkColorSetRGB(0x3a, 0x3c, 0x3c);
39 // defined in the theme. 38 const SkColor kInactiveBackgroundDefaultColor = SkColorSetRGB(0x7a, 0x7c, 0x7c);
40 const SkColor kAttentionBackgroundColorStart = SkColorSetRGB(0xff, 0xab, 0x57); 39 const SkColor kAttentionBackgroundDefaultColor =
41 const SkColor kAttentionBackgroundColorEnd = SkColorSetRGB(0xe6, 0x9a, 0x4e); 40 SkColorSetRGB(0xff, 0xab, 0x57);
41 const SkColor kMinimizeBackgroundDefaultColor = SkColorSetRGB(0xf5, 0xf4, 0xf0);
42 const SkColor kMinimizeBorderDefaultColor = SkColorSetRGB(0xc9, 0xc9, 0xc9);
43
44 // Color used to draw the divider line between the titlebar and the client area.
45 const SkColor kDividerColor = SkColorSetRGB(0x5a, 0x5c, 0x5c);
42 46
43 // Set minimium width for window really small. 47 // Set minimium width for window really small.
44 const int kMinWindowWidth = 26; 48 const int kMinWindowWidth = 26;
45 49
46 gfx::Image* CreateGradientImage(SkColor start_color, SkColor end_color) { 50 gfx::Image* CreateImageForColor(SkColor color) {
47 // Though the height of titlebar, used for creating gradient, cannot be 51 gfx::Canvas canvas(gfx::Size(1, 1), true);
48 // pre-determined, we use a reasonably bigger value that is obtained from 52 canvas.DrawColor(color);
49 // the experimentation and should work for most cases.
50 const int gradient_size = 32;
51 SkShader* shader = gfx::CreateGradientShader(
52 0, gradient_size, start_color, end_color);
53 SkPaint paint;
54 paint.setStyle(SkPaint::kFill_Style);
55 paint.setAntiAlias(true);
56 paint.setShader(shader);
57 shader->unref();
58 gfx::Canvas canvas(gfx::Size(1, gradient_size), true);
59 canvas.DrawRect(gfx::Rect(0, 0, 1, gradient_size), paint);
60 return new gfx::Image(canvas.ExtractBitmap()); 53 return new gfx::Image(canvas.ExtractBitmap());
61 } 54 }
62 55
63 gfx::Image* GetAttentionBackgroundImage() { 56 const gfx::Image* GetActiveBackgroundDefaultImage() {
64 static gfx::Image* image = NULL; 57 static gfx::Image* image = NULL;
65 if (!image) { 58 if (!image)
66 image = CreateGradientImage(kAttentionBackgroundColorStart, 59 image = CreateImageForColor(kActiveBackgroundDefaultColor);
67 kAttentionBackgroundColorEnd);
68 }
69 return image; 60 return image;
70 } 61 }
71 62
63 const gfx::Image* GetInactiveBackgroundDefaultImage() {
64 static gfx::Image* image = NULL;
65 if (!image)
66 image = CreateImageForColor(kInactiveBackgroundDefaultColor);
67 return image;
68 }
69
70 const gfx::Image* GetAttentionBackgroundDefaultImage() {
71 static gfx::Image* image = NULL;
72 if (!image)
73 image = CreateImageForColor(kAttentionBackgroundDefaultColor);
74 return image;
75 }
76
77 const gfx::Image* GetMinimizeBackgroundDefaultImage() {
78 static gfx::Image* image = NULL;
79 if (!image)
80 image = CreateImageForColor(kMinimizeBackgroundDefaultColor);
81 return image;
82 }
83
72 } // namespace 84 } // namespace
73 85
74 NativePanel* Panel::CreateNativePanel(Browser* browser, Panel* panel, 86 NativePanel* Panel::CreateNativePanel(Browser* browser, Panel* panel,
75 const gfx::Rect& bounds) { 87 const gfx::Rect& bounds) {
76 PanelBrowserWindowGtk* panel_browser_window_gtk = 88 PanelBrowserWindowGtk* panel_browser_window_gtk =
77 new PanelBrowserWindowGtk(browser, panel, bounds); 89 new PanelBrowserWindowGtk(browser, panel, bounds);
78 panel_browser_window_gtk->Init(); 90 panel_browser_window_gtk->Init();
79 return panel_browser_window_gtk; 91 return panel_browser_window_gtk;
80 } 92 }
81 93
82 PanelBrowserWindowGtk::PanelBrowserWindowGtk(Browser* browser, 94 PanelBrowserWindowGtk::PanelBrowserWindowGtk(Browser* browser,
83 Panel* panel, 95 Panel* panel,
84 const gfx::Rect& bounds) 96 const gfx::Rect& bounds)
85 : BrowserWindowGtk(browser), 97 : BrowserWindowGtk(browser),
86 panel_(panel), 98 panel_(panel),
87 bounds_(bounds), 99 bounds_(bounds),
100 paint_state_(PAINT_AS_INACTIVE),
88 is_drawing_attention_(false) { 101 is_drawing_attention_(false) {
89 } 102 }
90 103
91 PanelBrowserWindowGtk::~PanelBrowserWindowGtk() { 104 PanelBrowserWindowGtk::~PanelBrowserWindowGtk() {
92 } 105 }
93 106
94 void PanelBrowserWindowGtk::Init() { 107 void PanelBrowserWindowGtk::Init() {
95 BrowserWindowGtk::Init(); 108 BrowserWindowGtk::Init();
96 109
97 // Keep the window always on top. 110 // Keep the window always on top.
(...skipping 11 matching lines...) Expand all
109 // window edge was hit. 122 // window edge was hit.
110 g_signal_connect(titlebar_widget(), "button-release-event", 123 g_signal_connect(titlebar_widget(), "button-release-event",
111 G_CALLBACK(OnTitlebarButtonReleaseEventThunk), this); 124 G_CALLBACK(OnTitlebarButtonReleaseEventThunk), this);
112 125
113 registrar_.Add( 126 registrar_.Add(
114 this, 127 this,
115 chrome::NOTIFICATION_WINDOW_CLOSED, 128 chrome::NOTIFICATION_WINDOW_CLOSED,
116 content::Source<GtkWindow>(window())); 129 content::Source<GtkWindow>(window()));
117 } 130 }
118 131
119 bool PanelBrowserWindowGtk::ShouldDrawContentDropShadow() const { 132 BrowserTitlebarBase* PanelBrowserWindowGtk::CreateBrowserTitlebar() {
120 return !panel_->IsMinimized();
121 }
122
123 BrowserTitlebar* PanelBrowserWindowGtk::CreateBrowserTitlebar() {
124 return new PanelBrowserTitlebarGtk(this, window()); 133 return new PanelBrowserTitlebarGtk(this, window());
125 } 134 }
126 135
127 PanelBrowserTitlebarGtk* PanelBrowserWindowGtk::GetPanelTitlebar() const { 136 PanelBrowserTitlebarGtk* PanelBrowserWindowGtk::GetPanelTitlebar() const {
128 return static_cast<PanelBrowserTitlebarGtk*>(titlebar()); 137 return static_cast<PanelBrowserTitlebarGtk*>(titlebar());
129 } 138 }
130 139
131 PanelBrowserWindowGtk::PaintState PanelBrowserWindowGtk::GetPaintState() const { 140 bool PanelBrowserWindowGtk::UsingDefaultTheme() const {
132 if (is_drawing_attention_) 141 // No theme is provided for attention painting.
133 return PAINT_FOR_ATTENTION; 142 if (paint_state_ == PAINT_FOR_ATTENTION)
134 return IsActive() ? PAINT_AS_ACTIVE : PAINT_AS_INACTIVE; 143 return true;
144
145 GtkThemeService* theme_provider = GtkThemeService::GetFrom(
146 browser()->profile());
jennb 2012/06/05 20:40:35 Please get the profile() from the panel instead? O
jianli 2012/06/05 21:03:40 Done.
147 return theme_provider->UsingDefaultTheme();
135 } 148 }
136 149
137 bool PanelBrowserWindowGtk::GetWindowEdge(int x, int y, GdkWindowEdge* edge) { 150 bool PanelBrowserWindowGtk::GetWindowEdge(int x, int y, GdkWindowEdge* edge) {
138 // Only detect the window edge when panels can be resized by the user. 151 // Only detect the window edge when panels can be resized by the user.
139 // This method is used by the base class to detect when the cursor has 152 // This method is used by the base class to detect when the cursor has
140 // hit the window edge in order to change the cursor to a resize cursor 153 // hit the window edge in order to change the cursor to a resize cursor
141 // and to detect when to initiate a resize drag. 154 // and to detect when to initiate a resize drag.
142 panel::Resizability resizability = panel_->CanResizeByMouse(); 155 panel::Resizability resizability = panel_->CanResizeByMouse();
143 if (panel::NOT_RESIZABLE == resizability) 156 if (panel::NOT_RESIZABLE == resizability)
144 return false; 157 return false;
(...skipping 19 matching lines...) Expand all
164 // rounded because panels are aligned to the bottom edge of the screen. 177 // rounded because panels are aligned to the bottom edge of the screen.
165 GdkRectangle top_top_rect = { 3, 0, width - 6, 1 }; 178 GdkRectangle top_top_rect = { 3, 0, width - 6, 1 };
166 GdkRectangle top_mid_rect = { 1, 1, width - 2, 2 }; 179 GdkRectangle top_mid_rect = { 1, 1, width - 2, 2 };
167 GdkRectangle mid_rect = { 0, 3, width, height - 3 }; 180 GdkRectangle mid_rect = { 0, 3, width, height - 3 };
168 GdkRegion* mask = gdk_region_rectangle(&top_top_rect); 181 GdkRegion* mask = gdk_region_rectangle(&top_top_rect);
169 gdk_region_union_with_rect(mask, &top_mid_rect); 182 gdk_region_union_with_rect(mask, &top_mid_rect);
170 gdk_region_union_with_rect(mask, &mid_rect); 183 gdk_region_union_with_rect(mask, &mid_rect);
171 return mask; 184 return mask;
172 } 185 }
173 186
174 void PanelBrowserWindowGtk::DrawCustomFrameBorder(GtkWidget* widget) { 187 bool PanelBrowserWindowGtk::UseCustomFrame() const {
175 static NineBox* custom_frame_border = NULL; 188 // We always use custom frame for panels.
176 if (!custom_frame_border) { 189 return true;
177 custom_frame_border = new NineBox(IDR_WINDOW_TOP_LEFT_CORNER, 190 }
178 IDR_WINDOW_TOP_CENTER, 191
179 IDR_WINDOW_TOP_RIGHT_CORNER, 192 void PanelBrowserWindowGtk::DrawFrame(GtkWidget* widget,
180 IDR_WINDOW_LEFT_SIDE, 193 GdkEventExpose* event) {
181 0, 194 cairo_t* cr = gdk_cairo_create(gtk_widget_get_window(widget));
182 IDR_WINDOW_RIGHT_SIDE, 195 gdk_cairo_rectangle(cr, &event->area);
183 IDR_PANEL_BOTTOM_LEFT_CORNER, 196 cairo_clip(cr);
184 IDR_WINDOW_BOTTOM_CENTER, 197
185 IDR_PANEL_BOTTOM_RIGHT_CORNER); 198 // Update the painting state.
199 int window_height = gdk_window_get_height(gtk_widget_get_window(widget));
200 if (is_drawing_attention_)
201 paint_state_ = PAINT_FOR_ATTENTION;
202 else if (window_height <= panel::kMinimizedPanelHeight)
203 paint_state_ = PAINT_AS_MINIMIZED;
204 else if (IsActive())
205 paint_state_ = PAINT_AS_ACTIVE;
206 else
207 paint_state_ = PAINT_AS_INACTIVE;
208
209 // Draw the background.
210 gfx::CairoCachedSurface* surface = GetFrameBackground()->ToCairo();
211 surface->SetSource(cr, widget, 0, 0);
212 cairo_pattern_set_extend(cairo_get_source(cr), CAIRO_EXTEND_REPEAT);
213 cairo_rectangle(cr, event->area.x, event->area.y,
214 event->area.width, event->area.height);
215 cairo_fill(cr);
216
217 // Draw the divider only if we're showing more than titlebar.
218 if (window_height > panel::kTitlebarHeight) {
219 cairo_set_source_rgb(cr,
220 SkColorGetR(kDividerColor) / 255.0,
221 SkColorGetG(kDividerColor) / 255.0,
222 SkColorGetB(kDividerColor) / 255.0);
223 cairo_rectangle(cr, 0, panel::kTitlebarHeight - 1, bounds_.width(), 1);
224 cairo_fill(cr);
186 } 225 }
187 custom_frame_border->RenderToWidget(widget); 226
227 // Draw the border for the minimized panel only.
228 if (paint_state_ == PAINT_AS_MINIMIZED) {
229 cairo_move_to(cr, 0, 3);
230 cairo_line_to(cr, 1, 2);
231 cairo_line_to(cr, 1, 1);
232 cairo_line_to(cr, 2, 1);
233 cairo_line_to(cr, 3, 0);
234 cairo_line_to(cr, event->area.width - 3, 0);
235 cairo_line_to(cr, event->area.width - 2, 1);
236 cairo_line_to(cr, event->area.width - 1, 1);
237 cairo_line_to(cr, event->area.width - 1, 2);
238 cairo_line_to(cr, event->area.width - 1, 3);
239 cairo_line_to(cr, event->area.width - 1, event->area.height - 1);
240 cairo_line_to(cr, 0, event->area.height - 1);
241 cairo_close_path(cr);
242 cairo_set_source_rgb(cr,
243 SkColorGetR(kMinimizeBorderDefaultColor) / 255.0,
244 SkColorGetG(kMinimizeBorderDefaultColor) / 255.0,
245 SkColorGetB(kMinimizeBorderDefaultColor) / 255.0);
246 cairo_set_line_width(cr, 1.0);
247 cairo_stroke(cr);
248 }
249
250 cairo_destroy(cr);
188 } 251 }
189 252
190 void PanelBrowserWindowGtk::EnsureDragHelperCreated() { 253 void PanelBrowserWindowGtk::EnsureDragHelperCreated() {
191 if (drag_helper_.get()) 254 if (drag_helper_.get())
192 return; 255 return;
193 256
194 drag_helper_.reset(new PanelDragGtk(panel_.get())); 257 drag_helper_.reset(new PanelDragGtk(panel_.get()));
195 gtk_box_pack_end(GTK_BOX(window_vbox_), drag_helper_->widget(), 258 gtk_box_pack_end(GTK_BOX(window_vbox_), drag_helper_->widget(),
196 FALSE, FALSE, 0); 259 FALSE, FALSE, 0);
197 } 260 }
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 gtk_window_move(window_, left, top); 326 gtk_window_move(window_, left, top);
264 StartBoundsAnimation(gfx::Rect(left, top, width, height), bounds_); 327 StartBoundsAnimation(gfx::Rect(left, top, width, height), bounds_);
265 panel_->OnWindowSizeAvailable(); 328 panel_->OnWindowSizeAvailable();
266 329
267 content::NotificationService::current()->Notify( 330 content::NotificationService::current()->Notify(
268 chrome::NOTIFICATION_PANEL_WINDOW_SIZE_KNOWN, 331 chrome::NOTIFICATION_PANEL_WINDOW_SIZE_KNOWN,
269 content::Source<Panel>(panel_.get()), 332 content::Source<Panel>(panel_.get()),
270 content::NotificationService::NoDetails()); 333 content::NotificationService::NoDetails());
271 } 334 }
272 335
273 bool PanelBrowserWindowGtk::UseCustomFrame() const { 336 const gfx::Image* PanelBrowserWindowGtk::GetFrameBackground() const {
274 // We always use custom frame for panels. 337 return UsingDefaultTheme() ?
275 return true; 338 GetDefaultFrameBackground() : GetThemedFrameBackground();
276 } 339 }
277 340
278 bool PanelBrowserWindowGtk::UsingCustomPopupFrame() const { 341 const gfx::Image* PanelBrowserWindowGtk::GetDefaultFrameBackground() const {
279 // We do not draw custom popup frame. 342 switch (paint_state_) {
280 return false; 343 case PAINT_AS_INACTIVE:
344 return GetInactiveBackgroundDefaultImage();
345 case PAINT_AS_ACTIVE:
346 return GetActiveBackgroundDefaultImage();
347 case PAINT_AS_MINIMIZED:
348 return GetMinimizeBackgroundDefaultImage();
349 case PAINT_FOR_ATTENTION:
350 return GetAttentionBackgroundDefaultImage();
351 default:
352 NOTREACHED();
353 return GetInactiveBackgroundDefaultImage();
354 }
281 } 355 }
282 356
283 void PanelBrowserWindowGtk::DrawPopupFrame(cairo_t* cr, 357 const gfx::Image* PanelBrowserWindowGtk::GetThemedFrameBackground() const {
284 GtkWidget* widget,
285 GdkEventExpose* event) {
286 NOTREACHED();
287 }
288
289 const gfx::Image* PanelBrowserWindowGtk::GetThemeFrameImage() const {
290 PaintState paint_state = GetPaintState();
291 if (paint_state == PAINT_FOR_ATTENTION)
292 return GetAttentionBackgroundImage();
293
294 GtkThemeService* theme_provider = GtkThemeService::GetFrom( 358 GtkThemeService* theme_provider = GtkThemeService::GetFrom(
295 GetPanelBrowser()->profile()); 359 browser()->profile());
jennb 2012/06/05 20:40:35 ditto
jianli 2012/06/05 21:03:40 Done.
296 if (theme_provider->UsingDefaultTheme()) { 360 return theme_provider->GetImageNamed(paint_state_ == PAINT_AS_ACTIVE ?
297 // We choose to use the window frame theme to paint panels for the default
298 // theme. This is because the default tab theme does not work well for the
299 // user to recognize active and inactive panels.
300 return theme_provider->GetImageNamed(paint_state == PAINT_AS_ACTIVE ?
301 IDR_THEME_FRAME : IDR_THEME_FRAME_INACTIVE);
302 }
303
304 return theme_provider->GetImageNamed(paint_state == PAINT_AS_ACTIVE ?
305 IDR_THEME_TOOLBAR : IDR_THEME_TAB_BACKGROUND); 361 IDR_THEME_TOOLBAR : IDR_THEME_TAB_BACKGROUND);
306 } 362 }
307 363
308 void PanelBrowserWindowGtk::DrawCustomFrame(cairo_t* cr,
309 GtkWidget* widget,
310 GdkEventExpose* event) {
311 gfx::CairoCachedSurface* surface = GetThemeFrameImage()->ToCairo();
312
313 surface->SetSource(cr, widget, 0, 0);
314 cairo_pattern_set_extend(cairo_get_source(cr), CAIRO_EXTEND_REPEAT);
315 cairo_rectangle(cr, event->area.x, event->area.y,
316 event->area.width, event->area.height);
317 cairo_fill(cr);
318 }
319
320 void PanelBrowserWindowGtk::ActiveWindowChanged(GdkWindow* active_window) { 364 void PanelBrowserWindowGtk::ActiveWindowChanged(GdkWindow* active_window) {
321 bool was_active = IsActive(); 365 bool was_active = IsActive();
322 BrowserWindowGtk::ActiveWindowChanged(active_window); 366 BrowserWindowGtk::ActiveWindowChanged(active_window);
323 bool is_active = IsActive(); 367 bool is_active = IsActive();
324 if (!window() || was_active == is_active) // State didn't change. 368 if (!window() || was_active == is_active) // State didn't change.
325 return; 369 return;
326 370
371 GetPanelTitlebar()->UpdateTextColor();
327 panel_->OnActiveStateChanged(is_active); 372 panel_->OnActiveStateChanged(is_active);
328 } 373 }
329 374
330 void PanelBrowserWindowGtk::Observe( 375 void PanelBrowserWindowGtk::Observe(
331 int type, 376 int type,
332 const content::NotificationSource& source, 377 const content::NotificationSource& source,
333 const content::NotificationDetails& details) { 378 const content::NotificationDetails& details) {
334 switch (type) { 379 switch (type) {
335 case chrome::NOTIFICATION_WINDOW_CLOSED: 380 case chrome::NOTIFICATION_WINDOW_CLOSED:
336 // Cleanup. 381 // Cleanup.
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 virtual void ReleaseMouseButtonTitlebar( 638 virtual void ReleaseMouseButtonTitlebar(
594 panel::ClickModifier modifier) OVERRIDE; 639 panel::ClickModifier modifier) OVERRIDE;
595 virtual void DragTitlebar(const gfx::Point& mouse_location) OVERRIDE; 640 virtual void DragTitlebar(const gfx::Point& mouse_location) OVERRIDE;
596 virtual void CancelDragTitlebar() OVERRIDE; 641 virtual void CancelDragTitlebar() OVERRIDE;
597 virtual void FinishDragTitlebar() OVERRIDE; 642 virtual void FinishDragTitlebar() OVERRIDE;
598 virtual bool VerifyDrawingAttention() const OVERRIDE; 643 virtual bool VerifyDrawingAttention() const OVERRIDE;
599 virtual bool VerifyActiveState(bool is_active) OVERRIDE; 644 virtual bool VerifyActiveState(bool is_active) OVERRIDE;
600 virtual void WaitForWindowCreationToComplete() const OVERRIDE; 645 virtual void WaitForWindowCreationToComplete() const OVERRIDE;
601 virtual bool IsWindowSizeKnown() const OVERRIDE; 646 virtual bool IsWindowSizeKnown() const OVERRIDE;
602 virtual bool IsAnimatingBounds() const OVERRIDE; 647 virtual bool IsAnimatingBounds() const OVERRIDE;
603 virtual bool IsButtonVisible(TitlebarButtonType button_type) const OVERRIDE; 648 virtual bool IsButtonVisible(
649 panel::TitlebarButtonType button_type) const OVERRIDE;
604 650
605 PanelBrowserWindowGtk* panel_browser_window_gtk_; 651 PanelBrowserWindowGtk* panel_browser_window_gtk_;
606 }; 652 };
607 653
608 // static 654 // static
609 NativePanelTesting* NativePanelTesting::Create(NativePanel* native_panel) { 655 NativePanelTesting* NativePanelTesting::Create(NativePanel* native_panel) {
610 return new NativePanelTestingGtk(static_cast<PanelBrowserWindowGtk*>( 656 return new NativePanelTestingGtk(static_cast<PanelBrowserWindowGtk*>(
611 native_panel)); 657 native_panel));
612 } 658 }
613 659
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
696 742
697 bool NativePanelTestingGtk::IsWindowSizeKnown() const { 743 bool NativePanelTestingGtk::IsWindowSizeKnown() const {
698 return !panel_browser_window_gtk_->frame_size_.IsEmpty(); 744 return !panel_browser_window_gtk_->frame_size_.IsEmpty();
699 } 745 }
700 746
701 bool NativePanelTestingGtk::IsAnimatingBounds() const { 747 bool NativePanelTestingGtk::IsAnimatingBounds() const {
702 return panel_browser_window_gtk_->IsAnimatingBounds(); 748 return panel_browser_window_gtk_->IsAnimatingBounds();
703 } 749 }
704 750
705 bool NativePanelTestingGtk::IsButtonVisible( 751 bool NativePanelTestingGtk::IsButtonVisible(
706 TitlebarButtonType button_type) const { 752 panel::TitlebarButtonType button_type) const {
707 PanelBrowserTitlebarGtk* titlebar = 753 PanelBrowserTitlebarGtk* titlebar =
708 panel_browser_window_gtk_->GetPanelTitlebar(); 754 panel_browser_window_gtk_->GetPanelTitlebar();
709 CustomDrawButton* button; 755 CustomDrawButton* button;
710 switch (button_type) { 756 switch (button_type) {
711 case CLOSE_BUTTON: 757 case panel::CLOSE_BUTTON:
712 button = titlebar->close_button(); 758 button = titlebar->close_button();
713 break; 759 break;
714 case MINIMIZE_BUTTON: 760 case panel::MINIMIZE_BUTTON:
715 button = titlebar->minimize_button(); 761 button = titlebar->minimize_button();
716 break; 762 break;
717 case RESTORE_BUTTON: 763 case panel::RESTORE_BUTTON:
718 button = titlebar->unminimize_button(); 764 button = titlebar->restore_button();
719 break; 765 break;
720 default: 766 default:
721 NOTREACHED(); 767 NOTREACHED();
722 return false; 768 return false;
723 } 769 }
724 return gtk_widget_get_visible(button->widget()); 770 return gtk_widget_get_visible(button->widget());
725 } 771 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698