OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "chrome/browser/renderer_host/render_widget_host_view_views.h" | |
6 | |
7 #include <gdk/gdkx.h> | |
8 #include <gtk/gtk.h> | |
9 | |
10 #include "content/browser/renderer_host/gtk_window_utils.h" | |
11 #include "ui/base/keycodes/keyboard_code_conversion_gtk.h" | |
12 #include "ui/base/x/x11_util.h" | |
13 #include "ui/gfx/gtk_native_view_id_manager.h" | |
14 #include "views/views_delegate.h" | |
15 #include "views/widget/native_widget_gtk.h" | |
16 | |
17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h" | |
18 | |
19 void RenderWidgetHostViewViews::UpdateCursor(const WebCursor& cursor) { | |
20 // Optimize the common case, where the cursor hasn't changed. | |
21 // However, we can switch between different pixmaps, so only on the | |
22 // non-pixmap branch. | |
23 if (current_cursor_.GetCursorType() != GDK_CURSOR_IS_PIXMAP && | |
24 current_cursor_.GetCursorType() == cursor.GetCursorType()) { | |
25 return; | |
26 } | |
27 | |
28 current_cursor_ = cursor; | |
29 ShowCurrentCursor(); | |
30 } | |
31 | |
32 void RenderWidgetHostViewViews::CreatePluginContainer( | |
33 gfx::PluginWindowHandle id) { | |
34 // TODO(anicolao): plugin_container_manager_.CreatePluginContainer(id); | |
35 } | |
36 | |
37 void RenderWidgetHostViewViews::DestroyPluginContainer( | |
38 gfx::PluginWindowHandle id) { | |
39 // TODO(anicolao): plugin_container_manager_.DestroyPluginContainer(id); | |
40 } | |
41 | |
42 void RenderWidgetHostViewViews::GetScreenInfo(WebKit::WebScreenInfo* results) { | |
43 views::Widget* widget = GetWidget() ? GetWidget()->GetTopLevelWidget() : NULL; | |
44 if (widget) | |
45 content::GetScreenInfoFromNativeWindow(widget->GetNativeView()->window, | |
46 results); | |
47 } | |
48 | |
49 gfx::Rect RenderWidgetHostViewViews::GetRootWindowBounds() { | |
50 views::Widget* widget = GetWidget() ? GetWidget()->GetTopLevelWidget() : NULL; | |
51 return widget ? widget->GetWindowScreenBounds() : gfx::Rect(); | |
52 } | |
53 | |
54 void RenderWidgetHostViewViews::AcceleratedCompositingActivated( | |
55 bool activated) { | |
56 // TODO(anicolao): figure out if we need something here | |
57 if (activated) | |
58 NOTIMPLEMENTED(); | |
59 } | |
60 | |
61 #if !defined(TOUCH_UI) | |
62 gfx::PluginWindowHandle RenderWidgetHostViewViews::GetCompositingSurface() { | |
63 // TODO(oshima): The original implementation was broken as | |
64 // GtkNativeViewManager doesn't know about NativeWidgetGtk. Figure | |
65 // out if this makes sense without compositor. If it does, then find | |
66 // out the right way to handle. | |
67 NOTIMPLEMENTED(); | |
68 return gfx::kNullPluginWindow; | |
69 } | |
70 #endif | |
71 | |
72 gfx::NativeView RenderWidgetHostViewViews::GetInnerNativeView() const { | |
73 const views::View* view = NULL; | |
74 if (views::ViewsDelegate::views_delegate) | |
75 view = views::ViewsDelegate::views_delegate->GetDefaultParentView(); | |
76 if (!view) | |
77 view = this; | |
78 | |
79 // TODO(sad): Ideally this function should be equivalent to GetNativeView, and | |
80 // NativeWidgetGtk-specific function call should not be necessary. | |
81 const views::Widget* widget = view->GetWidget(); | |
82 const views::NativeWidget* native = widget ? widget->native_widget() : NULL; | |
83 return native ? static_cast<const views::NativeWidgetGtk*>(native)-> | |
84 window_contents() : NULL; | |
85 } | |
86 | |
87 void RenderWidgetHostViewViews::ShowCurrentCursor() { | |
88 // The widget may not have a window. If that's the case, abort mission. This | |
89 // is the same issue as that explained above in Paint(). | |
90 if (!GetInnerNativeView() || !GetInnerNativeView()->window) | |
91 return; | |
92 | |
93 native_cursor_ = current_cursor_.GetNativeCursor(); | |
94 } | |
OLD | NEW |