| 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 #include "chrome/browser/ui/gtk/browser_window_gtk.h" | 5 #include "chrome/browser/ui/gtk/browser_window_gtk.h" |
| 6 | 6 |
| 7 #include <gdk/gdkkeysyms.h> | 7 #include <gdk/gdkkeysyms.h> |
| 8 | 8 |
| 9 #include <dlfcn.h> | 9 #include <dlfcn.h> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 #include "chrome/browser/ui/browser_list.h" | 39 #include "chrome/browser/ui/browser_list.h" |
| 40 #include "chrome/browser/ui/find_bar/find_bar_controller.h" | 40 #include "chrome/browser/ui/find_bar/find_bar_controller.h" |
| 41 #include "chrome/browser/ui/find_bar/find_tab_helper.h" | 41 #include "chrome/browser/ui/find_bar/find_tab_helper.h" |
| 42 #include "chrome/browser/ui/gtk/about_chrome_dialog.h" | 42 #include "chrome/browser/ui/gtk/about_chrome_dialog.h" |
| 43 #include "chrome/browser/ui/gtk/accelerators_gtk.h" | 43 #include "chrome/browser/ui/gtk/accelerators_gtk.h" |
| 44 #include "chrome/browser/ui/gtk/avatar_menu_button_gtk.h" | 44 #include "chrome/browser/ui/gtk/avatar_menu_button_gtk.h" |
| 45 #include "chrome/browser/ui/gtk/avatar_menu_bubble_gtk.h" | 45 #include "chrome/browser/ui/gtk/avatar_menu_bubble_gtk.h" |
| 46 #include "chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.h" | 46 #include "chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.h" |
| 47 #include "chrome/browser/ui/gtk/browser_titlebar.h" | 47 #include "chrome/browser/ui/gtk/browser_titlebar.h" |
| 48 #include "chrome/browser/ui/gtk/browser_toolbar_gtk.h" | 48 #include "chrome/browser/ui/gtk/browser_toolbar_gtk.h" |
| 49 #include "chrome/browser/ui/gtk/cairo_cached_surface.h" | |
| 50 #include "chrome/browser/ui/gtk/collected_cookies_gtk.h" | 49 #include "chrome/browser/ui/gtk/collected_cookies_gtk.h" |
| 51 #include "chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.h" | 50 #include "chrome/browser/ui/gtk/create_application_shortcuts_dialog_gtk.h" |
| 52 #include "chrome/browser/ui/gtk/download/download_in_progress_dialog_gtk.h" | 51 #include "chrome/browser/ui/gtk/download/download_in_progress_dialog_gtk.h" |
| 53 #include "chrome/browser/ui/gtk/download/download_shelf_gtk.h" | 52 #include "chrome/browser/ui/gtk/download/download_shelf_gtk.h" |
| 54 #include "chrome/browser/ui/gtk/edit_search_engine_dialog.h" | 53 #include "chrome/browser/ui/gtk/edit_search_engine_dialog.h" |
| 55 #include "chrome/browser/ui/gtk/find_bar_gtk.h" | 54 #include "chrome/browser/ui/gtk/find_bar_gtk.h" |
| 56 #include "chrome/browser/ui/gtk/fullscreen_exit_bubble_gtk.h" | 55 #include "chrome/browser/ui/gtk/fullscreen_exit_bubble_gtk.h" |
| 57 #include "chrome/browser/ui/gtk/global_menu_bar.h" | 56 #include "chrome/browser/ui/gtk/global_menu_bar.h" |
| 58 #include "chrome/browser/ui/gtk/gtk_theme_service.h" | 57 #include "chrome/browser/ui/gtk/gtk_theme_service.h" |
| 59 #include "chrome/browser/ui/gtk/gtk_util.h" | 58 #include "chrome/browser/ui/gtk/gtk_util.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 90 #include "grit/generated_resources.h" | 89 #include "grit/generated_resources.h" |
| 91 #include "grit/theme_resources.h" | 90 #include "grit/theme_resources.h" |
| 92 #include "grit/theme_resources_standard.h" | 91 #include "grit/theme_resources_standard.h" |
| 93 #include "grit/ui_resources.h" | 92 #include "grit/ui_resources.h" |
| 94 #include "ui/base/gtk/gtk_floating_container.h" | 93 #include "ui/base/gtk/gtk_floating_container.h" |
| 95 #include "ui/base/gtk/gtk_hig_constants.h" | 94 #include "ui/base/gtk/gtk_hig_constants.h" |
| 96 #include "ui/base/keycodes/keyboard_codes.h" | 95 #include "ui/base/keycodes/keyboard_codes.h" |
| 97 #include "ui/base/l10n/l10n_util.h" | 96 #include "ui/base/l10n/l10n_util.h" |
| 98 #include "ui/base/x/active_window_watcher_x.h" | 97 #include "ui/base/x/active_window_watcher_x.h" |
| 99 #include "ui/gfx/gtk_util.h" | 98 #include "ui/gfx/gtk_util.h" |
| 99 #include "ui/gfx/image/cairo_cached_surface.h" |
| 100 #include "ui/gfx/rect.h" | 100 #include "ui/gfx/rect.h" |
| 101 #include "ui/gfx/skia_utils_gtk.h" | 101 #include "ui/gfx/skia_utils_gtk.h" |
| 102 | 102 |
| 103 namespace { | 103 namespace { |
| 104 | 104 |
| 105 // The number of milliseconds between loading animation frames. | 105 // The number of milliseconds between loading animation frames. |
| 106 const int kLoadingAnimationFrameTimeMs = 30; | 106 const int kLoadingAnimationFrameTimeMs = 30; |
| 107 | 107 |
| 108 // Minimal height of devotools pane or content pane when devtools are docked | 108 // Minimal height of devotools pane or content pane when devtools are docked |
| 109 // to the browser window. | 109 // to the browser window. |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 void BrowserWindowGtk::DrawContentShadow(cairo_t* cr) { | 446 void BrowserWindowGtk::DrawContentShadow(cairo_t* cr) { |
| 447 // Draw the shadow above the toolbar. Tabs on the tabstrip will draw over us. | 447 // Draw the shadow above the toolbar. Tabs on the tabstrip will draw over us. |
| 448 GtkThemeService* theme_provider = GtkThemeService::GetFrom( | 448 GtkThemeService* theme_provider = GtkThemeService::GetFrom( |
| 449 browser()->profile()); | 449 browser()->profile()); |
| 450 int left_x, top_y; | 450 int left_x, top_y; |
| 451 gtk_widget_translate_coordinates(toolbar_->widget(), | 451 gtk_widget_translate_coordinates(toolbar_->widget(), |
| 452 GTK_WIDGET(window_), 0, 0, &left_x, | 452 GTK_WIDGET(window_), 0, 0, &left_x, |
| 453 &top_y); | 453 &top_y); |
| 454 int center_width = window_vbox_->allocation.width; | 454 int center_width = window_vbox_->allocation.width; |
| 455 | 455 |
| 456 CairoCachedSurface* top_center = theme_provider->GetSurfaceNamed( | 456 gfx::CairoCachedSurface* top_center = theme_provider->GetSurfaceNamed( |
| 457 IDR_CONTENT_TOP_CENTER, GTK_WIDGET(window_)); | 457 IDR_CONTENT_TOP_CENTER, GTK_WIDGET(window_)); |
| 458 CairoCachedSurface* top_right = theme_provider->GetSurfaceNamed( | 458 gfx::CairoCachedSurface* top_right = theme_provider->GetSurfaceNamed( |
| 459 IDR_CONTENT_TOP_RIGHT_CORNER, GTK_WIDGET(window_)); | 459 IDR_CONTENT_TOP_RIGHT_CORNER, GTK_WIDGET(window_)); |
| 460 CairoCachedSurface* top_left = theme_provider->GetSurfaceNamed( | 460 gfx::CairoCachedSurface* top_left = theme_provider->GetSurfaceNamed( |
| 461 IDR_CONTENT_TOP_LEFT_CORNER, GTK_WIDGET(window_)); | 461 IDR_CONTENT_TOP_LEFT_CORNER, GTK_WIDGET(window_)); |
| 462 | 462 |
| 463 int center_left_x = left_x; | 463 int center_left_x = left_x; |
| 464 if (ShouldDrawContentDropShadow()) { | 464 if (ShouldDrawContentDropShadow()) { |
| 465 // Don't draw over the corners. | 465 // Don't draw over the corners. |
| 466 center_left_x += top_left->Width() - kContentShadowThickness; | 466 center_left_x += top_left->Width() - kContentShadowThickness; |
| 467 center_width -= (top_left->Width() + top_right->Width()); | 467 center_width -= (top_left->Width() + top_right->Width()); |
| 468 center_width += 2 * kContentShadowThickness; | 468 center_width += 2 * kContentShadowThickness; |
| 469 } | 469 } |
| 470 | 470 |
| 471 top_center->SetSource(cr, center_left_x, top_y - kContentShadowThickness); | 471 top_center->SetSource(cr, GTK_WIDGET(window_), |
| 472 center_left_x, top_y - kContentShadowThickness); |
| 472 cairo_pattern_set_extend(cairo_get_source(cr), CAIRO_EXTEND_REPEAT); | 473 cairo_pattern_set_extend(cairo_get_source(cr), CAIRO_EXTEND_REPEAT); |
| 473 cairo_rectangle(cr, center_left_x, top_y - kContentShadowThickness, | 474 cairo_rectangle(cr, center_left_x, top_y - kContentShadowThickness, |
| 474 center_width, top_center->Height()); | 475 center_width, top_center->Height()); |
| 475 cairo_fill(cr); | 476 cairo_fill(cr); |
| 476 | 477 |
| 477 // Only draw the rest of the shadow if the user has the custom frame enabled | 478 // Only draw the rest of the shadow if the user has the custom frame enabled |
| 478 // and the browser is not maximized. | 479 // and the browser is not maximized. |
| 479 if (!ShouldDrawContentDropShadow()) | 480 if (!ShouldDrawContentDropShadow()) |
| 480 return; | 481 return; |
| 481 | 482 |
| 482 // The top left corner has a width of 3 pixels. On Windows, the last column | 483 // The top left corner has a width of 3 pixels. On Windows, the last column |
| 483 // of pixels overlap the toolbar. We just crop it off on Linux. The top | 484 // of pixels overlap the toolbar. We just crop it off on Linux. The top |
| 484 // corners extend to the base of the toolbar (one pixel above the dividing | 485 // corners extend to the base of the toolbar (one pixel above the dividing |
| 485 // line). | 486 // line). |
| 486 int right_x = center_left_x + center_width; | 487 int right_x = center_left_x + center_width; |
| 487 top_left->SetSource( | 488 top_left->SetSource(cr, GTK_WIDGET(window_), |
| 488 cr, left_x - kContentShadowThickness, top_y - kContentShadowThickness); | 489 left_x - kContentShadowThickness, top_y - kContentShadowThickness); |
| 489 // The toolbar is shorter in location bar only mode so clip the image to the | 490 // The toolbar is shorter in location bar only mode so clip the image to the |
| 490 // height of the toolbar + the amount of shadow above the toolbar. | 491 // height of the toolbar + the amount of shadow above the toolbar. |
| 491 cairo_rectangle(cr, | 492 cairo_rectangle(cr, |
| 492 left_x - kContentShadowThickness, | 493 left_x - kContentShadowThickness, |
| 493 top_y - kContentShadowThickness, | 494 top_y - kContentShadowThickness, |
| 494 top_left->Width(), | 495 top_left->Width(), |
| 495 top_left->Height()); | 496 top_left->Height()); |
| 496 cairo_fill(cr); | 497 cairo_fill(cr); |
| 497 | 498 |
| 498 // Likewise, we crop off the left column of pixels for the top right corner. | 499 // Likewise, we crop off the left column of pixels for the top right corner. |
| 499 top_right->SetSource(cr, right_x, top_y - kContentShadowThickness); | 500 top_right->SetSource(cr, GTK_WIDGET(window_), |
| 501 right_x, top_y - kContentShadowThickness); |
| 500 cairo_rectangle(cr, | 502 cairo_rectangle(cr, |
| 501 right_x, | 503 right_x, |
| 502 top_y - kContentShadowThickness, | 504 top_y - kContentShadowThickness, |
| 503 top_right->Width(), | 505 top_right->Width(), |
| 504 top_right->Height()); | 506 top_right->Height()); |
| 505 cairo_fill(cr); | 507 cairo_fill(cr); |
| 506 | 508 |
| 507 // Fill in the sides. As above, we only draw 2 of the 3 columns on Linux. | 509 // Fill in the sides. As above, we only draw 2 of the 3 columns on Linux. |
| 508 int bottom_y; | 510 int bottom_y; |
| 509 gtk_widget_translate_coordinates(window_vbox_, | 511 gtk_widget_translate_coordinates(window_vbox_, |
| 510 GTK_WIDGET(window_), | 512 GTK_WIDGET(window_), |
| 511 0, window_vbox_->allocation.height, | 513 0, window_vbox_->allocation.height, |
| 512 NULL, &bottom_y); | 514 NULL, &bottom_y); |
| 513 // |side_y| is where to start drawing the side shadows. The top corners draw | 515 // |side_y| is where to start drawing the side shadows. The top corners draw |
| 514 // the sides down to the bottom of the toolbar. | 516 // the sides down to the bottom of the toolbar. |
| 515 int side_y = top_y - kContentShadowThickness + top_right->Height(); | 517 int side_y = top_y - kContentShadowThickness + top_right->Height(); |
| 516 // |side_height| is how many pixels to draw for the side borders. We do one | 518 // |side_height| is how many pixels to draw for the side borders. We do one |
| 517 // pixel before the bottom of the web contents because that extra pixel is | 519 // pixel before the bottom of the web contents because that extra pixel is |
| 518 // drawn by the bottom corners. | 520 // drawn by the bottom corners. |
| 519 int side_height = bottom_y - side_y - 1; | 521 int side_height = bottom_y - side_y - 1; |
| 520 if (side_height > 0) { | 522 if (side_height > 0) { |
| 521 CairoCachedSurface* left = theme_provider->GetSurfaceNamed( | 523 gfx::CairoCachedSurface* left = theme_provider->GetSurfaceNamed( |
| 522 IDR_CONTENT_LEFT_SIDE, GTK_WIDGET(window_)); | 524 IDR_CONTENT_LEFT_SIDE, GTK_WIDGET(window_)); |
| 523 left->SetSource(cr, left_x - kContentShadowThickness, side_y); | 525 left->SetSource(cr, GTK_WIDGET(window_), |
| 526 left_x - kContentShadowThickness, side_y); |
| 524 cairo_pattern_set_extend(cairo_get_source(cr), CAIRO_EXTEND_REPEAT); | 527 cairo_pattern_set_extend(cairo_get_source(cr), CAIRO_EXTEND_REPEAT); |
| 525 cairo_rectangle(cr, | 528 cairo_rectangle(cr, |
| 526 left_x - kContentShadowThickness, | 529 left_x - kContentShadowThickness, |
| 527 side_y, | 530 side_y, |
| 528 kContentShadowThickness, | 531 kContentShadowThickness, |
| 529 side_height); | 532 side_height); |
| 530 cairo_fill(cr); | 533 cairo_fill(cr); |
| 531 | 534 |
| 532 CairoCachedSurface* right = theme_provider->GetSurfaceNamed( | 535 gfx::CairoCachedSurface* right = theme_provider->GetSurfaceNamed( |
| 533 IDR_CONTENT_RIGHT_SIDE, GTK_WIDGET(window_)); | 536 IDR_CONTENT_RIGHT_SIDE, GTK_WIDGET(window_)); |
| 534 int right_side_x = | 537 int right_side_x = |
| 535 right_x + top_right->Width() - kContentShadowThickness - 1; | 538 right_x + top_right->Width() - kContentShadowThickness - 1; |
| 536 right->SetSource(cr, right_side_x, side_y); | 539 right->SetSource(cr, GTK_WIDGET(window_), right_side_x, side_y); |
| 537 cairo_pattern_set_extend(cairo_get_source(cr), CAIRO_EXTEND_REPEAT); | 540 cairo_pattern_set_extend(cairo_get_source(cr), CAIRO_EXTEND_REPEAT); |
| 538 cairo_rectangle(cr, | 541 cairo_rectangle(cr, |
| 539 right_side_x, | 542 right_side_x, |
| 540 side_y, | 543 side_y, |
| 541 kContentShadowThickness, | 544 kContentShadowThickness, |
| 542 side_height); | 545 side_height); |
| 543 cairo_fill(cr); | 546 cairo_fill(cr); |
| 544 } | 547 } |
| 545 | 548 |
| 546 // Draw the bottom corners. The bottom corners also draw the bottom row of | 549 // Draw the bottom corners. The bottom corners also draw the bottom row of |
| 547 // pixels of the side shadows. | 550 // pixels of the side shadows. |
| 548 CairoCachedSurface* bottom_left = theme_provider->GetSurfaceNamed( | 551 gfx::CairoCachedSurface* bottom_left = theme_provider->GetSurfaceNamed( |
| 549 IDR_CONTENT_BOTTOM_LEFT_CORNER, GTK_WIDGET(window_)); | 552 IDR_CONTENT_BOTTOM_LEFT_CORNER, GTK_WIDGET(window_)); |
| 550 bottom_left->SetSource(cr, left_x - kContentShadowThickness, bottom_y - 1); | 553 bottom_left->SetSource(cr, GTK_WIDGET(window_), |
| 554 left_x - kContentShadowThickness, bottom_y - 1); |
| 551 cairo_paint(cr); | 555 cairo_paint(cr); |
| 552 | 556 |
| 553 CairoCachedSurface* bottom_right = theme_provider->GetSurfaceNamed( | 557 gfx::CairoCachedSurface* bottom_right = theme_provider->GetSurfaceNamed( |
| 554 IDR_CONTENT_BOTTOM_RIGHT_CORNER, GTK_WIDGET(window_)); | 558 IDR_CONTENT_BOTTOM_RIGHT_CORNER, GTK_WIDGET(window_)); |
| 555 bottom_right->SetSource(cr, right_x - 1, bottom_y - 1); | 559 bottom_right->SetSource(cr, GTK_WIDGET(window_), right_x - 1, bottom_y - 1); |
| 556 cairo_paint(cr); | 560 cairo_paint(cr); |
| 557 | 561 |
| 558 // Finally, draw the bottom row. Since we don't overlap the contents, we clip | 562 // Finally, draw the bottom row. Since we don't overlap the contents, we clip |
| 559 // the top row of pixels. | 563 // the top row of pixels. |
| 560 CairoCachedSurface* bottom = theme_provider->GetSurfaceNamed( | 564 gfx::CairoCachedSurface* bottom = theme_provider->GetSurfaceNamed( |
| 561 IDR_CONTENT_BOTTOM_CENTER, GTK_WIDGET(window_)); | 565 IDR_CONTENT_BOTTOM_CENTER, GTK_WIDGET(window_)); |
| 562 bottom->SetSource(cr, left_x + 1, bottom_y - 1); | 566 bottom->SetSource(cr, GTK_WIDGET(window_), left_x + 1, bottom_y - 1); |
| 563 cairo_pattern_set_extend(cairo_get_source(cr), CAIRO_EXTEND_REPEAT); | 567 cairo_pattern_set_extend(cairo_get_source(cr), CAIRO_EXTEND_REPEAT); |
| 564 cairo_rectangle(cr, | 568 cairo_rectangle(cr, |
| 565 left_x + 1, | 569 left_x + 1, |
| 566 bottom_y, | 570 bottom_y, |
| 567 window_vbox_->allocation.width - 2, | 571 window_vbox_->allocation.width - 2, |
| 568 kContentShadowThickness); | 572 kContentShadowThickness); |
| 569 cairo_fill(cr); | 573 cairo_fill(cr); |
| 570 } | 574 } |
| 571 | 575 |
| 572 void BrowserWindowGtk::DrawPopupFrame(cairo_t* cr, | 576 void BrowserWindowGtk::DrawPopupFrame(cairo_t* cr, |
| 573 GtkWidget* widget, | 577 GtkWidget* widget, |
| 574 GdkEventExpose* event) { | 578 GdkEventExpose* event) { |
| 575 GtkThemeService* theme_provider = GtkThemeService::GetFrom( | 579 GtkThemeService* theme_provider = GtkThemeService::GetFrom( |
| 576 browser()->profile()); | 580 browser()->profile()); |
| 577 | 581 |
| 578 // Like DrawCustomFrame(), except that we use the unthemed resources to draw | 582 // Like DrawCustomFrame(), except that we use the unthemed resources to draw |
| 579 // the background. We do this because we can't rely on sane images in the | 583 // the background. We do this because we can't rely on sane images in the |
| 580 // theme that we can draw text on. (We tried using the tab background, but | 584 // theme that we can draw text on. (We tried using the tab background, but |
| 581 // that has inverse saturation from what the user usually expects). | 585 // that has inverse saturation from what the user usually expects). |
| 582 int image_name = GetThemeFrameResource(); | 586 int image_name = GetThemeFrameResource(); |
| 583 CairoCachedSurface* surface = theme_provider->GetUnthemedSurfaceNamed( | 587 gfx::CairoCachedSurface* surface = theme_provider->GetUnthemedSurfaceNamed( |
| 584 image_name, widget); | 588 image_name, widget); |
| 585 surface->SetSource(cr, 0, GetVerticalOffset()); | 589 surface->SetSource(cr, widget, 0, GetVerticalOffset()); |
| 586 cairo_pattern_set_extend(cairo_get_source(cr), CAIRO_EXTEND_REFLECT); | 590 cairo_pattern_set_extend(cairo_get_source(cr), CAIRO_EXTEND_REFLECT); |
| 587 cairo_rectangle(cr, event->area.x, event->area.y, | 591 cairo_rectangle(cr, event->area.x, event->area.y, |
| 588 event->area.width, event->area.height); | 592 event->area.width, event->area.height); |
| 589 cairo_fill(cr); | 593 cairo_fill(cr); |
| 590 } | 594 } |
| 591 | 595 |
| 592 void BrowserWindowGtk::DrawCustomFrame(cairo_t* cr, | 596 void BrowserWindowGtk::DrawCustomFrame(cairo_t* cr, |
| 593 GtkWidget* widget, | 597 GtkWidget* widget, |
| 594 GdkEventExpose* event) { | 598 GdkEventExpose* event) { |
| 595 GtkThemeService* theme_provider = GtkThemeService::GetFrom( | 599 GtkThemeService* theme_provider = GtkThemeService::GetFrom( |
| 596 browser()->profile()); | 600 browser()->profile()); |
| 597 | 601 |
| 598 int image_name = GetThemeFrameResource(); | 602 int image_name = GetThemeFrameResource(); |
| 599 | 603 |
| 600 CairoCachedSurface* surface = theme_provider->GetSurfaceNamed( | 604 gfx::CairoCachedSurface* surface = theme_provider->GetSurfaceNamed( |
| 601 image_name, widget); | 605 image_name, widget); |
| 602 if (event->area.y < surface->Height()) { | 606 if (event->area.y < surface->Height()) { |
| 603 surface->SetSource(cr, 0, GetVerticalOffset()); | 607 surface->SetSource(cr, widget, 0, GetVerticalOffset()); |
| 604 | 608 |
| 605 // The frame background isn't tiled vertically. | 609 // The frame background isn't tiled vertically. |
| 606 cairo_pattern_set_extend(cairo_get_source(cr), CAIRO_EXTEND_REPEAT); | 610 cairo_pattern_set_extend(cairo_get_source(cr), CAIRO_EXTEND_REPEAT); |
| 607 cairo_rectangle(cr, event->area.x, event->area.y, | 611 cairo_rectangle(cr, event->area.x, event->area.y, |
| 608 event->area.width, surface->Height() - event->area.y); | 612 event->area.width, surface->Height() - event->area.y); |
| 609 cairo_fill(cr); | 613 cairo_fill(cr); |
| 610 } | 614 } |
| 611 | 615 |
| 612 if (theme_provider->HasCustomImage(IDR_THEME_FRAME_OVERLAY) && | 616 if (theme_provider->HasCustomImage(IDR_THEME_FRAME_OVERLAY) && |
| 613 !browser()->profile()->IsOffTheRecord()) { | 617 !browser()->profile()->IsOffTheRecord()) { |
| 614 CairoCachedSurface* theme_overlay = theme_provider->GetSurfaceNamed( | 618 gfx::CairoCachedSurface* theme_overlay = theme_provider->GetSurfaceNamed( |
| 615 IsActive() ? IDR_THEME_FRAME_OVERLAY | 619 IsActive() ? IDR_THEME_FRAME_OVERLAY |
| 616 : IDR_THEME_FRAME_OVERLAY_INACTIVE, widget); | 620 : IDR_THEME_FRAME_OVERLAY_INACTIVE, widget); |
| 617 theme_overlay->SetSource(cr, 0, GetVerticalOffset()); | 621 theme_overlay->SetSource(cr, widget, 0, GetVerticalOffset()); |
| 618 cairo_paint(cr); | 622 cairo_paint(cr); |
| 619 } | 623 } |
| 620 } | 624 } |
| 621 | 625 |
| 622 int BrowserWindowGtk::GetVerticalOffset() { | 626 int BrowserWindowGtk::GetVerticalOffset() { |
| 623 return (IsMaximized() || (!UseCustomFrame())) ? | 627 return (IsMaximized() || (!UseCustomFrame())) ? |
| 624 -kCustomFrameBackgroundVerticalOffset : 0; | 628 -kCustomFrameBackgroundVerticalOffset : 0; |
| 625 } | 629 } |
| 626 | 630 |
| 627 int BrowserWindowGtk::GetThemeFrameResource() { | 631 int BrowserWindowGtk::GetThemeFrameResource() { |
| (...skipping 1800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2428 wm_type == ui::WM_OPENBOX || | 2432 wm_type == ui::WM_OPENBOX || |
| 2429 wm_type == ui::WM_XFWM4); | 2433 wm_type == ui::WM_XFWM4); |
| 2430 } | 2434 } |
| 2431 | 2435 |
| 2432 // static | 2436 // static |
| 2433 BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) { | 2437 BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) { |
| 2434 BrowserWindowGtk* browser_window_gtk = new BrowserWindowGtk(browser); | 2438 BrowserWindowGtk* browser_window_gtk = new BrowserWindowGtk(browser); |
| 2435 browser_window_gtk->Init(); | 2439 browser_window_gtk->Init(); |
| 2436 return browser_window_gtk; | 2440 return browser_window_gtk; |
| 2437 } | 2441 } |
| OLD | NEW |