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

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: Fix per feedback 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(panel_->profile());
146 return theme_provider->UsingDefaultTheme();
135 } 147 }
136 148
137 bool PanelBrowserWindowGtk::GetWindowEdge(int x, int y, GdkWindowEdge* edge) { 149 bool PanelBrowserWindowGtk::GetWindowEdge(int x, int y, GdkWindowEdge* edge) {
138 // Only detect the window edge when panels can be resized by the user. 150 // 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 151 // 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 152 // hit the window edge in order to change the cursor to a resize cursor
141 // and to detect when to initiate a resize drag. 153 // and to detect when to initiate a resize drag.
142 panel::Resizability resizability = panel_->CanResizeByMouse(); 154 panel::Resizability resizability = panel_->CanResizeByMouse();
143 if (panel::NOT_RESIZABLE == resizability) 155 if (panel::NOT_RESIZABLE == resizability)
144 return false; 156 return false;
(...skipping 19 matching lines...) Expand all
164 // rounded because panels are aligned to the bottom edge of the screen. 176 // rounded because panels are aligned to the bottom edge of the screen.
165 GdkRectangle top_top_rect = { 3, 0, width - 6, 1 }; 177 GdkRectangle top_top_rect = { 3, 0, width - 6, 1 };
166 GdkRectangle top_mid_rect = { 1, 1, width - 2, 2 }; 178 GdkRectangle top_mid_rect = { 1, 1, width - 2, 2 };
167 GdkRectangle mid_rect = { 0, 3, width, height - 3 }; 179 GdkRectangle mid_rect = { 0, 3, width, height - 3 };
168 GdkRegion* mask = gdk_region_rectangle(&top_top_rect); 180 GdkRegion* mask = gdk_region_rectangle(&top_top_rect);
169 gdk_region_union_with_rect(mask, &top_mid_rect); 181 gdk_region_union_with_rect(mask, &top_mid_rect);
170 gdk_region_union_with_rect(mask, &mid_rect); 182 gdk_region_union_with_rect(mask, &mid_rect);
171 return mask; 183 return mask;
172 } 184 }
173 185
174 void PanelBrowserWindowGtk::DrawCustomFrameBorder(GtkWidget* widget) { 186 bool PanelBrowserWindowGtk::UseCustomFrame() const {
175 static NineBox* custom_frame_border = NULL; 187 // We always use custom frame for panels.
176 if (!custom_frame_border) { 188 return true;
177 custom_frame_border = new NineBox(IDR_WINDOW_TOP_LEFT_CORNER, 189 }
178 IDR_WINDOW_TOP_CENTER, 190
179 IDR_WINDOW_TOP_RIGHT_CORNER, 191 void PanelBrowserWindowGtk::DrawFrame(GtkWidget* widget,
180 IDR_WINDOW_LEFT_SIDE, 192 GdkEventExpose* event) {
181 0, 193 cairo_t* cr = gdk_cairo_create(gtk_widget_get_window(widget));
182 IDR_WINDOW_RIGHT_SIDE, 194 gdk_cairo_rectangle(cr, &event->area);
183 IDR_PANEL_BOTTOM_LEFT_CORNER, 195 cairo_clip(cr);
184 IDR_WINDOW_BOTTOM_CENTER, 196
185 IDR_PANEL_BOTTOM_RIGHT_CORNER); 197 // Update the painting state.
198 int window_height = gdk_window_get_height(gtk_widget_get_window(widget));
199 if (is_drawing_attention_)
200 paint_state_ = PAINT_FOR_ATTENTION;
201 else if (window_height <= panel::kMinimizedPanelHeight)
202 paint_state_ = PAINT_AS_MINIMIZED;
203 else if (IsActive())
204 paint_state_ = PAINT_AS_ACTIVE;
205 else
206 paint_state_ = PAINT_AS_INACTIVE;
207
208 // Draw the background.
209 gfx::CairoCachedSurface* surface = GetFrameBackground()->ToCairo();
210 surface->SetSource(cr, widget, 0, 0);
211 cairo_pattern_set_extend(cairo_get_source(cr), CAIRO_EXTEND_REPEAT);
212 cairo_rectangle(cr, event->area.x, event->area.y,
213 event->area.width, event->area.height);
214 cairo_fill(cr);
215
216 // Draw the divider only if we're showing more than titlebar.
217 if (window_height > panel::kTitlebarHeight) {
218 cairo_set_source_rgb(cr,
219 SkColorGetR(kDividerColor) / 255.0,
220 SkColorGetG(kDividerColor) / 255.0,
221 SkColorGetB(kDividerColor) / 255.0);
222 cairo_rectangle(cr, 0, panel::kTitlebarHeight - 1, bounds_.width(), 1);
223 cairo_fill(cr);
186 } 224 }
187 custom_frame_border->RenderToWidget(widget); 225
226 // Draw the border for the minimized panel only.
227 if (paint_state_ == PAINT_AS_MINIMIZED) {
228 cairo_move_to(cr, 0, 3);
229 cairo_line_to(cr, 1, 2);
230 cairo_line_to(cr, 1, 1);
231 cairo_line_to(cr, 2, 1);
232 cairo_line_to(cr, 3, 0);
233 cairo_line_to(cr, event->area.width - 3, 0);
234 cairo_line_to(cr, event->area.width - 2, 1);
235 cairo_line_to(cr, event->area.width - 1, 1);
236 cairo_line_to(cr, event->area.width - 1, 2);
237 cairo_line_to(cr, event->area.width - 1, 3);
238 cairo_line_to(cr, event->area.width - 1, event->area.height - 1);
239 cairo_line_to(cr, 0, event->area.height - 1);
240 cairo_close_path(cr);
241 cairo_set_source_rgb(cr,
242 SkColorGetR(kMinimizeBorderDefaultColor) / 255.0,
243 SkColorGetG(kMinimizeBorderDefaultColor) / 255.0,
244 SkColorGetB(kMinimizeBorderDefaultColor) / 255.0);
245 cairo_set_line_width(cr, 1.0);
246 cairo_stroke(cr);
247 }
248
249 cairo_destroy(cr);
188 } 250 }
189 251
190 void PanelBrowserWindowGtk::EnsureDragHelperCreated() { 252 void PanelBrowserWindowGtk::EnsureDragHelperCreated() {
191 if (drag_helper_.get()) 253 if (drag_helper_.get())
192 return; 254 return;
193 255
194 drag_helper_.reset(new PanelDragGtk(panel_.get())); 256 drag_helper_.reset(new PanelDragGtk(panel_.get()));
195 gtk_box_pack_end(GTK_BOX(window_vbox_), drag_helper_->widget(), 257 gtk_box_pack_end(GTK_BOX(window_vbox_), drag_helper_->widget(),
196 FALSE, FALSE, 0); 258 FALSE, FALSE, 0);
197 } 259 }
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 gtk_window_move(window_, left, top); 325 gtk_window_move(window_, left, top);
264 StartBoundsAnimation(gfx::Rect(left, top, width, height), bounds_); 326 StartBoundsAnimation(gfx::Rect(left, top, width, height), bounds_);
265 panel_->OnWindowSizeAvailable(); 327 panel_->OnWindowSizeAvailable();
266 328
267 content::NotificationService::current()->Notify( 329 content::NotificationService::current()->Notify(
268 chrome::NOTIFICATION_PANEL_WINDOW_SIZE_KNOWN, 330 chrome::NOTIFICATION_PANEL_WINDOW_SIZE_KNOWN,
269 content::Source<Panel>(panel_.get()), 331 content::Source<Panel>(panel_.get()),
270 content::NotificationService::NoDetails()); 332 content::NotificationService::NoDetails());
271 } 333 }
272 334
273 bool PanelBrowserWindowGtk::UseCustomFrame() const { 335 const gfx::Image* PanelBrowserWindowGtk::GetFrameBackground() const {
274 // We always use custom frame for panels. 336 return UsingDefaultTheme() ?
275 return true; 337 GetDefaultFrameBackground() : GetThemedFrameBackground();
276 } 338 }
277 339
278 bool PanelBrowserWindowGtk::UsingCustomPopupFrame() const { 340 const gfx::Image* PanelBrowserWindowGtk::GetDefaultFrameBackground() const {
279 // We do not draw custom popup frame. 341 switch (paint_state_) {
280 return false; 342 case PAINT_AS_INACTIVE:
343 return GetInactiveBackgroundDefaultImage();
344 case PAINT_AS_ACTIVE:
345 return GetActiveBackgroundDefaultImage();
346 case PAINT_AS_MINIMIZED:
347 return GetMinimizeBackgroundDefaultImage();
348 case PAINT_FOR_ATTENTION:
349 return GetAttentionBackgroundDefaultImage();
350 default:
351 NOTREACHED();
352 return GetInactiveBackgroundDefaultImage();
353 }
281 } 354 }
282 355
283 void PanelBrowserWindowGtk::DrawPopupFrame(cairo_t* cr, 356 const gfx::Image* PanelBrowserWindowGtk::GetThemedFrameBackground() const {
284 GtkWidget* widget, 357 GtkThemeService* theme_provider = GtkThemeService::GetFrom(panel_->profile());
285 GdkEventExpose* event) { 358 return theme_provider->GetImageNamed(paint_state_ == PAINT_AS_ACTIVE ?
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(
295 GetPanelBrowser()->profile());
296 if (theme_provider->UsingDefaultTheme()) {
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); 359 IDR_THEME_TOOLBAR : IDR_THEME_TAB_BACKGROUND);
306 } 360 }
307 361
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) { 362 void PanelBrowserWindowGtk::ActiveWindowChanged(GdkWindow* active_window) {
321 bool was_active = IsActive(); 363 bool was_active = IsActive();
322 BrowserWindowGtk::ActiveWindowChanged(active_window); 364 BrowserWindowGtk::ActiveWindowChanged(active_window);
323 bool is_active = IsActive(); 365 bool is_active = IsActive();
324 if (!window() || was_active == is_active) // State didn't change. 366 if (!window() || was_active == is_active) // State didn't change.
325 return; 367 return;
326 368
369 GetPanelTitlebar()->UpdateTextColor();
327 panel_->OnActiveStateChanged(is_active); 370 panel_->OnActiveStateChanged(is_active);
328 } 371 }
329 372
330 void PanelBrowserWindowGtk::Observe( 373 void PanelBrowserWindowGtk::Observe(
331 int type, 374 int type,
332 const content::NotificationSource& source, 375 const content::NotificationSource& source,
333 const content::NotificationDetails& details) { 376 const content::NotificationDetails& details) {
334 switch (type) { 377 switch (type) {
335 case chrome::NOTIFICATION_WINDOW_CLOSED: 378 case chrome::NOTIFICATION_WINDOW_CLOSED:
336 // Cleanup. 379 // Cleanup.
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 virtual void ReleaseMouseButtonTitlebar( 636 virtual void ReleaseMouseButtonTitlebar(
594 panel::ClickModifier modifier) OVERRIDE; 637 panel::ClickModifier modifier) OVERRIDE;
595 virtual void DragTitlebar(const gfx::Point& mouse_location) OVERRIDE; 638 virtual void DragTitlebar(const gfx::Point& mouse_location) OVERRIDE;
596 virtual void CancelDragTitlebar() OVERRIDE; 639 virtual void CancelDragTitlebar() OVERRIDE;
597 virtual void FinishDragTitlebar() OVERRIDE; 640 virtual void FinishDragTitlebar() OVERRIDE;
598 virtual bool VerifyDrawingAttention() const OVERRIDE; 641 virtual bool VerifyDrawingAttention() const OVERRIDE;
599 virtual bool VerifyActiveState(bool is_active) OVERRIDE; 642 virtual bool VerifyActiveState(bool is_active) OVERRIDE;
600 virtual void WaitForWindowCreationToComplete() const OVERRIDE; 643 virtual void WaitForWindowCreationToComplete() const OVERRIDE;
601 virtual bool IsWindowSizeKnown() const OVERRIDE; 644 virtual bool IsWindowSizeKnown() const OVERRIDE;
602 virtual bool IsAnimatingBounds() const OVERRIDE; 645 virtual bool IsAnimatingBounds() const OVERRIDE;
603 virtual bool IsButtonVisible(TitlebarButtonType button_type) const OVERRIDE; 646 virtual bool IsButtonVisible(
647 panel::TitlebarButtonType button_type) const OVERRIDE;
604 648
605 PanelBrowserWindowGtk* panel_browser_window_gtk_; 649 PanelBrowserWindowGtk* panel_browser_window_gtk_;
606 }; 650 };
607 651
608 // static 652 // static
609 NativePanelTesting* NativePanelTesting::Create(NativePanel* native_panel) { 653 NativePanelTesting* NativePanelTesting::Create(NativePanel* native_panel) {
610 return new NativePanelTestingGtk(static_cast<PanelBrowserWindowGtk*>( 654 return new NativePanelTestingGtk(static_cast<PanelBrowserWindowGtk*>(
611 native_panel)); 655 native_panel));
612 } 656 }
613 657
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
696 740
697 bool NativePanelTestingGtk::IsWindowSizeKnown() const { 741 bool NativePanelTestingGtk::IsWindowSizeKnown() const {
698 return !panel_browser_window_gtk_->frame_size_.IsEmpty(); 742 return !panel_browser_window_gtk_->frame_size_.IsEmpty();
699 } 743 }
700 744
701 bool NativePanelTestingGtk::IsAnimatingBounds() const { 745 bool NativePanelTestingGtk::IsAnimatingBounds() const {
702 return panel_browser_window_gtk_->IsAnimatingBounds(); 746 return panel_browser_window_gtk_->IsAnimatingBounds();
703 } 747 }
704 748
705 bool NativePanelTestingGtk::IsButtonVisible( 749 bool NativePanelTestingGtk::IsButtonVisible(
706 TitlebarButtonType button_type) const { 750 panel::TitlebarButtonType button_type) const {
707 PanelBrowserTitlebarGtk* titlebar = 751 PanelBrowserTitlebarGtk* titlebar =
708 panel_browser_window_gtk_->GetPanelTitlebar(); 752 panel_browser_window_gtk_->GetPanelTitlebar();
709 CustomDrawButton* button; 753 CustomDrawButton* button;
710 switch (button_type) { 754 switch (button_type) {
711 case CLOSE_BUTTON: 755 case panel::CLOSE_BUTTON:
712 button = titlebar->close_button(); 756 button = titlebar->close_button();
713 break; 757 break;
714 case MINIMIZE_BUTTON: 758 case panel::MINIMIZE_BUTTON:
715 button = titlebar->minimize_button(); 759 button = titlebar->minimize_button();
716 break; 760 break;
717 case RESTORE_BUTTON: 761 case panel::RESTORE_BUTTON:
718 button = titlebar->unminimize_button(); 762 button = titlebar->restore_button();
719 break; 763 break;
720 default: 764 default:
721 NOTREACHED(); 765 NOTREACHED();
722 return false; 766 return false;
723 } 767 }
724 return gtk_widget_get_visible(button->widget()); 768 return gtk_widget_get_visible(button->widget());
725 } 769 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/panels/panel_browser_window_gtk.h ('k') | chrome/browser/ui/panels/panel_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698