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_gtk.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_gtk.h" |
6 | 6 |
7 // If this gets included after the gtk headers, then a bunch of compiler | 7 // If this gets included after the gtk headers, then a bunch of compiler |
8 // errors happen because of a "#define Status int" in Xlib.h, which interacts | 8 // errors happen because of a "#define Status int" in Xlib.h, which interacts |
9 // badly with net::URLRequestStatus::Status. | 9 // badly with net::URLRequestStatus::Status. |
10 #include "content/common/view_messages.h" | 10 #include "content/common/view_messages.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 #include "base/time.h" | 29 #include "base/time.h" |
30 #include "base/utf_string_conversions.h" | 30 #include "base/utf_string_conversions.h" |
31 #include "content/browser/accessibility/browser_accessibility_gtk.h" | 31 #include "content/browser/accessibility/browser_accessibility_gtk.h" |
32 #include "content/browser/renderer_host/backing_store_gtk.h" | 32 #include "content/browser/renderer_host/backing_store_gtk.h" |
33 #include "content/browser/renderer_host/gtk_im_context_wrapper.h" | 33 #include "content/browser/renderer_host/gtk_im_context_wrapper.h" |
34 #include "content/browser/renderer_host/gtk_key_bindings_handler.h" | 34 #include "content/browser/renderer_host/gtk_key_bindings_handler.h" |
35 #include "content/browser/renderer_host/gtk_window_utils.h" | 35 #include "content/browser/renderer_host/gtk_window_utils.h" |
36 #include "content/browser/renderer_host/render_view_host_delegate.h" | 36 #include "content/browser/renderer_host/render_view_host_delegate.h" |
37 #include "content/browser/renderer_host/render_view_host_impl.h" | 37 #include "content/browser/renderer_host/render_view_host_impl.h" |
38 #include "content/common/gpu/gpu_messages.h" | 38 #include "content/common/gpu/gpu_messages.h" |
| 39 #include "content/public/browser/browser_context.h" |
39 #include "content/public/browser/native_web_keyboard_event.h" | 40 #include "content/public/browser/native_web_keyboard_event.h" |
40 #include "content/public/common/content_switches.h" | 41 #include "content/public/common/content_switches.h" |
41 #include "skia/ext/platform_canvas.h" | 42 #include "skia/ext/platform_canvas.h" |
42 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" | 43 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" |
43 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h" | 44 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h" |
44 #include "third_party/WebKit/Source/WebKit/chromium/public/gtk/WebInputEventFact
ory.h" | 45 #include "third_party/WebKit/Source/WebKit/chromium/public/gtk/WebInputEventFact
ory.h" |
45 #include "third_party/WebKit/Source/WebKit/chromium/public/x11/WebScreenInfoFact
ory.h" | 46 #include "third_party/WebKit/Source/WebKit/chromium/public/x11/WebScreenInfoFact
ory.h" |
| 47 #include "ui/base/clipboard/scoped_clipboard_writer.h" |
46 #include "ui/base/gtk/gtk_compat.h" | 48 #include "ui/base/gtk/gtk_compat.h" |
47 #include "ui/base/text/text_elider.h" | 49 #include "ui/base/text/text_elider.h" |
48 #include "ui/base/x/active_window_watcher_x.h" | 50 #include "ui/base/x/active_window_watcher_x.h" |
49 #include "ui/base/x/x11_util.h" | 51 #include "ui/base/x/x11_util.h" |
50 #include "ui/gfx/gtk_native_view_id_manager.h" | 52 #include "ui/gfx/gtk_native_view_id_manager.h" |
51 #include "ui/gfx/gtk_preserve_window.h" | 53 #include "ui/gfx/gtk_preserve_window.h" |
52 #include "webkit/glue/webcursor_gtk_data.h" | 54 #include "webkit/glue/webcursor_gtk_data.h" |
53 #include "webkit/plugins/npapi/webplugin.h" | 55 #include "webkit/plugins/npapi/webplugin.h" |
54 | 56 |
55 using WebKit::WebInputEventFactory; | 57 using WebKit::WebInputEventFactory; |
(...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
935 return; | 937 return; |
936 size_t pos = range.GetMin() - offset; | 938 size_t pos = range.GetMin() - offset; |
937 size_t n = range.length(); | 939 size_t n = range.length(); |
938 | 940 |
939 DCHECK(pos + n <= text.length()) << "The text can not fully cover range."; | 941 DCHECK(pos + n <= text.length()) << "The text can not fully cover range."; |
940 if (pos >= text.length()) { | 942 if (pos >= text.length()) { |
941 NOTREACHED() << "The text can not cover range."; | 943 NOTREACHED() << "The text can not cover range."; |
942 return; | 944 return; |
943 } | 945 } |
944 | 946 |
945 std::string utf8_selection = UTF16ToUTF8(text.substr(pos, n)); | 947 BrowserContext* browser_context = host_->GetProcess()->GetBrowserContext(); |
946 GtkClipboard* x_clipboard = gtk_clipboard_get(GDK_SELECTION_PRIMARY); | 948 // Set the BUFFER_SELECTION to the ui::Clipboard. |
947 gtk_clipboard_set_text( | 949 ui::ScopedClipboardWriter clipboard_writer( |
948 x_clipboard, utf8_selection.c_str(), utf8_selection.length()); | 950 ui::Clipboard::GetForCurrentThread(), |
| 951 ui::Clipboard::BUFFER_SELECTION, |
| 952 BrowserContext::GetMarkerForOffTheRecordContext(browser_context)); |
| 953 clipboard_writer.WriteText(text.substr(pos, n)); |
949 } | 954 } |
950 | 955 |
951 void RenderWidgetHostViewGtk::SelectionBoundsChanged( | 956 void RenderWidgetHostViewGtk::SelectionBoundsChanged( |
952 const ViewHostMsg_SelectionBounds_Params& params) { | 957 const ViewHostMsg_SelectionBounds_Params& params) { |
953 im_context_->UpdateCaretBounds( | 958 im_context_->UpdateCaretBounds( |
954 gfx::UnionRects(params.anchor_rect, params.focus_rect)); | 959 gfx::UnionRects(params.anchor_rect, params.focus_rect)); |
955 } | 960 } |
956 | 961 |
957 GdkEventButton* RenderWidgetHostViewGtk::GetLastMouseDown() { | 962 GdkEventButton* RenderWidgetHostViewGtk::GetLastMouseDown() { |
958 return last_mouse_down_; | 963 return last_mouse_down_; |
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1572 this)); | 1577 this)); |
1573 } | 1578 } |
1574 BrowserAccessibilityGtk* root = | 1579 BrowserAccessibilityGtk* root = |
1575 browser_accessibility_manager_->GetRoot()->ToBrowserAccessibilityGtk(); | 1580 browser_accessibility_manager_->GetRoot()->ToBrowserAccessibilityGtk(); |
1576 | 1581 |
1577 atk_object_set_role(root->GetAtkObject(), ATK_ROLE_HTML_CONTAINER); | 1582 atk_object_set_role(root->GetAtkObject(), ATK_ROLE_HTML_CONTAINER); |
1578 return root->GetAtkObject(); | 1583 return root->GetAtkObject(); |
1579 } | 1584 } |
1580 | 1585 |
1581 } // namespace content | 1586 } // namespace content |
OLD | NEW |