| 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/gtk_util.h" | 5 #include "chrome/browser/ui/gtk/gtk_util.h" |
| 6 | 6 |
| 7 #include <cairo/cairo.h> | 7 #include <cairo/cairo.h> |
| 8 #include <gdk/gdkx.h> | 8 #include <gdk/gdkx.h> |
| 9 #include <gtk/gtk.h> | 9 #include <gtk/gtk.h> |
| 10 | 10 |
| (...skipping 947 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 958 bool URLFromPrimarySelection(Profile* profile, GURL* url) { | 958 bool URLFromPrimarySelection(Profile* profile, GURL* url) { |
| 959 GtkClipboard* clipboard = gtk_clipboard_get(GDK_SELECTION_PRIMARY); | 959 GtkClipboard* clipboard = gtk_clipboard_get(GDK_SELECTION_PRIMARY); |
| 960 DCHECK(clipboard); | 960 DCHECK(clipboard); |
| 961 gchar* selection_text = gtk_clipboard_wait_for_text(clipboard); | 961 gchar* selection_text = gtk_clipboard_wait_for_text(clipboard); |
| 962 if (!selection_text) | 962 if (!selection_text) |
| 963 return false; | 963 return false; |
| 964 | 964 |
| 965 // Use autocomplete to clean up the text, going so far as to turn it into | 965 // Use autocomplete to clean up the text, going so far as to turn it into |
| 966 // a search query if necessary. | 966 // a search query if necessary. |
| 967 AutocompleteMatch match; | 967 AutocompleteMatch match; |
| 968 profile->GetAutocompleteClassifier()->Classify(UTF8ToUTF16(selection_text), | 968 profile->GetAutocompleteClassifier()->Classify(UTF8ToWide(selection_text), |
| 969 string16(), false, &match, NULL); | 969 std::wstring(), false, &match, NULL); |
| 970 g_free(selection_text); | 970 g_free(selection_text); |
| 971 if (!match.destination_url.is_valid()) | 971 if (!match.destination_url.is_valid()) |
| 972 return false; | 972 return false; |
| 973 | 973 |
| 974 *url = match.destination_url; | 974 *url = match.destination_url; |
| 975 return true; | 975 return true; |
| 976 } | 976 } |
| 977 | 977 |
| 978 bool AddWindowAlphaChannel(GtkWidget* window) { | 978 bool AddWindowAlphaChannel(GtkWidget* window) { |
| 979 GdkScreen* screen = gtk_widget_get_screen(window); | 979 GdkScreen* screen = gtk_widget_get_screen(window); |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1241 | 1241 |
| 1242 void DoCopy(BrowserWindow* window) { | 1242 void DoCopy(BrowserWindow* window) { |
| 1243 DoCutCopyPaste(window, &RenderViewHost::Copy, "copy-clipboard"); | 1243 DoCutCopyPaste(window, &RenderViewHost::Copy, "copy-clipboard"); |
| 1244 } | 1244 } |
| 1245 | 1245 |
| 1246 void DoPaste(BrowserWindow* window) { | 1246 void DoPaste(BrowserWindow* window) { |
| 1247 DoCutCopyPaste(window, &RenderViewHost::Paste, "paste-clipboard"); | 1247 DoCutCopyPaste(window, &RenderViewHost::Paste, "paste-clipboard"); |
| 1248 } | 1248 } |
| 1249 | 1249 |
| 1250 } // namespace gtk_util | 1250 } // namespace gtk_util |
| OLD | NEW |