Index: content/browser/renderer_host/render_widget_host_view_gtk.cc |
diff --git a/content/browser/renderer_host/render_widget_host_view_gtk.cc b/content/browser/renderer_host/render_widget_host_view_gtk.cc |
index ca71db99b562caf36bcb11ec0a5dd4dd40273da0..d47e337c81d15af07999d45f5b5fa82a1de4441b 100644 |
--- a/content/browser/renderer_host/render_widget_host_view_gtk.cc |
+++ b/content/browser/renderer_host/render_widget_host_view_gtk.cc |
@@ -36,6 +36,7 @@ |
#include "content/browser/renderer_host/render_view_host_delegate.h" |
#include "content/browser/renderer_host/render_view_host_impl.h" |
#include "content/common/gpu/gpu_messages.h" |
+#include "content/public/browser/browser_context.h" |
#include "content/public/browser/native_web_keyboard_event.h" |
#include "content/public/common/content_switches.h" |
#include "skia/ext/platform_canvas.h" |
@@ -43,6 +44,7 @@ |
#include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h" |
#include "third_party/WebKit/Source/WebKit/chromium/public/gtk/WebInputEventFactory.h" |
#include "third_party/WebKit/Source/WebKit/chromium/public/x11/WebScreenInfoFactory.h" |
+#include "ui/base/clipboard/scoped_clipboard_writer.h" |
#include "ui/base/gtk/gtk_compat.h" |
#include "ui/base/text/text_elider.h" |
#include "ui/base/x/active_window_watcher_x.h" |
@@ -942,10 +944,13 @@ void RenderWidgetHostViewGtk::SelectionChanged(const string16& text, |
return; |
} |
- std::string utf8_selection = UTF16ToUTF8(text.substr(pos, n)); |
- GtkClipboard* x_clipboard = gtk_clipboard_get(GDK_SELECTION_PRIMARY); |
- gtk_clipboard_set_text( |
- x_clipboard, utf8_selection.c_str(), utf8_selection.length()); |
+ BrowserContext* browser_context = host_->GetProcess()->GetBrowserContext(); |
+ // Set the BUFFER_SELECTION to the ui::Clipboard. |
+ ui::ScopedClipboardWriter clipboard_writer( |
+ ui::Clipboard::GetForCurrentThread(), |
+ ui::Clipboard::BUFFER_SELECTION, |
+ BrowserContext::GetMarkerForOffTheRecordContext(browser_context)); |
+ clipboard_writer.WriteText(text.substr(pos, n)); |
} |
void RenderWidgetHostViewGtk::SelectionBoundsChanged( |