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

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

Issue 7753013: content: Make ifdefs match with where this is used (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Factor out common code Created 9 years, 4 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
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view.cc ('k') | content/content_browser.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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"
11 11
12 #include <cairo/cairo.h> 12 #include <cairo/cairo.h>
13 #include <gdk/gdk.h> 13 #include <gdk/gdk.h>
14 #include <gdk/gdkkeysyms.h> 14 #include <gdk/gdkkeysyms.h>
15 #include <gdk/gdkx.h> 15 #include <gdk/gdkx.h>
16 #include <gtk/gtk.h> 16 #include <gtk/gtk.h>
17 17
18 #include <algorithm> 18 #include <algorithm>
19 #include <string> 19 #include <string>
20 20
21 #include "base/command_line.h" 21 #include "base/command_line.h"
22 #include "base/logging.h" 22 #include "base/logging.h"
23 #include "base/message_loop.h" 23 #include "base/message_loop.h"
24 #include "base/metrics/histogram.h" 24 #include "base/metrics/histogram.h"
25 #include "base/string_number_conversions.h" 25 #include "base/string_number_conversions.h"
26 #include "base/time.h" 26 #include "base/time.h"
27 #include "base/utf_string_conversions.h" 27 #include "base/utf_string_conversions.h"
28 #include "content/browser/renderer_host/backing_store_x.h" 28 #include "content/browser/renderer_host/backing_store_x.h"
29 #include "content/browser/renderer_host/gtk_im_context_wrapper.h" 29 #include "content/browser/renderer_host/gtk_im_context_wrapper.h"
30 #include "content/browser/renderer_host/gtk_window_utils.h"
30 #include "content/browser/renderer_host/render_view_host.h" 31 #include "content/browser/renderer_host/render_view_host.h"
31 #include "content/browser/renderer_host/render_view_host_delegate.h" 32 #include "content/browser/renderer_host/render_view_host_delegate.h"
32 #include "content/browser/renderer_host/render_widget_host.h" 33 #include "content/browser/renderer_host/render_widget_host.h"
33 #include "content/common/content_switches.h" 34 #include "content/common/content_switches.h"
34 #include "content/common/native_web_keyboard_event.h" 35 #include "content/common/native_web_keyboard_event.h"
35 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h" 36 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h"
36 #include "third_party/WebKit/Source/WebKit/chromium/public/gtk/WebInputEventFact ory.h" 37 #include "third_party/WebKit/Source/WebKit/chromium/public/gtk/WebInputEventFact ory.h"
37 #include "third_party/WebKit/Source/WebKit/chromium/public/x11/WebScreenInfoFact ory.h" 38 #include "third_party/WebKit/Source/WebKit/chromium/public/x11/WebScreenInfoFact ory.h"
38 #include "ui/base/text/text_elider.h" 39 #include "ui/base/text/text_elider.h"
39 #include "ui/base/x/x11_util.h" 40 #include "ui/base/x/x11_util.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 GdkPixmap* mask = 88 GdkPixmap* mask =
88 gdk_bitmap_create_from_data(NULL, moz_spinning_mask_bits, 32, 32); 89 gdk_bitmap_create_from_data(NULL, moz_spinning_mask_bits, 32, 32);
89 moz_spinning_cursor = 90 moz_spinning_cursor =
90 gdk_cursor_new_from_pixmap(source, mask, &fg, &bg, 2, 2); 91 gdk_cursor_new_from_pixmap(source, mask, &fg, &bg, 2, 2);
91 g_object_unref(source); 92 g_object_unref(source);
92 g_object_unref(mask); 93 g_object_unref(mask);
93 } 94 }
94 return moz_spinning_cursor; 95 return moz_spinning_cursor;
95 } 96 }
96 97
97 void GetScreenInfoFromNativeWindow(
98 GdkWindow* gdk_window, WebKit::WebScreenInfo* results) {
99 GdkScreen* screen = gdk_drawable_get_screen(gdk_window);
100 *results = WebKit::WebScreenInfoFactory::screenInfo(
101 gdk_x11_drawable_get_xdisplay(gdk_window),
102 gdk_x11_screen_get_screen_number(screen));
103
104 // TODO(tony): We should move this code into WebScreenInfoFactory.
105 gint monitor_number = gdk_screen_get_monitor_at_window(screen, gdk_window);
106 GdkRectangle monitor_rect;
107 gdk_screen_get_monitor_geometry(screen, monitor_number, &monitor_rect);
108 results->rect = WebKit::WebRect(monitor_rect.x, monitor_rect.y,
109 monitor_rect.width, monitor_rect.height);
110 // TODO(tony): Should we query _NET_WORKAREA to get the workarea?
111 results->availableRect = results->rect;
112 }
113
114 } // namespace 98 } // namespace
115 99
116 using WebKit::WebInputEventFactory; 100 using WebKit::WebInputEventFactory;
117 using WebKit::WebMouseWheelEvent; 101 using WebKit::WebMouseWheelEvent;
118 102
119 // This class is a simple convenience wrapper for Gtk functions. It has only 103 // This class is a simple convenience wrapper for Gtk functions. It has only
120 // static methods. 104 // static methods.
121 class RenderWidgetHostViewGtkWidget { 105 class RenderWidgetHostViewGtkWidget {
122 public: 106 public:
123 static GtkWidget* CreateNewWidget(RenderWidgetHostViewGtk* host_view) { 107 static GtkWidget* CreateNewWidget(RenderWidgetHostViewGtk* host_view) {
(...skipping 1043 matching lines...) Expand 10 before | Expand all | Expand 10 after
1167 } 1151 }
1168 1152
1169 void RenderWidgetHostViewGtk::GetScreenInfo(WebKit::WebScreenInfo* results) { 1153 void RenderWidgetHostViewGtk::GetScreenInfo(WebKit::WebScreenInfo* results) {
1170 GdkWindow* gdk_window = view_.get()->window; 1154 GdkWindow* gdk_window = view_.get()->window;
1171 if (!gdk_window) { 1155 if (!gdk_window) {
1172 GdkDisplay* display = gdk_display_get_default(); 1156 GdkDisplay* display = gdk_display_get_default();
1173 gdk_window = gdk_display_get_default_group(display); 1157 gdk_window = gdk_display_get_default_group(display);
1174 } 1158 }
1175 if (!gdk_window) 1159 if (!gdk_window)
1176 return; 1160 return;
1177 GetScreenInfoFromNativeWindow(gdk_window, results); 1161 content::GetScreenInfoFromNativeWindow(gdk_window, results);
1178 } 1162 }
1179 1163
1180 gfx::Rect RenderWidgetHostViewGtk::GetRootWindowBounds() { 1164 gfx::Rect RenderWidgetHostViewGtk::GetRootWindowBounds() {
1181 GtkWidget* toplevel = gtk_widget_get_toplevel(view_.get()); 1165 GtkWidget* toplevel = gtk_widget_get_toplevel(view_.get());
1182 if (!toplevel) 1166 if (!toplevel)
1183 return gfx::Rect(); 1167 return gfx::Rect();
1184 1168
1185 GdkRectangle frame_extents; 1169 GdkRectangle frame_extents;
1186 GdkWindow* gdk_window = toplevel->window; 1170 GdkWindow* gdk_window = toplevel->window;
1187 if (!gdk_window) 1171 if (!gdk_window)
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
1250 gdk_event_free(reinterpret_cast<GdkEvent*>(last_mouse_down_)); 1234 gdk_event_free(reinterpret_cast<GdkEvent*>(last_mouse_down_));
1251 1235
1252 last_mouse_down_ = temp; 1236 last_mouse_down_ = temp;
1253 } 1237 }
1254 1238
1255 // static 1239 // static
1256 void RenderWidgetHostView::GetDefaultScreenInfo( 1240 void RenderWidgetHostView::GetDefaultScreenInfo(
1257 WebKit::WebScreenInfo* results) { 1241 WebKit::WebScreenInfo* results) {
1258 GdkWindow* gdk_window = 1242 GdkWindow* gdk_window =
1259 gdk_display_get_default_group(gdk_display_get_default()); 1243 gdk_display_get_default_group(gdk_display_get_default());
1260 GetScreenInfoFromNativeWindow(gdk_window, results); 1244 content::GetScreenInfoFromNativeWindow(gdk_window, results);
1261 } 1245 }
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view.cc ('k') | content/content_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698