summaryrefslogtreecommitdiffstats
path: root/chrome/browser/autocomplete/autocomplete_edit_view_gtk.h
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/autocomplete/autocomplete_edit_view_gtk.h')
-rw-r--r--chrome/browser/autocomplete/autocomplete_edit_view_gtk.h47
1 files changed, 38 insertions, 9 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_gtk.h b/chrome/browser/autocomplete/autocomplete_edit_view_gtk.h
index 1eb1736..66b837b 100644
--- a/chrome/browser/autocomplete/autocomplete_edit_view_gtk.h
+++ b/chrome/browser/autocomplete/autocomplete_edit_view_gtk.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -25,9 +25,11 @@
class AutocompleteEditController;
class AutocompleteEditModel;
class AutocompletePopupView;
-class BubblePositioner;
class Profile;
class TabContents;
+namespace views {
+class View;
+}
#if !defined(TOOLKIT_VIEWS)
class GtkThemeProvider;
@@ -53,14 +55,16 @@ class AutocompleteEditViewGtk : public AutocompleteEditView,
Profile* profile,
CommandUpdater* command_updater,
bool popup_window_mode,
- const BubblePositioner* bubble_positioner);
+#if defined(TOOLKIT_VIEWS)
+ const views::View* location_bar);
+#else
+ GtkWidget* location_bar);
+#endif
~AutocompleteEditViewGtk();
// Initialize, create the underlying widgets, etc.
void Init();
- GtkWidget* widget() { return alignment_.get(); }
-
// Returns the width, in pixels, needed to display the current text. The
// returned value includes margins and borders.
int TextWidth();
@@ -82,6 +86,9 @@ class AutocompleteEditViewGtk : public AutocompleteEditView,
virtual std::wstring GetText() const;
+ virtual bool IsEditingOrEmpty() const;
+ virtual int GetIcon() const;
+
virtual void SetUserText(const std::wstring& text) {
SetUserText(text, text, true);
}
@@ -134,6 +141,9 @@ class AutocompleteEditViewGtk : public AutocompleteEditView,
GtkTextBuffer*);
CHROMEG_CALLBACK_2(AutocompleteEditViewGtk, void, HandleMarkSet,
GtkTextBuffer*, GtkTextIter*, GtkTextMark*);
+ // As above, but called after the default handler.
+ CHROMEG_CALLBACK_2(AutocompleteEditViewGtk, void, HandleMarkSetAfter,
+ GtkTextBuffer*, GtkTextIter*, GtkTextMark*);
CHROMEG_CALLBACK_3(AutocompleteEditViewGtk, void, HandleInsertText,
GtkTextBuffer*, GtkTextIter*, const gchar*, gint);
CHROMEG_CALLBACK_0(AutocompleteEditViewGtk, void,
@@ -172,6 +182,20 @@ class AutocompleteEditViewGtk : public AutocompleteEditView,
CHROMEGTK_CALLBACK_1(AutocompleteEditViewGtk, void,
HandleWidgetDirectionChanged, GtkTextDirection);
+ // Callback for the PRIMARY selection clipboard.
+ static void ClipboardGetSelectionThunk(GtkClipboard* clipboard,
+ GtkSelectionData* selection_data,
+ guint info,
+ gpointer object);
+ void ClipboardGetSelection(GtkClipboard* clipboard,
+ GtkSelectionData* selection_data,
+ guint info);
+
+ // Take control of the PRIMARY selection clipboard with |text|. Use
+ // |text_buffer_| as the owner, so that this doesn't remove the selection on
+ // it. This makes use of the above callbacks.
+ void OwnPrimarySelection(const std::string& text);
+
// Gets the GTK_TEXT_WINDOW_WIDGET coordinates for |text_view_| that bound the
// given iters.
gfx::Rect WindowBoundsFromIters(GtkTextIter* iter1, GtkTextIter* iter2);
@@ -209,7 +233,8 @@ class AutocompleteEditViewGtk : public AutocompleteEditView,
// Internally invoked whenever the text changes in some way.
void TextChanged();
- // Save |selected_text| as the PRIMARY X selection.
+ // Save |selected_text| as the PRIMARY X selection. Unlike
+ // OwnPrimarySelection(), this won't set an owner or use callbacks.
void SavePrimarySelection(const std::string& selected_text);
// Update the field with |text| and set the selection.
@@ -239,7 +264,7 @@ class AutocompleteEditViewGtk : public AutocompleteEditView,
GtkTextBuffer* text_buffer_;
GtkTextTag* faded_text_tag_;
GtkTextTag* secure_scheme_tag_;
- GtkTextTag* insecure_scheme_tag_;
+ GtkTextTag* security_error_scheme_tag_;
GtkTextTag* normal_text_tag_;
scoped_ptr<AutocompleteEditModel> model_;
@@ -255,7 +280,7 @@ class AutocompleteEditViewGtk : public AutocompleteEditView,
// different presentation (smaller font size). This is used for popups.
bool popup_window_mode_;
- ToolbarModel::SecurityLevel scheme_security_level_;
+ ToolbarModel::SecurityLevel security_level_;
// Selection at the point where the user started using the
// arrows to move around in the popup.
@@ -272,8 +297,12 @@ class AutocompleteEditViewGtk : public AutocompleteEditView,
// it, we pass this string to SavePrimarySelection()).
std::string selected_text_;
- // ID of the signal handler for "mark-set" on |text_buffer_|.
+ // When we own the X clipboard, this is the text for it.
+ std::string primary_selection_text_;
+
+ // IDs of the signal handlers for "mark-set" on |text_buffer_|.
gulong mark_set_handler_id_;
+ gulong mark_set_handler_id2_;
#if defined(OS_CHROMEOS)
// The following variables are used to implement select-all-on-mouse-up, which