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

Side by Side Diff: chrome/browser/renderer_host/render_widget_host_view_views_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 | « no previous file | content/browser/renderer_host/gtk_window_utils.h » ('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 "chrome/browser/renderer_host/render_widget_host_view_views.h" 5 #include "chrome/browser/renderer_host/render_widget_host_view_views.h"
6 6
7 #include <gdk/gdkx.h> 7 #include <gdk/gdkx.h>
8 #include <gtk/gtk.h> 8 #include <gtk/gtk.h>
9 9
10 #include "content/browser/renderer_host/gtk_window_utils.h"
10 #include "ui/base/keycodes/keyboard_code_conversion_gtk.h" 11 #include "ui/base/keycodes/keyboard_code_conversion_gtk.h"
11 #include "ui/base/x/x11_util.h" 12 #include "ui/base/x/x11_util.h"
12 #include "ui/gfx/gtk_native_view_id_manager.h" 13 #include "ui/gfx/gtk_native_view_id_manager.h"
13 #include "views/views_delegate.h" 14 #include "views/views_delegate.h"
14 #include "views/widget/native_widget_gtk.h" 15 #include "views/widget/native_widget_gtk.h"
15 16
16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h" 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h"
17 #include "third_party/WebKit/Source/WebKit/chromium/public/x11/WebScreenInfoFact ory.h"
18
19 namespace {
20
21 // TODO(oshima): This is a copy from RenderWidgetHostViewGtk. Replace this
22 // with gdk-less implementation.
23 void GetScreenInfoFromNativeWindow(
24 GdkWindow* gdk_window, WebKit::WebScreenInfo* results) {
25 GdkScreen* screen = gdk_drawable_get_screen(gdk_window);
26 *results = WebKit::WebScreenInfoFactory::screenInfo(
27 gdk_x11_drawable_get_xdisplay(gdk_window),
28 gdk_x11_screen_get_screen_number(screen));
29
30 // TODO(tony): We should move this code into WebScreenInfoFactory.
31 int monitor_number = gdk_screen_get_monitor_at_window(screen, gdk_window);
32 GdkRectangle monitor_rect;
33 gdk_screen_get_monitor_geometry(screen, monitor_number, &monitor_rect);
34 results->rect = WebKit::WebRect(monitor_rect.x, monitor_rect.y,
35 monitor_rect.width, monitor_rect.height);
36 // TODO(tony): Should we query _NET_WORKAREA to get the workarea?
37 results->availableRect = results->rect;
38 }
39
40 } // namespace
41 18
42 void RenderWidgetHostViewViews::UpdateCursor(const WebCursor& cursor) { 19 void RenderWidgetHostViewViews::UpdateCursor(const WebCursor& cursor) {
43 // Optimize the common case, where the cursor hasn't changed. 20 // Optimize the common case, where the cursor hasn't changed.
44 // However, we can switch between different pixmaps, so only on the 21 // However, we can switch between different pixmaps, so only on the
45 // non-pixmap branch. 22 // non-pixmap branch.
46 if (current_cursor_.GetCursorType() != GDK_CURSOR_IS_PIXMAP && 23 if (current_cursor_.GetCursorType() != GDK_CURSOR_IS_PIXMAP &&
47 current_cursor_.GetCursorType() == cursor.GetCursorType()) { 24 current_cursor_.GetCursorType() == cursor.GetCursorType()) {
48 return; 25 return;
49 } 26 }
50 27
51 current_cursor_ = cursor; 28 current_cursor_ = cursor;
52 ShowCurrentCursor(); 29 ShowCurrentCursor();
53 } 30 }
54 31
55 void RenderWidgetHostViewViews::CreatePluginContainer( 32 void RenderWidgetHostViewViews::CreatePluginContainer(
56 gfx::PluginWindowHandle id) { 33 gfx::PluginWindowHandle id) {
57 // TODO(anicolao): plugin_container_manager_.CreatePluginContainer(id); 34 // TODO(anicolao): plugin_container_manager_.CreatePluginContainer(id);
58 } 35 }
59 36
60 void RenderWidgetHostViewViews::DestroyPluginContainer( 37 void RenderWidgetHostViewViews::DestroyPluginContainer(
61 gfx::PluginWindowHandle id) { 38 gfx::PluginWindowHandle id) {
62 // TODO(anicolao): plugin_container_manager_.DestroyPluginContainer(id); 39 // TODO(anicolao): plugin_container_manager_.DestroyPluginContainer(id);
63 } 40 }
64 41
65 void RenderWidgetHostViewViews::GetScreenInfo(WebKit::WebScreenInfo* results) { 42 void RenderWidgetHostViewViews::GetScreenInfo(WebKit::WebScreenInfo* results) {
66 views::Widget* widget = GetWidget() ? GetWidget()->GetTopLevelWidget() : NULL; 43 views::Widget* widget = GetWidget() ? GetWidget()->GetTopLevelWidget() : NULL;
67 if (widget) 44 if (widget)
68 GetScreenInfoFromNativeWindow(widget->GetNativeView()->window, results); 45 content::GetScreenInfoFromNativeWindow(widget->GetNativeView()->window,
46 results);
69 } 47 }
70 48
71 gfx::Rect RenderWidgetHostViewViews::GetRootWindowBounds() { 49 gfx::Rect RenderWidgetHostViewViews::GetRootWindowBounds() {
72 views::Widget* widget = GetWidget() ? GetWidget()->GetTopLevelWidget() : NULL; 50 views::Widget* widget = GetWidget() ? GetWidget()->GetTopLevelWidget() : NULL;
73 return widget ? widget->GetWindowScreenBounds() : gfx::Rect(); 51 return widget ? widget->GetWindowScreenBounds() : gfx::Rect();
74 } 52 }
75 53
76 void RenderWidgetHostViewViews::AcceleratedCompositingActivated( 54 void RenderWidgetHostViewViews::AcceleratedCompositingActivated(
77 bool activated) { 55 bool activated) {
78 // TODO(anicolao): figure out if we need something here 56 // TODO(anicolao): figure out if we need something here
(...skipping 28 matching lines...) Expand all
107 } 85 }
108 86
109 void RenderWidgetHostViewViews::ShowCurrentCursor() { 87 void RenderWidgetHostViewViews::ShowCurrentCursor() {
110 // The widget may not have a window. If that's the case, abort mission. This 88 // The widget may not have a window. If that's the case, abort mission. This
111 // is the same issue as that explained above in Paint(). 89 // is the same issue as that explained above in Paint().
112 if (!GetInnerNativeView() || !GetInnerNativeView()->window) 90 if (!GetInnerNativeView() || !GetInnerNativeView()->window)
113 return; 91 return;
114 92
115 native_cursor_ = current_cursor_.GetNativeCursor(); 93 native_cursor_ = current_cursor_.GetNativeCursor();
116 } 94 }
117
118 #if defined(TOUCH_UI)
119 // static
120 void RenderWidgetHostView::GetDefaultScreenInfo(
121 WebKit::WebScreenInfo* results) {
122 GdkWindow* gdk_window =
123 gdk_display_get_default_group(gdk_display_get_default());
124 GetScreenInfoFromNativeWindow(gdk_window, results);
125 }
126 #endif
OLDNEW
« no previous file with comments | « no previous file | content/browser/renderer_host/gtk_window_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698