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

Unified Diff: content/browser/renderer_host/render_widget_host_view_gtk.cc

Issue 12041078: Clear the clipboard closing Incognito window (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Merge and compilation fixes Created 7 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_aura.cc ('k') | content/content_tests.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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(
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_aura.cc ('k') | content/content_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698