Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(758)

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_gtk.cc

Issue 9347042: Introduce content::RenderWidgetHostViewPort (in content/port/browser). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to head. Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 } 97 }
98 98
99 bool MovedToCenter(const WebKit::WebMouseEvent& mouse_event, 99 bool MovedToCenter(const WebKit::WebMouseEvent& mouse_event,
100 const gfx::Point& center) { 100 const gfx::Point& center) {
101 return mouse_event.globalX == center.x() && 101 return mouse_event.globalX == center.x() &&
102 mouse_event.globalY == center.y(); 102 mouse_event.globalY == center.y();
103 } 103 }
104 104
105 } // namespace 105 } // namespace
106 106
107 using content::RenderWidgetHostViewPort;
107 using WebKit::WebInputEventFactory; 108 using WebKit::WebInputEventFactory;
108 using WebKit::WebMouseWheelEvent; 109 using WebKit::WebMouseWheelEvent;
109 110
110 // This class is a simple convenience wrapper for Gtk functions. It has only 111 // This class is a simple convenience wrapper for Gtk functions. It has only
111 // static methods. 112 // static methods.
112 class RenderWidgetHostViewGtkWidget { 113 class RenderWidgetHostViewGtkWidget {
113 public: 114 public:
114 static GtkWidget* CreateNewWidget(RenderWidgetHostViewGtk* host_view) { 115 static GtkWidget* CreateNewWidget(RenderWidgetHostViewGtk* host_view) {
115 GtkWidget* widget = gtk_preserve_window_new(); 116 GtkWidget* widget = gtk_preserve_window_new();
116 gtk_widget_set_name(widget, "chrome-render-widget-host-view"); 117 gtk_widget_set_name(widget, "chrome-render-widget-host-view");
(...skipping 783 matching lines...) Expand 10 before | Expand all | Expand 10 after
900 UTF16ToUTF8(clamped_tooltip).c_str()); 901 UTF16ToUTF8(clamped_tooltip).c_str());
901 #if defined(OS_CHROMEOS) 902 #if defined(OS_CHROMEOS)
902 tooltip_window_->SetTooltipText(clamped_tooltip); 903 tooltip_window_->SetTooltipText(clamped_tooltip);
903 #endif // defined(OS_CHROMEOS) 904 #endif // defined(OS_CHROMEOS)
904 } 905 }
905 } 906 }
906 907
907 void RenderWidgetHostViewGtk::SelectionChanged(const string16& text, 908 void RenderWidgetHostViewGtk::SelectionChanged(const string16& text,
908 size_t offset, 909 size_t offset,
909 const ui::Range& range) { 910 const ui::Range& range) {
910 RenderWidgetHostViewBase::SelectionChanged(text, offset, range); 911 content::RenderWidgetHostViewBase::SelectionChanged(text, offset, range);
911 912
912 if (text.empty() || range.is_empty()) 913 if (text.empty() || range.is_empty())
913 return; 914 return;
914 size_t pos = range.GetMin() - offset; 915 size_t pos = range.GetMin() - offset;
915 size_t n = range.length(); 916 size_t n = range.length();
916 917
917 DCHECK(pos + n <= text.length()) << "The text can not fully cover range."; 918 DCHECK(pos + n <= text.length()) << "The text can not fully cover range.";
918 if (pos >= text.length()) { 919 if (pos >= text.length()) {
919 NOTREACHED() << "The text can not cover range."; 920 NOTREACHED() << "The text can not cover range.";
920 return; 921 return;
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
1020 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params, 1021 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params,
1021 int gpu_host_id) { 1022 int gpu_host_id) {
1022 RenderWidgetHost::AcknowledgePostSubBuffer(params.route_id, gpu_host_id); 1023 RenderWidgetHost::AcknowledgePostSubBuffer(params.route_id, gpu_host_id);
1023 } 1024 }
1024 1025
1025 void RenderWidgetHostViewGtk::AcceleratedSurfaceSuspend() { 1026 void RenderWidgetHostViewGtk::AcceleratedSurfaceSuspend() {
1026 } 1027 }
1027 1028
1028 1029
1029 void RenderWidgetHostViewGtk::SetBackground(const SkBitmap& background) { 1030 void RenderWidgetHostViewGtk::SetBackground(const SkBitmap& background) {
1030 RenderWidgetHostViewBase::SetBackground(background); 1031 content::RenderWidgetHostViewBase::SetBackground(background);
1031 host_->Send(new ViewMsg_SetBackground(host_->routing_id(), background)); 1032 host_->Send(new ViewMsg_SetBackground(host_->routing_id(), background));
1032 } 1033 }
1033 1034
1034 void RenderWidgetHostViewGtk::ModifyEventForEdgeDragging( 1035 void RenderWidgetHostViewGtk::ModifyEventForEdgeDragging(
1035 GtkWidget* widget, GdkEventMotion* event) { 1036 GtkWidget* widget, GdkEventMotion* event) {
1036 // If the widget is aligned with an edge of the monitor its on and the user 1037 // If the widget is aligned with an edge of the monitor its on and the user
1037 // attempts to drag past that edge we track the number of times it has 1038 // attempts to drag past that edge we track the number of times it has
1038 // occurred, so that we can force the widget to scroll when it otherwise 1039 // occurred, so that we can force the widget to scroll when it otherwise
1039 // would be unable to, by modifying the (x,y) position in the drag 1040 // would be unable to, by modifying the (x,y) position in the drag
1040 // event that we forward on to webkit. If we get a move that's no longer a 1041 // event that we forward on to webkit. If we get a move that's no longer a
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
1402 //////////////////////////////////////////////////////////////////////////////// 1403 ////////////////////////////////////////////////////////////////////////////////
1403 // RenderWidgetHostView, public: 1404 // RenderWidgetHostView, public:
1404 1405
1405 // static 1406 // static
1406 RenderWidgetHostView* RenderWidgetHostView::CreateViewForWidget( 1407 RenderWidgetHostView* RenderWidgetHostView::CreateViewForWidget(
1407 RenderWidgetHost* widget) { 1408 RenderWidgetHost* widget) {
1408 return new RenderWidgetHostViewGtk(widget); 1409 return new RenderWidgetHostViewGtk(widget);
1409 } 1410 }
1410 1411
1411 // static 1412 // static
1412 void RenderWidgetHostViewBase::GetDefaultScreenInfo( 1413 void content::RenderWidgetHostViewPort::GetDefaultScreenInfo(
1413 WebKit::WebScreenInfo* results) { 1414 WebKit::WebScreenInfo* results) {
1414 GdkWindow* gdk_window = 1415 GdkWindow* gdk_window =
1415 gdk_display_get_default_group(gdk_display_get_default()); 1416 gdk_display_get_default_group(gdk_display_get_default());
1416 content::GetScreenInfoFromNativeWindow(gdk_window, results); 1417 content::GetScreenInfoFromNativeWindow(gdk_window, results);
1417 } 1418 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698