Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(269)

Side by Side Diff: chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc

Issue 3387008: linux: Add support for undo in the omnibox. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Corrected entry in DEPS. Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « DEPS ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/autocomplete/autocomplete_edit_view_gtk.h" 5 #include "chrome/browser/autocomplete/autocomplete_edit_view_gtk.h"
6 6
7 #include <gtk/gtk.h> 7 #include <gtk/gtk.h>
8 #include <gdk/gdkkeysyms.h> 8 #include <gdk/gdkkeysyms.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 14 matching lines...) Expand all
25 #include "chrome/browser/gtk/view_id_util.h" 25 #include "chrome/browser/gtk/view_id_util.h"
26 #include "chrome/browser/tab_contents/tab_contents.h" 26 #include "chrome/browser/tab_contents/tab_contents.h"
27 #include "chrome/browser/toolbar_model.h" 27 #include "chrome/browser/toolbar_model.h"
28 #include "chrome/common/notification_service.h" 28 #include "chrome/common/notification_service.h"
29 #include "gfx/font.h" 29 #include "gfx/font.h"
30 #include "gfx/gtk_util.h" 30 #include "gfx/gtk_util.h"
31 #include "gfx/skia_utils_gtk.h" 31 #include "gfx/skia_utils_gtk.h"
32 #include "googleurl/src/gurl.h" 32 #include "googleurl/src/gurl.h"
33 #include "grit/generated_resources.h" 33 #include "grit/generated_resources.h"
34 #include "net/base/escape.h" 34 #include "net/base/escape.h"
35 #include "third_party/undoview/undo_view.h"
35 36
36 #if defined(TOOLKIT_VIEWS) 37 #if defined(TOOLKIT_VIEWS)
37 #include "chrome/browser/views/autocomplete/autocomplete_popup_contents_view.h" 38 #include "chrome/browser/views/autocomplete/autocomplete_popup_contents_view.h"
38 #include "chrome/browser/views/location_bar/location_bar_view.h" 39 #include "chrome/browser/views/location_bar/location_bar_view.h"
39 #else 40 #else
40 #include "chrome/browser/autocomplete/autocomplete_popup_view_gtk.h" 41 #include "chrome/browser/autocomplete/autocomplete_popup_view_gtk.h"
41 #include "chrome/browser/gtk/gtk_theme_provider.h" 42 #include "chrome/browser/gtk/gtk_theme_provider.h"
42 #include "chrome/browser/gtk/location_bar_view_gtk.h" 43 #include "chrome/browser/gtk/location_bar_view_gtk.h"
43 #endif 44 #endif
44 45
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 alignment_.Own(gtk_alignment_new(0., 0.5, 1.0, 0.0)); 210 alignment_.Own(gtk_alignment_new(0., 0.5, 1.0, 0.0));
210 gtk_widget_set_name(alignment_.get(), 211 gtk_widget_set_name(alignment_.get(),
211 "chrome-autocomplete-edit-view"); 212 "chrome-autocomplete-edit-view");
212 213
213 // The GtkTagTable and GtkTextBuffer are not initially unowned, so we have 214 // The GtkTagTable and GtkTextBuffer are not initially unowned, so we have
214 // our own reference when we create them, and we own them. Adding them to 215 // our own reference when we create them, and we own them. Adding them to
215 // the other objects adds a reference; it doesn't adopt them. 216 // the other objects adds a reference; it doesn't adopt them.
216 tag_table_ = gtk_text_tag_table_new(); 217 tag_table_ = gtk_text_tag_table_new();
217 text_buffer_ = gtk_text_buffer_new(tag_table_); 218 text_buffer_ = gtk_text_buffer_new(tag_table_);
218 g_object_set_data(G_OBJECT(text_buffer_), kAutocompleteEditViewGtkKey, this); 219 g_object_set_data(G_OBJECT(text_buffer_), kAutocompleteEditViewGtkKey, this);
219 text_view_ = gtk_text_view_new_with_buffer(text_buffer_); 220 text_view_ = gtk_undo_view_new(text_buffer_);
220 if (popup_window_mode_) 221 if (popup_window_mode_)
221 gtk_text_view_set_editable(GTK_TEXT_VIEW(text_view_), false); 222 gtk_text_view_set_editable(GTK_TEXT_VIEW(text_view_), false);
222 223
223 // One pixel left margin is necessary to make the cursor visible when UI 224 // One pixel left margin is necessary to make the cursor visible when UI
224 // language direction is LTR but |text_buffer_|'s content direction is RTL. 225 // language direction is LTR but |text_buffer_|'s content direction is RTL.
225 gtk_text_view_set_left_margin(GTK_TEXT_VIEW(text_view_), 1); 226 gtk_text_view_set_left_margin(GTK_TEXT_VIEW(text_view_), 1);
226 227
227 // See SetEntryStyle() comments. 228 // See SetEntryStyle() comments.
228 gtk_widget_set_name(text_view_, "chrome-location-bar-entry"); 229 gtk_widget_set_name(text_view_, "chrome-location-bar-entry");
229 230
(...skipping 1363 matching lines...) Expand 10 before | Expand all | Expand 10 after
1593 CharRange selection = GetSelection(); 1594 CharRange selection = GetSelection();
1594 GURL url; 1595 GURL url;
1595 bool write_url; 1596 bool write_url;
1596 model_->AdjustTextForCopy(selection.selection_min(), IsSelectAll(), &text, 1597 model_->AdjustTextForCopy(selection.selection_min(), IsSelectAll(), &text,
1597 &url, &write_url); 1598 &url, &write_url);
1598 if (write_url) { 1599 if (write_url) {
1599 selected_text_ = WideToUTF8(text); 1600 selected_text_ = WideToUTF8(text);
1600 OwnPrimarySelection(selected_text_); 1601 OwnPrimarySelection(selected_text_);
1601 } 1602 }
1602 } 1603 }
OLDNEW
« no previous file with comments | « DEPS ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698