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

Side by Side Diff: chrome/browser/renderer_host/render_widget_host_view_gtk.h

Issue 63145: Copy text selection from renderer to browser every time it changes. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 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 #ifndef CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_GTK_H_ 5 #ifndef CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_GTK_H_
6 #define CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_GTK_H_ 6 #define CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_GTK_H_
7 7
8 #include <gdk/gdk.h> 8 #include <gdk/gdk.h>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 gfx::Rect GetViewBounds() const; 54 gfx::Rect GetViewBounds() const;
55 void UpdateCursor(const WebCursor& cursor); 55 void UpdateCursor(const WebCursor& cursor);
56 void SetIsLoading(bool is_loading); 56 void SetIsLoading(bool is_loading);
57 void IMEUpdateStatus(int control, const gfx::Rect& caret_rect); 57 void IMEUpdateStatus(int control, const gfx::Rect& caret_rect);
58 void DidPaintRect(const gfx::Rect& rect); 58 void DidPaintRect(const gfx::Rect& rect);
59 void DidScrollRect( 59 void DidScrollRect(
60 const gfx::Rect& rect, int dx, int dy); 60 const gfx::Rect& rect, int dx, int dy);
61 void RenderViewGone(); 61 void RenderViewGone();
62 void Destroy(); 62 void Destroy();
63 void SetTooltipText(const std::wstring& tooltip_text); 63 void SetTooltipText(const std::wstring& tooltip_text);
64 void SelectionChanged(); 64 void SelectionChanged(const std::string& text);
65 void SetSelectionText(const std::string& text);
66 void PasteFromSelectionClipboard(); 65 void PasteFromSelectionClipboard();
67 BackingStore* AllocBackingStore(const gfx::Size& size); 66 BackingStore* AllocBackingStore(const gfx::Size& size);
68 // --------------------------------------------------------------------------- 67 // ---------------------------------------------------------------------------
69 68
70 gfx::NativeView native_view() const { return view_.get(); } 69 gfx::NativeView native_view() const { return view_.get(); }
71 70
72 void Paint(const gfx::Rect&); 71 void Paint(const gfx::Rect&);
73 72
74 private: 73 private:
75 friend class RenderWidgetHostViewGtkWidget; 74 friend class RenderWidgetHostViewGtkWidget;
76 75
77 void set_event_selection(GdkEventSelection* event_selection) {
78 event_selection_ = *event_selection;
79 event_selection_active_ = true;
80 }
81
82 // Update the display cursor for the render view. 76 // Update the display cursor for the render view.
83 void ShowCurrentCursor(); 77 void ShowCurrentCursor();
84 78
85 void RequestSelectionText();
86
87 // When we've requested the text from the X clipboard, GTK returns it to us 79 // When we've requested the text from the X clipboard, GTK returns it to us
88 // through this callback. 80 // through this callback.
89 static void ReceivedSelectionText(GtkClipboard* clipboard, 81 static void ReceivedSelectionText(GtkClipboard* clipboard,
90 const gchar* text, 82 const gchar* text,
91 gpointer userdata); 83 gpointer userdata);
92 84
93 // The model object. 85 // The model object.
94 RenderWidgetHost *const host_; 86 RenderWidgetHost *const host_;
95 // The native UI widget. 87 // The native UI widget.
96 OwnedWidgetGtk view_; 88 OwnedWidgetGtk view_;
(...skipping 11 matching lines...) Expand all
108 // activatable, then our parent render view retains more control. Example of 100 // activatable, then our parent render view retains more control. Example of
109 // activatable popup: <select> dropdown. Example of non-activatable popup: 101 // activatable popup: <select> dropdown. Example of non-activatable popup:
110 // form autocomplete. 102 // form autocomplete.
111 bool activatable_; 103 bool activatable_;
112 104
113 // Whether we are currently loading. 105 // Whether we are currently loading.
114 bool is_loading_; 106 bool is_loading_;
115 107
116 // The cursor for the page. This is passed up from the renderer. 108 // The cursor for the page. This is passed up from the renderer.
117 WebCursor current_cursor_; 109 WebCursor current_cursor_;
118
119 // We cache the text that is selected on the page. This is used for copying to
120 // the X clipboard. We update |selection_text_| whenever X asks us for it and
121 // the cache is empty. We invalidate it (set it to empty) whenever the
122 // renderer sends a SelectionChanged message.
123 std::string selection_text_;
124
125 // A struct that keeps state for the XSelectionEvent we are handling (if any).
126 GdkEventSelection event_selection_;
127 // Tracks whether we are currently handling an XSelectionEvent.
128 bool event_selection_active_;
129 }; 110 };
130 111
131 #endif // CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_GTK_H_ 112 #endif // CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_GTK_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698