| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "chrome/browser/renderer_host/render_widget_host_view_gtk.h" | 5 #include "chrome/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 URLRequestStatus::Status. | 9 // badly with URLRequestStatus::Status. |
| 10 #include "chrome/common/render_messages.h" | 10 #include "chrome/common/render_messages.h" |
| (...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 517 } else { | 517 } else { |
| 518 gtk_widget_set_tooltip_text(view_.get(), WideToUTF8(tooltip_text).c_str()); | 518 gtk_widget_set_tooltip_text(view_.get(), WideToUTF8(tooltip_text).c_str()); |
| 519 } | 519 } |
| 520 } | 520 } |
| 521 | 521 |
| 522 void RenderWidgetHostViewGtk::SelectionChanged(const std::string& text) { | 522 void RenderWidgetHostViewGtk::SelectionChanged(const std::string& text) { |
| 523 GtkClipboard* x_clipboard = gtk_clipboard_get(GDK_SELECTION_PRIMARY); | 523 GtkClipboard* x_clipboard = gtk_clipboard_get(GDK_SELECTION_PRIMARY); |
| 524 gtk_clipboard_set_text(x_clipboard, text.c_str(), text.length()); | 524 gtk_clipboard_set_text(x_clipboard, text.c_str(), text.length()); |
| 525 } | 525 } |
| 526 | 526 |
| 527 void RenderWidgetHostViewGtk::PasteFromSelectionClipboard() { | |
| 528 GtkClipboard* x_clipboard = gtk_clipboard_get(GDK_SELECTION_PRIMARY); | |
| 529 gtk_clipboard_request_text(x_clipboard, ReceivedSelectionText, this); | |
| 530 } | |
| 531 | |
| 532 void RenderWidgetHostViewGtk::ShowingContextMenu(bool showing) { | 527 void RenderWidgetHostViewGtk::ShowingContextMenu(bool showing) { |
| 533 is_showing_context_menu_ = showing; | 528 is_showing_context_menu_ = showing; |
| 534 } | 529 } |
| 535 | 530 |
| 536 BackingStore* RenderWidgetHostViewGtk::AllocBackingStore( | 531 BackingStore* RenderWidgetHostViewGtk::AllocBackingStore( |
| 537 const gfx::Size& size) { | 532 const gfx::Size& size) { |
| 538 return new BackingStore(host_, size, | 533 return new BackingStore(host_, size, |
| 539 x11_util::GetVisualFromGtkWidget(view_.get()), | 534 x11_util::GetVisualFromGtkWidget(view_.get()), |
| 540 gtk_widget_get_visual(view_.get())->depth); | 535 gtk_widget_get_visual(view_.get())->depth); |
| 541 } | 536 } |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 607 | 602 |
| 608 default: | 603 default: |
| 609 gdk_cursor = gdk_cursor_new(current_cursor_.GetCursorType()); | 604 gdk_cursor = gdk_cursor_new(current_cursor_.GetCursorType()); |
| 610 } | 605 } |
| 611 gdk_window_set_cursor(view_.get()->window, gdk_cursor); | 606 gdk_window_set_cursor(view_.get()->window, gdk_cursor); |
| 612 // The window now owns the cursor. | 607 // The window now owns the cursor. |
| 613 if (gdk_cursor) | 608 if (gdk_cursor) |
| 614 gdk_cursor_unref(gdk_cursor); | 609 gdk_cursor_unref(gdk_cursor); |
| 615 } | 610 } |
| 616 | 611 |
| 617 void RenderWidgetHostViewGtk::ReceivedSelectionText(GtkClipboard* clipboard, | |
| 618 const gchar* text, gpointer userdata) { | |
| 619 // If there's nothing to paste (|text| is NULL), do nothing. | |
| 620 if (!text) | |
| 621 return; | |
| 622 RenderWidgetHostViewGtk* host_view = | |
| 623 reinterpret_cast<RenderWidgetHostViewGtk*>(userdata); | |
| 624 host_view->host_->Send(new ViewMsg_InsertText(host_view->host_->routing_id(), | |
| 625 UTF8ToUTF16(text))); | |
| 626 } | |
| 627 | |
| 628 void RenderWidgetHostViewGtk::CreatePluginContainer( | 612 void RenderWidgetHostViewGtk::CreatePluginContainer( |
| 629 gfx::PluginWindowHandle id) { | 613 gfx::PluginWindowHandle id) { |
| 630 plugin_container_manager_.CreatePluginContainer(id); | 614 plugin_container_manager_.CreatePluginContainer(id); |
| 631 } | 615 } |
| 632 | 616 |
| 633 void RenderWidgetHostViewGtk::DestroyPluginContainer( | 617 void RenderWidgetHostViewGtk::DestroyPluginContainer( |
| 634 gfx::PluginWindowHandle id) { | 618 gfx::PluginWindowHandle id) { |
| 635 plugin_container_manager_.DestroyPluginContainer(id); | 619 plugin_container_manager_.DestroyPluginContainer(id); |
| 636 } | 620 } |
| OLD | NEW |