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 971 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
982 GtkClipboard* clipboard = gtk_clipboard_get(GDK_SELECTION_PRIMARY); | 982 GtkClipboard* clipboard = gtk_clipboard_get(GDK_SELECTION_PRIMARY); |
983 DCHECK(clipboard); | 983 DCHECK(clipboard); |
984 gchar* selection_text = gtk_clipboard_wait_for_text(clipboard); | 984 gchar* selection_text = gtk_clipboard_wait_for_text(clipboard); |
985 if (!selection_text) | 985 if (!selection_text) |
986 return false; | 986 return false; |
987 | 987 |
988 // Use autocomplete to clean up the text, going so far as to turn it into | 988 // Use autocomplete to clean up the text, going so far as to turn it into |
989 // a search query if necessary. | 989 // a search query if necessary. |
990 AutocompleteMatch match; | 990 AutocompleteMatch match; |
991 profile->GetAutocompleteClassifier()->Classify(UTF8ToUTF16(selection_text), | 991 profile->GetAutocompleteClassifier()->Classify(UTF8ToUTF16(selection_text), |
992 string16(), false, &match, NULL); | 992 string16(), false, false, &match, NULL); |
993 g_free(selection_text); | 993 g_free(selection_text); |
994 if (!match.destination_url.is_valid()) | 994 if (!match.destination_url.is_valid()) |
995 return false; | 995 return false; |
996 | 996 |
997 *url = match.destination_url; | 997 *url = match.destination_url; |
998 return true; | 998 return true; |
999 } | 999 } |
1000 | 1000 |
1001 bool AddWindowAlphaChannel(GtkWidget* window) { | 1001 bool AddWindowAlphaChannel(GtkWidget* window) { |
1002 GdkScreen* screen = gtk_widget_get_screen(window); | 1002 GdkScreen* screen = gtk_widget_get_screen(window); |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1282 | 1282 |
1283 void DoCopy(BrowserWindow* window) { | 1283 void DoCopy(BrowserWindow* window) { |
1284 DoCutCopyPaste(window, &RenderViewHost::Copy, "copy-clipboard"); | 1284 DoCutCopyPaste(window, &RenderViewHost::Copy, "copy-clipboard"); |
1285 } | 1285 } |
1286 | 1286 |
1287 void DoPaste(BrowserWindow* window) { | 1287 void DoPaste(BrowserWindow* window) { |
1288 DoCutCopyPaste(window, &RenderViewHost::Paste, "paste-clipboard"); | 1288 DoCutCopyPaste(window, &RenderViewHost::Paste, "paste-clipboard"); |
1289 } | 1289 } |
1290 | 1290 |
1291 } // namespace gtk_util | 1291 } // namespace gtk_util |
OLD | NEW |