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

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

Issue 10180011: Support painting panels with chromium themes on GTK. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Patch to land Created 8 years, 7 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_list.h" 8 #include "chrome/browser/ui/browser_list.h"
9 #include "chrome/browser/ui/gtk/browser_titlebar.h" 9 #include "chrome/browser/ui/gtk/browser_titlebar.h"
10 #include "chrome/browser/ui/gtk/custom_button.h" 10 #include "chrome/browser/ui/gtk/custom_button.h"
11 #include "chrome/browser/ui/gtk/theme_service_gtk.h"
11 #include "chrome/browser/ui/panels/panel.h" 12 #include "chrome/browser/ui/panels/panel.h"
12 #include "chrome/browser/ui/panels/panel_bounds_animation.h" 13 #include "chrome/browser/ui/panels/panel_bounds_animation.h"
13 #include "chrome/browser/ui/panels/panel_browser_titlebar_gtk.h" 14 #include "chrome/browser/ui/panels/panel_browser_titlebar_gtk.h"
14 #include "chrome/browser/ui/panels/panel_drag_gtk.h" 15 #include "chrome/browser/ui/panels/panel_drag_gtk.h"
15 #include "chrome/browser/ui/panels/panel_manager.h" 16 #include "chrome/browser/ui/panels/panel_manager.h"
16 #include "chrome/browser/ui/panels/panel_strip.h" 17 #include "chrome/browser/ui/panels/panel_strip.h"
17 #include "chrome/common/chrome_notification_types.h" 18 #include "chrome/common/chrome_notification_types.h"
18 #include "content/public/browser/notification_service.h" 19 #include "content/public/browser/notification_service.h"
20 #include "grit/theme_resources_standard.h"
21 #include "third_party/skia/include/core/SkShader.h"
22 #include "ui/gfx/canvas.h"
23 #include "ui/gfx/image/cairo_cached_surface.h"
24 #include "ui/gfx/image/image.h"
25 #include "ui/gfx/skia_util.h"
19 26
20 using content::WebContents; 27 using content::WebContents;
21 28
22 namespace { 29 namespace {
23 30
24 // RGB values for titlebar in draw attention state. A shade of orange. 31 // Colors used to draw titlebar and frame for drawing attention under default
25 const int kDrawAttentionR = 0xfa; 32 // theme. It is also used in non-default theme since attention color is not
26 const int kDrawAttentionG = 0x98; 33 // defined in the theme.
27 const int kDrawAttentionB = 0x3a; 34 const SkColor kAttentionBackgroundColorStart = SkColorSetRGB(0xff, 0xab, 0x57);
28 const float kDrawAttentionRFraction = kDrawAttentionR / 255.0; 35 const SkColor kAttentionBackgroundColorEnd = SkColorSetRGB(0xe6, 0x9a, 0x4e);
29 const float kDrawAttentionGFraction = kDrawAttentionG / 255.0;
30 const float kDrawAttentionBFraction = kDrawAttentionB / 255.0;
31
32 // Markup for title text in draw attention state. Set to color white.
33 const char* const kDrawAttentionTitleMarkupPrefix =
34 "<span fgcolor='#ffffff'>";
35 const char* const kDrawAttentionTitleMarkupSuffix = "</span>";
36 36
37 // Set minimium width for window really small. 37 // Set minimium width for window really small.
38 const int kMinWindowWidth = 26; 38 const int kMinWindowWidth = 26;
39 39
40 gfx::Image* CreateGradientImage(SkColor start_color, SkColor end_color) {
41 // Though the height of titlebar, used for creating gradient, cannot be
42 // pre-determined, we use a reasonably bigger value that is obtained from
43 // the experimentation and should work for most cases.
44 const int gradient_size = 32;
45 SkShader* shader = gfx::CreateGradientShader(
46 0, gradient_size, start_color, end_color);
47 SkPaint paint;
48 paint.setStyle(SkPaint::kFill_Style);
49 paint.setAntiAlias(true);
50 paint.setShader(shader);
51 shader->unref();
52 gfx::Canvas canvas(gfx::Size(1, gradient_size), true);
53 canvas.DrawRect(gfx::Rect(0, 0, 1, gradient_size), paint);
54 return new gfx::Image(canvas.ExtractBitmap());
55 }
56
57 gfx::Image* GetAttentionBackgroundImage() {
58 static gfx::Image* image = NULL;
59 if (!image) {
60 image = CreateGradientImage(kAttentionBackgroundColorStart,
61 kAttentionBackgroundColorEnd);
62 }
63 return image;
64 }
65
40 } // namespace 66 } // namespace
41 67
42 NativePanel* Panel::CreateNativePanel(Browser* browser, Panel* panel, 68 NativePanel* Panel::CreateNativePanel(Browser* browser, Panel* panel,
43 const gfx::Rect& bounds) { 69 const gfx::Rect& bounds) {
44 PanelBrowserWindowGtk* panel_browser_window_gtk = 70 PanelBrowserWindowGtk* panel_browser_window_gtk =
45 new PanelBrowserWindowGtk(browser, panel, bounds); 71 new PanelBrowserWindowGtk(browser, panel, bounds);
46 panel_browser_window_gtk->Init(); 72 panel_browser_window_gtk->Init();
47 return panel_browser_window_gtk; 73 return panel_browser_window_gtk;
48 } 74 }
49 75
(...skipping 27 matching lines...) Expand all
77 // window edge was hit. 103 // window edge was hit.
78 g_signal_connect(titlebar_widget(), "button-release-event", 104 g_signal_connect(titlebar_widget(), "button-release-event",
79 G_CALLBACK(OnTitlebarButtonReleaseEventThunk), this); 105 G_CALLBACK(OnTitlebarButtonReleaseEventThunk), this);
80 106
81 registrar_.Add( 107 registrar_.Add(
82 this, 108 this,
83 chrome::NOTIFICATION_WINDOW_CLOSED, 109 chrome::NOTIFICATION_WINDOW_CLOSED,
84 content::Source<GtkWindow>(window())); 110 content::Source<GtkWindow>(window()));
85 } 111 }
86 112
113 bool PanelBrowserWindowGtk::ShouldDrawContentDropShadow() const {
114 return !panel_->IsMinimized();
115 }
116
87 BrowserTitlebar* PanelBrowserWindowGtk::CreateBrowserTitlebar() { 117 BrowserTitlebar* PanelBrowserWindowGtk::CreateBrowserTitlebar() {
88 return new PanelBrowserTitlebarGtk(this, window()); 118 return new PanelBrowserTitlebarGtk(this, window());
89 } 119 }
90 120
121 PanelBrowserTitlebarGtk* PanelBrowserWindowGtk::GetPanelTitlebar() const {
122 return static_cast<PanelBrowserTitlebarGtk*>(titlebar());
123 }
124
125 PanelBrowserWindowGtk::PaintState PanelBrowserWindowGtk::GetPaintState() const {
126 if (is_drawing_attention_)
127 return PAINT_FOR_ATTENTION;
128 return IsActive() ? PAINT_AS_ACTIVE : PAINT_AS_INACTIVE;
129 }
130
91 bool PanelBrowserWindowGtk::GetWindowEdge(int x, int y, GdkWindowEdge* edge) { 131 bool PanelBrowserWindowGtk::GetWindowEdge(int x, int y, GdkWindowEdge* edge) {
92 // Only detect the window edge when panels can be resized by the user. 132 // Only detect the window edge when panels can be resized by the user.
93 // This method is used by the base class to detect when the cursor has 133 // This method is used by the base class to detect when the cursor has
94 // hit the window edge in order to change the cursor to a resize cursor 134 // hit the window edge in order to change the cursor to a resize cursor
95 // and to detect when to initiate a resize drag. 135 // and to detect when to initiate a resize drag.
96 panel::Resizability resizability = panel_->CanResizeByMouse(); 136 panel::Resizability resizability = panel_->CanResizeByMouse();
97 if (panel::NOT_RESIZABLE == resizability) 137 if (panel::NOT_RESIZABLE == resizability)
98 return false; 138 return false;
99 139
100 if (!BrowserWindowGtk::GetWindowEdge(x, y, edge)) 140 if (!BrowserWindowGtk::GetWindowEdge(x, y, edge))
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 gtk_window_move(window_, left, top); 229 gtk_window_move(window_, left, top);
190 StartBoundsAnimation(gfx::Rect(left, top, width, height), bounds_); 230 StartBoundsAnimation(gfx::Rect(left, top, width, height), bounds_);
191 panel_->OnWindowSizeAvailable(); 231 panel_->OnWindowSizeAvailable();
192 232
193 content::NotificationService::current()->Notify( 233 content::NotificationService::current()->Notify(
194 chrome::NOTIFICATION_PANEL_WINDOW_SIZE_KNOWN, 234 chrome::NOTIFICATION_PANEL_WINDOW_SIZE_KNOWN,
195 content::Source<Panel>(panel_.get()), 235 content::Source<Panel>(panel_.get()),
196 content::NotificationService::NoDetails()); 236 content::NotificationService::NoDetails());
197 } 237 }
198 238
199 bool PanelBrowserWindowGtk::UseCustomFrame() { 239 bool PanelBrowserWindowGtk::UseCustomFrame() const {
200 // We always use custom frame for panels. 240 // We always use custom frame for panels.
201 return TRUE; 241 return true;
242 }
243
244 bool PanelBrowserWindowGtk::UsingCustomPopupFrame() const {
245 // We do not draw custom popup frame.
246 return false;
202 } 247 }
203 248
204 void PanelBrowserWindowGtk::DrawPopupFrame(cairo_t* cr, 249 void PanelBrowserWindowGtk::DrawPopupFrame(cairo_t* cr,
205 GtkWidget* widget, 250 GtkWidget* widget,
206 GdkEventExpose* event) { 251 GdkEventExpose* event) {
207 static_cast<PanelBrowserTitlebarGtk*>(titlebar())-> 252 NOTREACHED();
208 UpdateMinimizeRestoreButtonVisibility(); 253 }
209 254
210 BrowserWindowGtk::DrawPopupFrame(cr, widget, event); 255 const gfx::Image* PanelBrowserWindowGtk::GetThemeFrameImage() const {
256 PaintState paint_state = GetPaintState();
257 if (paint_state == PAINT_FOR_ATTENTION)
258 return GetAttentionBackgroundImage();
211 259
212 if (is_drawing_attention_) 260 ThemeServiceGtk* theme_provider = ThemeServiceGtk::GetFrom(
213 DrawAttentionFrame(cr, widget, event); 261 browser()->profile());
262 if (theme_provider->UsingDefaultTheme()) {
263 // We choose to use the window frame theme to paint panels for the default
264 // theme. This is because the default tab theme does not work well for the
265 // user to recognize active and inactive panels.
266 return theme_provider->GetImageNamed(paint_state == PAINT_AS_ACTIVE ?
267 IDR_THEME_FRAME : IDR_THEME_FRAME_INACTIVE);
268 }
269
270 return theme_provider->GetImageNamed(paint_state == PAINT_AS_ACTIVE ?
271 IDR_THEME_TOOLBAR : IDR_THEME_TAB_BACKGROUND);
214 } 272 }
215 273
216 void PanelBrowserWindowGtk::DrawCustomFrame(cairo_t* cr, 274 void PanelBrowserWindowGtk::DrawCustomFrame(cairo_t* cr,
217 GtkWidget* widget, 275 GtkWidget* widget,
218 GdkEventExpose* event) { 276 GdkEventExpose* event) {
219 static_cast<PanelBrowserTitlebarGtk*>(titlebar())-> 277 GetPanelTitlebar()->UpdateMinimizeRestoreButtonVisibility();
220 UpdateMinimizeRestoreButtonVisibility();
221 278
222 BrowserWindowGtk::DrawCustomFrame(cr, widget, event); 279 gfx::CairoCachedSurface* surface = GetThemeFrameImage()->ToCairo();
223 280
224 if (is_drawing_attention_) 281 surface->SetSource(cr, widget, 0, 0);
225 DrawAttentionFrame(cr, widget, event); 282 cairo_pattern_set_extend(cairo_get_source(cr), CAIRO_EXTEND_REPEAT);
226 } 283 cairo_rectangle(cr, event->area.x, event->area.y,
227 284 event->area.width, event->area.height);
228 void PanelBrowserWindowGtk::DrawAttentionFrame(cairo_t* cr, 285 cairo_fill(cr);
229 GtkWidget* widget,
230 GdkEventExpose* event) {
231 cairo_set_source_rgb(cr, kDrawAttentionRFraction,
232 kDrawAttentionGFraction,
233 kDrawAttentionBFraction);
234
235 GdkRectangle dest_rectangle = GetTitlebarRectForDrawAttention();
236 GdkRegion* dest_region = gdk_region_rectangle(&dest_rectangle);
237
238 gdk_region_intersect(dest_region, event->region);
239 gdk_cairo_region(cr, dest_region);
240
241 cairo_clip(cr);
242 cairo_paint(cr);
243 gdk_region_destroy(dest_region);
244 } 286 }
245 287
246 void PanelBrowserWindowGtk::ActiveWindowChanged(GdkWindow* active_window) { 288 void PanelBrowserWindowGtk::ActiveWindowChanged(GdkWindow* active_window) {
247 bool was_active = IsActive(); 289 bool was_active = IsActive();
248 BrowserWindowGtk::ActiveWindowChanged(active_window); 290 BrowserWindowGtk::ActiveWindowChanged(active_window);
249 bool is_active = IsActive(); 291 bool is_active = IsActive();
250 if (!window() || was_active == is_active) // State didn't change. 292 if (!window() || was_active == is_active) // State didn't change.
251 return; 293 return;
252 294
253 panel_->OnActiveStateChanged(is_active); 295 panel_->OnActiveStateChanged(is_active);
254 } 296 }
255 297
256 BrowserWindowGtk::TitleDecoration PanelBrowserWindowGtk::GetWindowTitle(
257 std::string* title) const {
258 if (is_drawing_attention_) {
259 std::string title_original;
260 BrowserWindowGtk::TitleDecoration title_decoration =
261 BrowserWindowGtk::GetWindowTitle(&title_original);
262 DCHECK_EQ(BrowserWindowGtk::PLAIN_TEXT, title_decoration);
263 gchar* title_escaped = g_markup_escape_text(title_original.c_str(), -1);
264 gchar* title_with_markup = g_strconcat(kDrawAttentionTitleMarkupPrefix,
265 title_escaped,
266 kDrawAttentionTitleMarkupSuffix,
267 NULL);
268 *title = title_with_markup;
269 g_free(title_escaped);
270 g_free(title_with_markup);
271 return BrowserWindowGtk::PANGO_MARKUP;
272 } else {
273 return BrowserWindowGtk::GetWindowTitle(title);
274 }
275 }
276
277 void PanelBrowserWindowGtk::Observe( 298 void PanelBrowserWindowGtk::Observe(
278 int type, 299 int type,
279 const content::NotificationSource& source, 300 const content::NotificationSource& source,
280 const content::NotificationDetails& details) { 301 const content::NotificationDetails& details) {
281 switch (type) { 302 switch (type) {
282 case chrome::NOTIFICATION_WINDOW_CLOSED: 303 case chrome::NOTIFICATION_WINDOW_CLOSED:
283 // Cleanup. 304 // Cleanup.
284 if (bounds_animator_.get()) 305 if (bounds_animator_.get())
285 bounds_animator_.reset(); 306 bounds_animator_.reset();
286 307
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 } 425 }
405 426
406 void PanelBrowserWindowGtk::DrawAttention(bool draw_attention) { 427 void PanelBrowserWindowGtk::DrawAttention(bool draw_attention) {
407 DCHECK((panel_->attention_mode() & Panel::USE_PANEL_ATTENTION) != 0); 428 DCHECK((panel_->attention_mode() & Panel::USE_PANEL_ATTENTION) != 0);
408 429
409 if (is_drawing_attention_ == draw_attention) 430 if (is_drawing_attention_ == draw_attention)
410 return; 431 return;
411 432
412 is_drawing_attention_ = draw_attention; 433 is_drawing_attention_ = draw_attention;
413 434
414 GdkRectangle rect = GetTitlebarRectForDrawAttention(); 435 GetPanelTitlebar()->UpdateTextColor();
415 gdk_window_invalidate_rect( 436 InvalidateWindow();
416 gtk_widget_get_window(GTK_WIDGET(window())), &rect, TRUE);
417
418 UpdateTitleBar();
419 437
420 if ((panel_->attention_mode() & Panel::USE_SYSTEM_ATTENTION) != 0) 438 if ((panel_->attention_mode() & Panel::USE_SYSTEM_ATTENTION) != 0)
421 ::BrowserWindowGtk::FlashFrame(draw_attention); 439 ::BrowserWindowGtk::FlashFrame(draw_attention);
422 } 440 }
423 441
424 bool PanelBrowserWindowGtk::IsDrawingAttention() const { 442 bool PanelBrowserWindowGtk::IsDrawingAttention() const {
425 return is_drawing_attention_; 443 return is_drawing_attention_;
426 } 444 }
427 445
428 bool PanelBrowserWindowGtk::PreHandlePanelKeyboardEvent( 446 bool PanelBrowserWindowGtk::PreHandlePanelKeyboardEvent(
(...skipping 13 matching lines...) Expand all
442 } 460 }
443 461
444 Browser* PanelBrowserWindowGtk::GetPanelBrowser() const { 462 Browser* PanelBrowserWindowGtk::GetPanelBrowser() const {
445 return browser(); 463 return browser();
446 } 464 }
447 465
448 void PanelBrowserWindowGtk::DestroyPanelBrowser() { 466 void PanelBrowserWindowGtk::DestroyPanelBrowser() {
449 DestroyBrowser(); 467 DestroyBrowser();
450 } 468 }
451 469
452 gfx::Size PanelBrowserWindowGtk::IconOnlySize() const {
453 GtkAllocation allocation;
454 gtk_widget_get_allocation(titlebar_widget(), &allocation);
455 return gfx::Size(titlebar()->IconOnlyWidth(), allocation.height);
456 }
457
458 void PanelBrowserWindowGtk::EnsurePanelFullyVisible() { 470 void PanelBrowserWindowGtk::EnsurePanelFullyVisible() {
459 gtk_window_present(window()); 471 gtk_window_present(window());
460 } 472 }
461 473
462 void PanelBrowserWindowGtk::SetPanelAppIconVisibility(bool visible) { 474 void PanelBrowserWindowGtk::SetPanelAppIconVisibility(bool visible) {
463 return; 475 return;
464 } 476 }
465 477
466 void PanelBrowserWindowGtk::SetPanelAlwaysOnTop(bool on_top) { 478 void PanelBrowserWindowGtk::SetPanelAlwaysOnTop(bool on_top) {
467 gtk_window_set_keep_above(window(), on_top); 479 gtk_window_set_keep_above(window(), on_top);
(...skipping 30 matching lines...) Expand all
498 510
499 bounds_animator_->Start(); 511 bounds_animator_->Start();
500 last_animation_progressed_bounds_ = animation_start_bounds_; 512 last_animation_progressed_bounds_ = animation_start_bounds_;
501 } 513 }
502 514
503 bool PanelBrowserWindowGtk::IsAnimatingBounds() const { 515 bool PanelBrowserWindowGtk::IsAnimatingBounds() const {
504 return bounds_animator_.get() && bounds_animator_->is_animating(); 516 return bounds_animator_.get() && bounds_animator_->is_animating();
505 } 517 }
506 518
507 void PanelBrowserWindowGtk::AnimationEnded(const ui::Animation* animation) { 519 void PanelBrowserWindowGtk::AnimationEnded(const ui::Animation* animation) {
508 titlebar()->SendEnterNotifyToCloseButtonIfUnderMouse(); 520 GetPanelTitlebar()->SendEnterNotifyToCloseButtonIfUnderMouse();
509 panel_->manager()->OnPanelAnimationEnded(panel_.get()); 521 panel_->manager()->OnPanelAnimationEnded(panel_.get());
510 } 522 }
511 523
512 void PanelBrowserWindowGtk::AnimationProgressed( 524 void PanelBrowserWindowGtk::AnimationProgressed(
513 const ui::Animation* animation) { 525 const ui::Animation* animation) {
514 DCHECK(!frame_size_.IsEmpty()); 526 DCHECK(!frame_size_.IsEmpty());
515 527
516 gfx::Rect new_bounds = bounds_animator_->CurrentValueBetween( 528 gfx::Rect new_bounds = bounds_animator_->CurrentValueBetween(
517 animation_start_bounds_, bounds_); 529 animation_start_bounds_, bounds_);
518 530
519 gdk_window_move_resize(gtk_widget_get_window(GTK_WIDGET(window())), 531 gdk_window_move_resize(gtk_widget_get_window(GTK_WIDGET(window())),
520 new_bounds.x(), new_bounds.y(), 532 new_bounds.x(), new_bounds.y(),
521 new_bounds.width(), new_bounds.height()); 533 new_bounds.width(), new_bounds.height());
522 534
523 last_animation_progressed_bounds_ = new_bounds; 535 last_animation_progressed_bounds_ = new_bounds;
524 } 536 }
525 537
526 GdkRectangle PanelBrowserWindowGtk::GetTitlebarRectForDrawAttention() const {
527 GdkRectangle rect;
528 rect.x = 0;
529 rect.y = 0;
530 // We get the window width and not the titlebar_widget() width because we'd
531 // like for the window borders on either side of the title bar to be the same
532 // color.
533 GtkAllocation window_allocation;
534 gtk_widget_get_allocation(GTK_WIDGET(window()), &window_allocation);
535 rect.width = window_allocation.width;
536
537 GtkAllocation titlebar_allocation;
538 gtk_widget_get_allocation(titlebar_widget(), &titlebar_allocation);
539 rect.height = titlebar_allocation.height;
540
541 return rect;
542 }
543
544 gboolean PanelBrowserWindowGtk::OnTitlebarButtonReleaseEvent( 538 gboolean PanelBrowserWindowGtk::OnTitlebarButtonReleaseEvent(
545 GtkWidget* widget, GdkEventButton* event) { 539 GtkWidget* widget, GdkEventButton* event) {
546 if (event->button != 1) 540 if (event->button != 1)
547 return TRUE; 541 return TRUE;
548 542
549 panel_->OnTitlebarClicked((event->state & GDK_CONTROL_MASK) ? 543 panel_->OnTitlebarClicked((event->state & GDK_CONTROL_MASK) ?
550 panel::APPLY_TO_ALL : panel::NO_MODIFIER); 544 panel::APPLY_TO_ALL : panel::NO_MODIFIER);
551 return TRUE; 545 return TRUE;
552 } 546 }
553 547
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 } 637 }
644 638
645 void NativePanelTestingGtk::FinishDragTitlebar() { 639 void NativePanelTestingGtk::FinishDragTitlebar() {
646 if (!panel_browser_window_gtk_->drag_helper_.get()) 640 if (!panel_browser_window_gtk_->drag_helper_.get())
647 return; 641 return;
648 642
649 panel_browser_window_gtk_->drag_helper_->EndDrag(false); 643 panel_browser_window_gtk_->drag_helper_->EndDrag(false);
650 } 644 }
651 645
652 bool NativePanelTestingGtk::VerifyDrawingAttention() const { 646 bool NativePanelTestingGtk::VerifyDrawingAttention() const {
653 std::string title; 647 return panel_browser_window_gtk_->IsDrawingAttention();
654 BrowserWindowGtk::TitleDecoration decoration =
655 panel_browser_window_gtk_->GetWindowTitle(&title);
656 return panel_browser_window_gtk_->IsDrawingAttention() &&
657 decoration == BrowserWindowGtk::PANGO_MARKUP;
658 } 648 }
659 649
660 bool NativePanelTestingGtk::VerifyActiveState(bool is_active) { 650 bool NativePanelTestingGtk::VerifyActiveState(bool is_active) {
661 // TODO(jianli): to be implemented. http://crbug.com/102737 651 // TODO(jianli): to be implemented. http://crbug.com/102737
662 return false; 652 return false;
663 } 653 }
664 654
665 void NativePanelTestingGtk::WaitForWindowCreationToComplete() const { 655 void NativePanelTestingGtk::WaitForWindowCreationToComplete() const {
666 while (panel_browser_window_gtk_->frame_size_.IsEmpty()) 656 while (panel_browser_window_gtk_->frame_size_.IsEmpty())
667 MessageLoopForUI::current()->RunAllPending(); 657 MessageLoopForUI::current()->RunAllPending();
668 while (panel_browser_window_gtk_->IsAnimatingBounds()) 658 while (panel_browser_window_gtk_->IsAnimatingBounds())
669 MessageLoopForUI::current()->RunAllPending(); 659 MessageLoopForUI::current()->RunAllPending();
670 } 660 }
671 661
672 bool NativePanelTestingGtk::IsWindowSizeKnown() const { 662 bool NativePanelTestingGtk::IsWindowSizeKnown() const {
673 return !panel_browser_window_gtk_->frame_size_.IsEmpty(); 663 return !panel_browser_window_gtk_->frame_size_.IsEmpty();
674 } 664 }
675 665
676 bool NativePanelTestingGtk::IsAnimatingBounds() const { 666 bool NativePanelTestingGtk::IsAnimatingBounds() const {
677 return panel_browser_window_gtk_->IsAnimatingBounds(); 667 return panel_browser_window_gtk_->IsAnimatingBounds();
678 } 668 }
679 669
680 bool NativePanelTestingGtk::IsButtonVisible( 670 bool NativePanelTestingGtk::IsButtonVisible(
681 TitlebarButtonType button_type) const { 671 TitlebarButtonType button_type) const {
682 PanelBrowserTitlebarGtk* titlebar = static_cast<PanelBrowserTitlebarGtk*>( 672 PanelBrowserTitlebarGtk* titlebar =
683 panel_browser_window_gtk_->titlebar()); 673 panel_browser_window_gtk_->GetPanelTitlebar();
684 CustomDrawButton* button; 674 CustomDrawButton* button;
685 switch (button_type) { 675 switch (button_type) {
686 case CLOSE_BUTTON: 676 case CLOSE_BUTTON:
687 button = titlebar->close_button(); 677 button = titlebar->close_button();
688 break; 678 break;
689 case MINIMIZE_BUTTON: 679 case MINIMIZE_BUTTON:
690 button = titlebar->minimize_button(); 680 button = titlebar->minimize_button();
691 break; 681 break;
692 case RESTORE_BUTTON: 682 case RESTORE_BUTTON:
693 button = titlebar->unminimize_button(); 683 button = titlebar->unminimize_button();
694 break; 684 break;
695 default: 685 default:
696 NOTREACHED(); 686 NOTREACHED();
697 return false; 687 return false;
698 } 688 }
699 return gtk_widget_get_visible(button->widget()); 689 return gtk_widget_get_visible(button->widget());
700 } 690 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/panels/panel_browser_window_gtk.h ('k') | chrome/browser/ui/panels/panel_titlebar_view_cocoa.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698