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/bookmarks/bookmark_utils_gtk.h" | 5 #include "chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.h" |
6 | 6 |
7 #include "base/pickle.h" | 7 #include "base/pickle.h" |
8 #include "base/string16.h" | 8 #include "base/string16.h" |
9 #include "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 gdk_cairo_rectangle(cr, &event->area); | 128 gdk_cairo_rectangle(cr, &event->area); |
129 cairo_clip(cr); | 129 cairo_clip(cr); |
130 cairo_set_operator(cr, CAIRO_OPERATOR_CLEAR); | 130 cairo_set_operator(cr, CAIRO_OPERATOR_CLEAR); |
131 cairo_paint(cr); | 131 cairo_paint(cr); |
132 | 132 |
133 cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE); | 133 cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE); |
134 gdk_cairo_set_source_pixbuf(cr, data->favicon, 0, 0); | 134 gdk_cairo_set_source_pixbuf(cr, data->favicon, 0, 0); |
135 cairo_paint(cr); | 135 cairo_paint(cr); |
136 cairo_destroy(cr); | 136 cairo_destroy(cr); |
137 | 137 |
| 138 GtkAllocation allocation; |
| 139 gtk_widget_get_allocation(sender, &allocation); |
| 140 |
138 // Paint the title text. | 141 // Paint the title text. |
139 gfx::CanvasSkiaPaint canvas(event, false); | 142 gfx::CanvasSkiaPaint canvas(event, false); |
140 int text_x = gdk_pixbuf_get_width(data->favicon) + kBarButtonPadding; | 143 int text_x = gdk_pixbuf_get_width(data->favicon) + kBarButtonPadding; |
141 int text_width = sender->allocation.width - text_x; | 144 int text_width = allocation.width - text_x; |
142 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 145 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
143 const gfx::Font& base_font = rb.GetFont(ResourceBundle::BaseFont); | 146 const gfx::Font& base_font = rb.GetFont(ResourceBundle::BaseFont); |
144 canvas.DrawStringInt(data->text, base_font, data->text_color, | 147 canvas.DrawStringInt(data->text, base_font, data->text_color, |
145 text_x, 0, text_width, sender->allocation.height); | 148 text_x, 0, text_width, allocation.height); |
146 | 149 |
147 return TRUE; | 150 return TRUE; |
148 } | 151 } |
149 | 152 |
150 void OnDragIconDestroy(GtkWidget* drag_icon, | 153 void OnDragIconDestroy(GtkWidget* drag_icon, |
151 DragRepresentationData* data) { | 154 DragRepresentationData* data) { |
152 g_object_unref(drag_icon); | 155 g_object_unref(drag_icon); |
153 delete data; | 156 delete data; |
154 } | 157 } |
155 | 158 |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
440 GURL url; | 443 GURL url; |
441 string16 title; | 444 string16 title; |
442 if (!ui::ExtractNetscapeURL(selection_data, &url, &title)) | 445 if (!ui::ExtractNetscapeURL(selection_data, &url, &title)) |
443 return false; | 446 return false; |
444 | 447 |
445 model->AddURL(parent, idx, title, url); | 448 model->AddURL(parent, idx, title, url); |
446 return true; | 449 return true; |
447 } | 450 } |
448 | 451 |
449 } // namespace bookmark_utils | 452 } // namespace bookmark_utils |
OLD | NEW |