OLD | NEW |
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 <set> | 7 #include <set> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 2364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2375 is_guest_view_hack_ ? this : GetFocusedWidget() | 2375 is_guest_view_hack_ ? this : GetFocusedWidget() |
2376 ? GetFocusedWidget()->GetView() | 2376 ? GetFocusedWidget()->GetView() |
2377 : nullptr; | 2377 : nullptr; |
2378 | 2378 |
2379 if (!focused_view) | 2379 if (!focused_view) |
2380 return; | 2380 return; |
2381 | 2381 |
2382 #if defined(USE_X11) && !defined(OS_CHROMEOS) | 2382 #if defined(USE_X11) && !defined(OS_CHROMEOS) |
2383 const TextInputManager::TextSelection* selection = | 2383 const TextInputManager::TextSelection* selection = |
2384 GetTextInputManager()->GetTextSelection(focused_view); | 2384 GetTextInputManager()->GetTextSelection(focused_view); |
2385 if (selection->selected_text().length()) { | 2385 if (selection->selected_text().length() && selection->user_initiated()) { |
2386 // Set the CLIPBOARD_TYPE_SELECTION to the ui::Clipboard. | 2386 // Set the CLIPBOARD_TYPE_SELECTION to the ui::Clipboard. |
2387 ui::ScopedClipboardWriter clipboard_writer(ui::CLIPBOARD_TYPE_SELECTION); | 2387 ui::ScopedClipboardWriter clipboard_writer(ui::CLIPBOARD_TYPE_SELECTION); |
2388 clipboard_writer.WriteText(selection->selected_text()); | 2388 clipboard_writer.WriteText(selection->selected_text()); |
2389 } | 2389 } |
2390 | 2390 |
2391 #elif defined(OS_WIN) | 2391 #elif defined(OS_WIN) |
2392 // Some assistive software need to track the location of the caret. | 2392 // Some assistive software need to track the location of the caret. |
2393 if (!GetRenderWidgetHost() || !legacy_render_widget_host_HWND_) | 2393 if (!GetRenderWidgetHost() || !legacy_render_widget_host_HWND_) |
2394 return; | 2394 return; |
2395 | 2395 |
(...skipping 26 matching lines...) Expand all Loading... |
2422 | 2422 |
2423 void RenderWidgetHostViewAura::ScrollFocusedEditableNodeIntoRect( | 2423 void RenderWidgetHostViewAura::ScrollFocusedEditableNodeIntoRect( |
2424 const gfx::Rect& node_rect) { | 2424 const gfx::Rect& node_rect) { |
2425 RenderFrameHostImpl* rfh = GetFocusedFrame(); | 2425 RenderFrameHostImpl* rfh = GetFocusedFrame(); |
2426 if (rfh) { | 2426 if (rfh) { |
2427 rfh->GetFrameInputHandler()->ScrollFocusedEditableNodeIntoRect(node_rect); | 2427 rfh->GetFrameInputHandler()->ScrollFocusedEditableNodeIntoRect(node_rect); |
2428 } | 2428 } |
2429 } | 2429 } |
2430 | 2430 |
2431 } // namespace content | 2431 } // namespace content |
OLD | NEW |