| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/gtk/browser_toolbar_gtk.h" | 5 #include "chrome/browser/gtk/browser_toolbar_gtk.h" |
| 6 | 6 |
| 7 #include <gdk/gdkkeysyms.h> | 7 #include <gdk/gdkkeysyms.h> |
| 8 #include <X11/XF86keysym.h> | 8 #include <X11/XF86keysym.h> |
| 9 | 9 |
| 10 #include "app/gtk_dnd_util.h" | 10 #include "app/gtk_dnd_util.h" |
| 11 #include "app/l10n_util.h" | 11 #include "app/l10n_util.h" |
| 12 #include "app/resource_bundle.h" | 12 #include "app/resource_bundle.h" |
| 13 #include "base/base_paths_linux.h" | 13 #include "base/base_paths_linux.h" |
| 14 #include "base/gfx/gtk_util.h" | 14 #include "base/gfx/gtk_util.h" |
| 15 #include "base/logging.h" | 15 #include "base/logging.h" |
| 16 #include "base/path_service.h" | 16 #include "base/path_service.h" |
| 17 #include "chrome/app/chrome_dll_resource.h" | 17 #include "chrome/app/chrome_dll_resource.h" |
| 18 #include "chrome/browser/browser.h" | 18 #include "chrome/browser/browser.h" |
| 19 #include "chrome/browser/browser_theme_provider.h" | 19 #include "chrome/browser/browser_theme_provider.h" |
| 20 #include "chrome/browser/encoding_menu_controller.h" | 20 #include "chrome/browser/encoding_menu_controller.h" |
| 21 #include "chrome/browser/gtk/back_forward_button_gtk.h" | 21 #include "chrome/browser/gtk/back_forward_button_gtk.h" |
| 22 #include "chrome/browser/gtk/browser_window_gtk.h" | 22 #include "chrome/browser/gtk/browser_window_gtk.h" |
| 23 #include "chrome/browser/gtk/cairo_cached_surface.h" | |
| 24 #include "chrome/browser/gtk/custom_button.h" | 23 #include "chrome/browser/gtk/custom_button.h" |
| 25 #include "chrome/browser/gtk/go_button_gtk.h" | 24 #include "chrome/browser/gtk/go_button_gtk.h" |
| 26 #include "chrome/browser/gtk/gtk_chrome_button.h" | 25 #include "chrome/browser/gtk/gtk_chrome_button.h" |
| 27 #include "chrome/browser/gtk/gtk_theme_provider.h" | 26 #include "chrome/browser/gtk/gtk_theme_provider.h" |
| 28 #include "chrome/browser/gtk/location_bar_view_gtk.h" | 27 #include "chrome/browser/gtk/location_bar_view_gtk.h" |
| 29 #include "chrome/browser/gtk/standard_menus.h" | 28 #include "chrome/browser/gtk/standard_menus.h" |
| 30 #include "chrome/browser/gtk/tabs/tab_strip_gtk.h" | 29 #include "chrome/browser/gtk/tabs/tab_strip_gtk.h" |
| 31 #include "chrome/browser/gtk/toolbar_star_toggle_gtk.h" | 30 #include "chrome/browser/gtk/toolbar_star_toggle_gtk.h" |
| 32 #include "chrome/browser/gtk/view_id_util.h" | 31 #include "chrome/browser/gtk/view_id_util.h" |
| 33 #include "chrome/browser/net/url_fixer_upper.h" | 32 #include "chrome/browser/net/url_fixer_upper.h" |
| (...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 535 | 534 |
| 536 cairo_t* cr = gdk_cairo_create(GDK_DRAWABLE(widget->window)); | 535 cairo_t* cr = gdk_cairo_create(GDK_DRAWABLE(widget->window)); |
| 537 cairo_rectangle(cr, e->area.x, e->area.y, e->area.width, e->area.height); | 536 cairo_rectangle(cr, e->area.x, e->area.y, e->area.width, e->area.height); |
| 538 cairo_clip(cr); | 537 cairo_clip(cr); |
| 539 // The toolbar is supposed to blend in with the active tab, so we have to pass | 538 // The toolbar is supposed to blend in with the active tab, so we have to pass |
| 540 // coordinates for the IDR_THEME_TOOLBAR bitmap relative to the top of the | 539 // coordinates for the IDR_THEME_TOOLBAR bitmap relative to the top of the |
| 541 // tab strip. | 540 // tab strip. |
| 542 gfx::Point tabstrip_origin = | 541 gfx::Point tabstrip_origin = |
| 543 toolbar->window_->tabstrip()->GetTabStripOriginForWidget(widget); | 542 toolbar->window_->tabstrip()->GetTabStripOriginForWidget(widget); |
| 544 GtkThemeProvider* theme_provider = toolbar->theme_provider_; | 543 GtkThemeProvider* theme_provider = toolbar->theme_provider_; |
| 545 CairoCachedSurface* background = theme_provider->GetSurfaceNamed( | 544 GdkPixbuf* toolbar_background = theme_provider->GetPixbufNamed( |
| 546 IDR_THEME_TOOLBAR, widget); | 545 IDR_THEME_TOOLBAR); |
| 547 background->SetSource(cr, tabstrip_origin.x(), tabstrip_origin.y()); | 546 gdk_cairo_set_source_pixbuf(cr, toolbar_background, tabstrip_origin.x(), |
| 547 tabstrip_origin.y()); |
| 548 // We tile the toolbar background in both directions. | 548 // We tile the toolbar background in both directions. |
| 549 cairo_pattern_set_extend(cairo_get_source(cr), CAIRO_EXTEND_REPEAT); | 549 cairo_pattern_set_extend(cairo_get_source(cr), CAIRO_EXTEND_REPEAT); |
| 550 cairo_rectangle(cr, | 550 cairo_rectangle(cr, |
| 551 tabstrip_origin.x(), | 551 tabstrip_origin.x(), |
| 552 tabstrip_origin.y(), | 552 tabstrip_origin.y(), |
| 553 e->area.x + e->area.width - tabstrip_origin.x(), | 553 e->area.x + e->area.width - tabstrip_origin.x(), |
| 554 e->area.y + e->area.height - tabstrip_origin.y()); | 554 e->area.y + e->area.height - tabstrip_origin.y()); |
| 555 cairo_fill(cr); | 555 cairo_fill(cr); |
| 556 cairo_destroy(cr); | 556 cairo_destroy(cr); |
| 557 | 557 |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 693 menu->PopupAsFromKeyEvent(button); | 693 menu->PopupAsFromKeyEvent(button); |
| 694 menu_bar_helper_.MenuStartedShowing(button, menu->widget()); | 694 menu_bar_helper_.MenuStartedShowing(button, menu->widget()); |
| 695 } | 695 } |
| 696 | 696 |
| 697 void BrowserToolbarGtk::PopupForButtonNextTo(GtkWidget* button, | 697 void BrowserToolbarGtk::PopupForButtonNextTo(GtkWidget* button, |
| 698 GtkMenuDirectionType dir) { | 698 GtkMenuDirectionType dir) { |
| 699 GtkWidget* other_button = button == page_menu_button_.get() ? | 699 GtkWidget* other_button = button == page_menu_button_.get() ? |
| 700 app_menu_button_.get() : page_menu_button_.get(); | 700 app_menu_button_.get() : page_menu_button_.get(); |
| 701 PopupForButton(other_button); | 701 PopupForButton(other_button); |
| 702 } | 702 } |
| OLD | NEW |