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 "ui/base/keycodes/keyboard_code_conversion_gtk.h" |
| 8 #include "ui/base/x/x11_util.h" |
| 9 #include "ui/gfx/gtk_native_view_id_manager.h" |
| 10 #include "views/widget/native_widget_gtk.h" |
| 11 |
| 12 void RenderWidgetHostViewViews::UpdateCursor(const WebCursor& cursor) { |
| 13 // Optimize the common case, where the cursor hasn't changed. |
| 14 // However, we can switch between different pixmaps, so only on the |
| 15 // non-pixmap branch. |
| 16 if (current_cursor_.GetCursorType() != GDK_CURSOR_IS_PIXMAP && |
| 17 current_cursor_.GetCursorType() == cursor.GetCursorType()) { |
| 18 return; |
| 19 } |
| 20 |
| 21 current_cursor_ = cursor; |
| 22 ShowCurrentCursor(); |
| 23 } |
| 24 |
| 25 void RenderWidgetHostViewViews::CreatePluginContainer( |
| 26 gfx::PluginWindowHandle id) { |
| 27 // TODO(anicolao): plugin_container_manager_.CreatePluginContainer(id); |
| 28 } |
| 29 |
| 30 void RenderWidgetHostViewViews::DestroyPluginContainer( |
| 31 gfx::PluginWindowHandle id) { |
| 32 // TODO(anicolao): plugin_container_manager_.DestroyPluginContainer(id); |
| 33 } |
| 34 |
| 35 void RenderWidgetHostViewViews::AcceleratedCompositingActivated( |
| 36 bool activated) { |
| 37 // TODO(anicolao): figure out if we need something here |
| 38 if (activated) |
| 39 NOTIMPLEMENTED(); |
| 40 } |
| 41 |
| 42 gfx::PluginWindowHandle RenderWidgetHostViewViews::GetCompositingSurface() { |
| 43 GtkNativeViewManager* manager = GtkNativeViewManager::GetInstance(); |
| 44 gfx::PluginWindowHandle surface = gfx::kNullPluginWindow; |
| 45 gfx::NativeViewId view_id = gfx::IdFromNativeView(GetInnerNativeView()); |
| 46 |
| 47 if (!manager->GetXIDForId(&surface, view_id)) { |
| 48 DLOG(ERROR) << "Can't find XID for view id " << view_id; |
| 49 } |
| 50 return surface; |
| 51 } |
| 52 |
| 53 gfx::NativeView RenderWidgetHostViewViews::GetInnerNativeView() const { |
| 54 // TODO(sad): Ideally this function should be equivalent to GetNativeView, and |
| 55 // NativeWidgetGtk-specific function call should not be necessary. |
| 56 const views::Widget* widget = GetWidget(); |
| 57 const views::NativeWidget* native = widget ? widget->native_widget() : NULL; |
| 58 return native ? static_cast<const views::NativeWidgetGtk*>(native)-> |
| 59 window_contents() : NULL; |
| 60 } |
| 61 |
| 62 void RenderWidgetHostViewViews::ShowCurrentCursor() { |
| 63 // The widget may not have a window. If that's the case, abort mission. This |
| 64 // is the same issue as that explained above in Paint(). |
| 65 if (!GetInnerNativeView() || !GetInnerNativeView()->window) |
| 66 return; |
| 67 |
| 68 native_cursor_ = current_cursor_.GetNativeCursor(); |
| 69 } |
| 70 |
OLD | NEW |