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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_aura.cc

Issue 12041078: Clear the clipboard closing Incognito window (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Selection clipboard support 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/browser/renderer_host/render_widget_host_view_aura.h" 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/message_loop.h" 12 #include "base/message_loop.h"
13 #include "base/string_number_conversions.h" 13 #include "base/string_number_conversions.h"
14 #include "content/browser/renderer_host/backing_store_aura.h" 14 #include "content/browser/renderer_host/backing_store_aura.h"
15 #include "content/browser/renderer_host/dip_util.h" 15 #include "content/browser/renderer_host/dip_util.h"
16 #include "content/browser/renderer_host/overscroll_controller.h" 16 #include "content/browser/renderer_host/overscroll_controller.h"
17 #include "content/browser/renderer_host/render_view_host_delegate.h" 17 #include "content/browser/renderer_host/render_view_host_delegate.h"
18 #include "content/browser/renderer_host/render_widget_host_impl.h" 18 #include "content/browser/renderer_host/render_widget_host_impl.h"
19 #include "content/browser/renderer_host/ui_events_helper.h" 19 #include "content/browser/renderer_host/ui_events_helper.h"
20 #include "content/browser/renderer_host/web_input_event_aura.h" 20 #include "content/browser/renderer_host/web_input_event_aura.h"
21 #include "content/common/gpu/client/gl_helper.h" 21 #include "content/common/gpu/client/gl_helper.h"
22 #include "content/common/gpu/gpu_messages.h" 22 #include "content/common/gpu/gpu_messages.h"
23 #include "content/common/view_messages.h" 23 #include "content/common/view_messages.h"
24 #include "content/port/browser/render_widget_host_view_port.h" 24 #include "content/port/browser/render_widget_host_view_port.h"
25 #include "content/public/browser/browser_context.h"
25 #include "content/public/browser/browser_thread.h" 26 #include "content/public/browser/browser_thread.h"
26 #include "content/public/browser/render_view_host.h" 27 #include "content/public/browser/render_view_host.h"
27 #include "content/public/browser/user_metrics.h" 28 #include "content/public/browser/user_metrics.h"
28 #include "content/public/common/content_switches.h" 29 #include "content/public/common/content_switches.h"
29 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositionUnderli ne.h" 30 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositionUnderli ne.h"
30 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" 31 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h"
31 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h" 32 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h"
32 #include "ui/aura/client/aura_constants.h" 33 #include "ui/aura/client/aura_constants.h"
33 #include "ui/aura/client/cursor_client.h" 34 #include "ui/aura/client/cursor_client.h"
34 #include "ui/aura/client/focus_client.h" 35 #include "ui/aura/client/focus_client.h"
(...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after
673 674
674 void RenderWidgetHostViewAura::SelectionChanged(const string16& text, 675 void RenderWidgetHostViewAura::SelectionChanged(const string16& text,
675 size_t offset, 676 size_t offset,
676 const ui::Range& range) { 677 const ui::Range& range) {
677 RenderWidgetHostViewBase::SelectionChanged(text, offset, range); 678 RenderWidgetHostViewBase::SelectionChanged(text, offset, range);
678 679
679 #if defined(USE_X11) && !defined(OS_CHROMEOS) 680 #if defined(USE_X11) && !defined(OS_CHROMEOS)
680 if (text.empty() || range.is_empty()) 681 if (text.empty() || range.is_empty())
681 return; 682 return;
682 683
684 BrowserContext* browser_context = host_->GetProcess()->GetBrowserContext();
683 // Set the BUFFER_SELECTION to the ui::Clipboard. 685 // Set the BUFFER_SELECTION to the ui::Clipboard.
684 ui::ScopedClipboardWriter clipboard_writer( 686 ui::ScopedClipboardWriter clipboard_writer(
685 ui::Clipboard::GetForCurrentThread(), 687 ui::Clipboard::GetForCurrentThread(),
686 ui::Clipboard::BUFFER_SELECTION); 688 ui::Clipboard::BUFFER_SELECTION,
689 BrowserContext::GetMarkerForOffTheRecordContext(browser_context));
687 clipboard_writer.WriteText(text); 690 clipboard_writer.WriteText(text);
688 #endif // defined(USE_X11) && !defined(OS_CHROMEOS) 691 #endif // defined(USE_X11) && !defined(OS_CHROMEOS)
689 } 692 }
690 693
691 void RenderWidgetHostViewAura::SelectionBoundsChanged( 694 void RenderWidgetHostViewAura::SelectionBoundsChanged(
692 const ViewHostMsg_SelectionBounds_Params& params) { 695 const ViewHostMsg_SelectionBounds_Params& params) {
693 if (selection_anchor_rect_ == params.anchor_rect && 696 if (selection_anchor_rect_ == params.anchor_rect &&
694 selection_focus_rect_ == params.focus_rect) 697 selection_focus_rect_ == params.focus_rect)
695 return; 698 return;
696 699
(...skipping 1344 matching lines...) Expand 10 before | Expand all | Expand 10 after
2041 RenderWidgetHost* widget) { 2044 RenderWidgetHost* widget) {
2042 return new RenderWidgetHostViewAura(widget); 2045 return new RenderWidgetHostViewAura(widget);
2043 } 2046 }
2044 2047
2045 // static 2048 // static
2046 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { 2049 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) {
2047 GetScreenInfoForWindow(results, NULL); 2050 GetScreenInfoForWindow(results, NULL);
2048 } 2051 }
2049 2052
2050 } // namespace content 2053 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698