| 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_toolbar_gtk.h" | 5 #include "chrome/browser/ui/gtk/browser_toolbar_gtk.h" |
| 6 | 6 |
| 7 #include <X11/XF86keysym.h> | 7 #include <X11/XF86keysym.h> |
| 8 #include <gdk/gdkkeysyms.h> | 8 #include <gdk/gdkkeysyms.h> |
| 9 #include <gtk/gtk.h> | 9 #include <gtk/gtk.h> |
| 10 | 10 |
| (...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 | 470 |
| 471 // We may need to update the roundedness of the toolbar's top corners. In | 471 // We may need to update the roundedness of the toolbar's top corners. In |
| 472 // this case, don't draw; we'll be called again soon enough. | 472 // this case, don't draw; we'll be called again soon enough. |
| 473 if (UpdateRoundedness()) | 473 if (UpdateRoundedness()) |
| 474 return TRUE; | 474 return TRUE; |
| 475 | 475 |
| 476 // We don't need to render the toolbar image in GTK mode. | 476 // We don't need to render the toolbar image in GTK mode. |
| 477 if (theme_service_->UsingNativeTheme()) | 477 if (theme_service_->UsingNativeTheme()) |
| 478 return FALSE; | 478 return FALSE; |
| 479 | 479 |
| 480 cairo_t* cr = gdk_cairo_create(GDK_DRAWABLE(widget->window)); | 480 cairo_t* cr = gdk_cairo_create(gtk_widget_get_window(widget)); |
| 481 gdk_cairo_rectangle(cr, &e->area); | 481 gdk_cairo_rectangle(cr, &e->area); |
| 482 cairo_clip(cr); | 482 cairo_clip(cr); |
| 483 | 483 |
| 484 gfx::Point tabstrip_origin = | 484 gfx::Point tabstrip_origin = |
| 485 window_->tabstrip()->GetTabStripOriginForWidget(widget); | 485 window_->tabstrip()->GetTabStripOriginForWidget(widget); |
| 486 // Fill the entire region with the toolbar color. | 486 // Fill the entire region with the toolbar color. |
| 487 GdkColor color = theme_service_->GetGdkColor( | 487 GdkColor color = theme_service_->GetGdkColor( |
| 488 ThemeService::COLOR_TOOLBAR); | 488 ThemeService::COLOR_TOOLBAR); |
| 489 gdk_cairo_set_source_color(cr, &color); | 489 gdk_cairo_set_source_color(cr, &color); |
| 490 cairo_fill(cr); | 490 cairo_fill(cr); |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 617 } | 617 } |
| 618 | 618 |
| 619 void BrowserToolbarGtk::OnDragDataReceived(GtkWidget* widget, | 619 void BrowserToolbarGtk::OnDragDataReceived(GtkWidget* widget, |
| 620 GdkDragContext* drag_context, gint x, gint y, | 620 GdkDragContext* drag_context, gint x, gint y, |
| 621 GtkSelectionData* data, guint info, guint time) { | 621 GtkSelectionData* data, guint info, guint time) { |
| 622 if (info != ui::TEXT_PLAIN) { | 622 if (info != ui::TEXT_PLAIN) { |
| 623 NOTIMPLEMENTED() << "Only support plain text drops for now, sorry!"; | 623 NOTIMPLEMENTED() << "Only support plain text drops for now, sorry!"; |
| 624 return; | 624 return; |
| 625 } | 625 } |
| 626 | 626 |
| 627 GURL url(reinterpret_cast<char*>(data->data)); | 627 GURL url(reinterpret_cast<const char*>(gtk_selection_data_get_data(data))); |
| 628 if (!url.is_valid()) | 628 if (!url.is_valid()) |
| 629 return; | 629 return; |
| 630 | 630 |
| 631 bool url_is_newtab = url.SchemeIs(chrome::kChromeUIScheme) && | 631 bool url_is_newtab = url.SchemeIs(chrome::kChromeUIScheme) && |
| 632 url.host() == chrome::kChromeUINewTabHost; | 632 url.host() == chrome::kChromeUINewTabHost; |
| 633 home_page_is_new_tab_page_.SetValue(url_is_newtab); | 633 home_page_is_new_tab_page_.SetValue(url_is_newtab); |
| 634 if (!url_is_newtab) | 634 if (!url_is_newtab) |
| 635 home_page_.SetValue(url.spec()); | 635 home_page_.SetValue(url.spec()); |
| 636 } | 636 } |
| 637 | 637 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 681 const SkBitmap* badge = theme_service_->GetBitmapNamed(resource_id); | 681 const SkBitmap* badge = theme_service_->GetBitmapNamed(resource_id); |
| 682 gfx::CanvasSkiaPaint canvas(expose, false); | 682 gfx::CanvasSkiaPaint canvas(expose, false); |
| 683 int x_offset = base::i18n::IsRTL() ? 0 : allocation.width - badge->width(); | 683 int x_offset = base::i18n::IsRTL() ? 0 : allocation.width - badge->width(); |
| 684 int y_offset = 0; | 684 int y_offset = 0; |
| 685 canvas.DrawBitmapInt(*badge, | 685 canvas.DrawBitmapInt(*badge, |
| 686 allocation.x + x_offset, | 686 allocation.x + x_offset, |
| 687 allocation.y + y_offset); | 687 allocation.y + y_offset); |
| 688 | 688 |
| 689 return FALSE; | 689 return FALSE; |
| 690 } | 690 } |
| OLD | NEW |