| 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" | |
| 40 #include "content/public/browser/native_web_keyboard_event.h" | 39 #include "content/public/browser/native_web_keyboard_event.h" |
| 41 #include "content/public/common/content_switches.h" | 40 #include "content/public/common/content_switches.h" |
| 42 #include "skia/ext/platform_canvas.h" | 41 #include "skia/ext/platform_canvas.h" |
| 43 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" | 42 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" |
| 44 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h" | 43 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h" |
| 45 #include "third_party/WebKit/Source/WebKit/chromium/public/gtk/WebInputEventFact
ory.h" | 44 #include "third_party/WebKit/Source/WebKit/chromium/public/gtk/WebInputEventFact
ory.h" |
| 46 #include "third_party/WebKit/Source/WebKit/chromium/public/x11/WebScreenInfoFact
ory.h" | 45 #include "third_party/WebKit/Source/WebKit/chromium/public/x11/WebScreenInfoFact
ory.h" |
| 47 #include "ui/base/clipboard/scoped_clipboard_writer.h" | |
| 48 #include "ui/base/gtk/gtk_compat.h" | 46 #include "ui/base/gtk/gtk_compat.h" |
| 49 #include "ui/base/text/text_elider.h" | 47 #include "ui/base/text/text_elider.h" |
| 50 #include "ui/base/x/active_window_watcher_x.h" | 48 #include "ui/base/x/active_window_watcher_x.h" |
| 51 #include "ui/base/x/x11_util.h" | 49 #include "ui/base/x/x11_util.h" |
| 52 #include "ui/gfx/gtk_native_view_id_manager.h" | 50 #include "ui/gfx/gtk_native_view_id_manager.h" |
| 53 #include "ui/gfx/gtk_preserve_window.h" | 51 #include "ui/gfx/gtk_preserve_window.h" |
| 54 #include "webkit/glue/webcursor_gtk_data.h" | 52 #include "webkit/glue/webcursor_gtk_data.h" |
| 55 #include "webkit/plugins/npapi/webplugin.h" | 53 #include "webkit/plugins/npapi/webplugin.h" |
| 56 | 54 |
| 57 using WebKit::WebInputEventFactory; | 55 using WebKit::WebInputEventFactory; |
| (...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 937 return; | 935 return; |
| 938 size_t pos = range.GetMin() - offset; | 936 size_t pos = range.GetMin() - offset; |
| 939 size_t n = range.length(); | 937 size_t n = range.length(); |
| 940 | 938 |
| 941 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."; |
| 942 if (pos >= text.length()) { | 940 if (pos >= text.length()) { |
| 943 NOTREACHED() << "The text can not cover range."; | 941 NOTREACHED() << "The text can not cover range."; |
| 944 return; | 942 return; |
| 945 } | 943 } |
| 946 | 944 |
| 947 BrowserContext* browser_context = host_->GetProcess()->GetBrowserContext(); | 945 std::string utf8_selection = UTF16ToUTF8(text.substr(pos, n)); |
| 948 // Set the BUFFER_SELECTION to the ui::Clipboard. | 946 GtkClipboard* x_clipboard = gtk_clipboard_get(GDK_SELECTION_PRIMARY); |
| 949 ui::ScopedClipboardWriter clipboard_writer( | 947 gtk_clipboard_set_text( |
| 950 ui::Clipboard::GetForCurrentThread(), | 948 x_clipboard, utf8_selection.c_str(), utf8_selection.length()); |
| 951 ui::Clipboard::BUFFER_SELECTION, | |
| 952 BrowserContext::GetMarkerForOffTheRecordContext(browser_context)); | |
| 953 clipboard_writer.WriteText(text.substr(pos, n)); | |
| 954 } | 949 } |
| 955 | 950 |
| 956 void RenderWidgetHostViewGtk::SelectionBoundsChanged( | 951 void RenderWidgetHostViewGtk::SelectionBoundsChanged( |
| 957 const ViewHostMsg_SelectionBounds_Params& params) { | 952 const ViewHostMsg_SelectionBounds_Params& params) { |
| 958 im_context_->UpdateCaretBounds( | 953 im_context_->UpdateCaretBounds( |
| 959 gfx::UnionRects(params.anchor_rect, params.focus_rect)); | 954 gfx::UnionRects(params.anchor_rect, params.focus_rect)); |
| 960 } | 955 } |
| 961 | 956 |
| 962 GdkEventButton* RenderWidgetHostViewGtk::GetLastMouseDown() { | 957 GdkEventButton* RenderWidgetHostViewGtk::GetLastMouseDown() { |
| 963 return last_mouse_down_; | 958 return last_mouse_down_; |
| (...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1577 this)); | 1572 this)); |
| 1578 } | 1573 } |
| 1579 BrowserAccessibilityGtk* root = | 1574 BrowserAccessibilityGtk* root = |
| 1580 browser_accessibility_manager_->GetRoot()->ToBrowserAccessibilityGtk(); | 1575 browser_accessibility_manager_->GetRoot()->ToBrowserAccessibilityGtk(); |
| 1581 | 1576 |
| 1582 atk_object_set_role(root->GetAtkObject(), ATK_ROLE_HTML_CONTAINER); | 1577 atk_object_set_role(root->GetAtkObject(), ATK_ROLE_HTML_CONTAINER); |
| 1583 return root->GetAtkObject(); | 1578 return root->GetAtkObject(); |
| 1584 } | 1579 } |
| 1585 | 1580 |
| 1586 } // namespace content | 1581 } // namespace content |
| OLD | NEW |