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" |
11 #include "chrome/browser/bookmarks/bookmark_model.h" | 11 #include "chrome/browser/bookmarks/bookmark_model.h" |
12 #include "chrome/browser/bookmarks/bookmark_node_data.h" | 12 #include "chrome/browser/bookmarks/bookmark_node_data.h" |
13 #include "chrome/browser/bookmarks/bookmark_utils.h" | 13 #include "chrome/browser/bookmarks/bookmark_utils.h" |
14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
15 #include "chrome/browser/ui/gtk/gtk_chrome_button.h" | 15 #include "chrome/browser/ui/gtk/gtk_chrome_button.h" |
16 #include "chrome/browser/ui/gtk/gtk_theme_service.h" | 16 #include "chrome/browser/ui/gtk/gtk_theme_service.h" |
17 #include "chrome/browser/ui/gtk/gtk_util.h" | 17 #include "chrome/browser/ui/gtk/gtk_util.h" |
18 #include "ui/base/dragdrop/gtk_dnd_util.h" | 18 #include "ui/base/dragdrop/gtk_dnd_util.h" |
19 #include "ui/base/gtk/gtk_hig_constants.h" | 19 #include "ui/base/gtk/gtk_hig_constants.h" |
| 20 #include "ui/base/gtk/gtk_screen_utils.h" |
20 #include "ui/base/text/text_elider.h" | 21 #include "ui/base/text/text_elider.h" |
21 #include "ui/base/resource/resource_bundle.h" | 22 #include "ui/base/resource/resource_bundle.h" |
22 #include "ui/gfx/canvas_skia_paint.h" | 23 #include "ui/gfx/canvas_skia_paint.h" |
23 #include "ui/gfx/font.h" | 24 #include "ui/gfx/font.h" |
24 #include "ui/gfx/gtk_util.h" | 25 #include "ui/gfx/gtk_util.h" |
25 | 26 |
26 namespace { | 27 namespace { |
27 | 28 |
28 // Spacing between the favicon and the text. | 29 // Spacing between the favicon and the text. |
29 const int kBarButtonPadding = 4; | 30 const int kBarButtonPadding = 4; |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 } | 176 } |
176 | 177 |
177 return pixbuf; | 178 return pixbuf; |
178 } | 179 } |
179 | 180 |
180 GtkWidget* GetDragRepresentation(GdkPixbuf* pixbuf, | 181 GtkWidget* GetDragRepresentation(GdkPixbuf* pixbuf, |
181 const string16& title, | 182 const string16& title, |
182 GtkThemeService* provider) { | 183 GtkThemeService* provider) { |
183 GtkWidget* window = gtk_window_new(GTK_WINDOW_POPUP); | 184 GtkWidget* window = gtk_window_new(GTK_WINDOW_POPUP); |
184 | 185 |
185 if (gtk_util::IsScreenComposited() && | 186 if (ui::IsScreenComposited() && |
186 gtk_util::AddWindowAlphaChannel(window)) { | 187 gtk_util::AddWindowAlphaChannel(window)) { |
187 DragRepresentationData* data = new DragRepresentationData( | 188 DragRepresentationData* data = new DragRepresentationData( |
188 pixbuf, title, | 189 pixbuf, title, |
189 provider->GetColor(ThemeService::COLOR_BOOKMARK_TEXT)); | 190 provider->GetColor(ThemeService::COLOR_BOOKMARK_TEXT)); |
190 g_signal_connect(window, "expose-event", G_CALLBACK(OnDragIconExpose), | 191 g_signal_connect(window, "expose-event", G_CALLBACK(OnDragIconExpose), |
191 data); | 192 data); |
192 g_object_ref(window); | 193 g_object_ref(window); |
193 g_signal_connect(window, "destroy", G_CALLBACK(OnDragIconDestroy), data); | 194 g_signal_connect(window, "destroy", G_CALLBACK(OnDragIconDestroy), data); |
194 | 195 |
195 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 196 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 GURL url; | 440 GURL url; |
440 string16 title; | 441 string16 title; |
441 if (!ui::ExtractNetscapeURL(selection_data, &url, &title)) | 442 if (!ui::ExtractNetscapeURL(selection_data, &url, &title)) |
442 return false; | 443 return false; |
443 | 444 |
444 model->AddURL(parent, idx, title, url); | 445 model->AddURL(parent, idx, title, url); |
445 return true; | 446 return true; |
446 } | 447 } |
447 | 448 |
448 } // namespace bookmark_utils | 449 } // namespace bookmark_utils |
OLD | NEW |