| 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/utf_offset_string_conversions.h" | 29 #include "base/utf_offset_string_conversions.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 877 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 933 return; | 935 return; |
| 934 size_t pos = range.GetMin() - offset; | 936 size_t pos = range.GetMin() - offset; |
| 935 size_t n = range.length(); | 937 size_t n = range.length(); |
| 936 | 938 |
| 937 DCHECK(pos + n <= text.length()) << "The text can not fully cover range."; | 939 DCHECK(pos + n <= text.length()) << "The text can not fully cover range."; |
| 938 if (pos >= text.length()) { | 940 if (pos >= text.length()) { |
| 939 NOTREACHED() << "The text can not cover range."; | 941 NOTREACHED() << "The text can not cover range."; |
| 940 return; | 942 return; |
| 941 } | 943 } |
| 942 | 944 |
| 943 std::string utf8_selection = UTF16ToUTF8(text.substr(pos, n)); | 945 BrowserContext* browser_context = host_->GetProcess()->GetBrowserContext(); |
| 944 GtkClipboard* x_clipboard = gtk_clipboard_get(GDK_SELECTION_PRIMARY); | 946 // Set the BUFFER_SELECTION to the ui::Clipboard. |
| 945 gtk_clipboard_set_text( | 947 ui::ScopedClipboardWriter clipboard_writer( |
| 946 x_clipboard, utf8_selection.c_str(), utf8_selection.length()); | 948 ui::Clipboard::GetForCurrentThread(), |
| 949 ui::Clipboard::BUFFER_SELECTION, |
| 950 BrowserContext::GetMarkerForOffTheRecordContext(browser_context)); |
| 951 clipboard_writer.WriteText(text.substr(pos, n)); |
| 947 } | 952 } |
| 948 | 953 |
| 949 void RenderWidgetHostViewGtk::SelectionBoundsChanged( | 954 void RenderWidgetHostViewGtk::SelectionBoundsChanged( |
| 950 const ViewHostMsg_SelectionBounds_Params& params) { | 955 const ViewHostMsg_SelectionBounds_Params& params) { |
| 951 im_context_->UpdateCaretBounds( | 956 im_context_->UpdateCaretBounds( |
| 952 gfx::UnionRects(params.anchor_rect, params.focus_rect)); | 957 gfx::UnionRects(params.anchor_rect, params.focus_rect)); |
| 953 } | 958 } |
| 954 | 959 |
| 955 GdkEventButton* RenderWidgetHostViewGtk::GetLastMouseDown() { | 960 GdkEventButton* RenderWidgetHostViewGtk::GetLastMouseDown() { |
| 956 return last_mouse_down_; | 961 return last_mouse_down_; |
| (...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1549 this)); | 1554 this)); |
| 1550 } | 1555 } |
| 1551 BrowserAccessibilityGtk* root = | 1556 BrowserAccessibilityGtk* root = |
| 1552 browser_accessibility_manager_->GetRoot()->ToBrowserAccessibilityGtk(); | 1557 browser_accessibility_manager_->GetRoot()->ToBrowserAccessibilityGtk(); |
| 1553 | 1558 |
| 1554 atk_object_set_role(root->GetAtkObject(), ATK_ROLE_HTML_CONTAINER); | 1559 atk_object_set_role(root->GetAtkObject(), ATK_ROLE_HTML_CONTAINER); |
| 1555 return root->GetAtkObject(); | 1560 return root->GetAtkObject(); |
| 1556 } | 1561 } |
| 1557 | 1562 |
| 1558 } // namespace content | 1563 } // namespace content |
| OLD | NEW |