| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #ifndef CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_ | 5 #ifndef CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_ |
| 6 #define CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_ | 6 #define CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_ |
| 7 | 7 |
| 8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
| 9 #import <QuartzCore/CALayer.h> |
| 9 | 10 |
| 10 #include "base/scoped_nsobject.h" | 11 #include "base/scoped_nsobject.h" |
| 11 #include "base/scoped_ptr.h" | 12 #include "base/scoped_ptr.h" |
| 12 #include "base/task.h" | 13 #include "base/task.h" |
| 13 #include "base/time.h" | 14 #include "base/time.h" |
| 14 #include "chrome/browser/cocoa/base_view.h" | 15 #include "chrome/browser/cocoa/base_view.h" |
| 15 #include "chrome/browser/renderer_host/render_widget_host_view.h" | 16 #include "chrome/browser/renderer_host/render_widget_host_view.h" |
| 16 #include "webkit/glue/webcursor.h" | 17 #include "webkit/glue/webcursor.h" |
| 17 #include "webkit/glue/webmenuitem.h" | 18 #include "webkit/glue/webmenuitem.h" |
| 19 #include "webkit/glue/plugins/mac_gpu_plugin_container_manager.h" |
| 18 | 20 |
| 19 class RenderWidgetHostViewMac; | 21 class RenderWidgetHostViewMac; |
| 20 class RWHVMEditCommandHelper; | 22 class RWHVMEditCommandHelper; |
| 21 @class ToolTip; | 23 @class ToolTip; |
| 22 | 24 |
| 23 @protocol RenderWidgetHostViewMacOwner | 25 @protocol RenderWidgetHostViewMacOwner |
| 24 - (RenderWidgetHostViewMac*)renderWidgetHostViewMac; | 26 - (RenderWidgetHostViewMac*)renderWidgetHostViewMac; |
| 25 @end | 27 @end |
| 26 | 28 |
| 27 // This is the view that lives in the Cocoa view hierarchy. In Windows-land, | 29 // This is the view that lives in the Cocoa view hierarchy. In Windows-land, |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 virtual void ShowPopupWithItems(gfx::Rect bounds, | 107 virtual void ShowPopupWithItems(gfx::Rect bounds, |
| 106 int item_height, | 108 int item_height, |
| 107 int selected_item, | 109 int selected_item, |
| 108 const std::vector<WebMenuItem>& items); | 110 const std::vector<WebMenuItem>& items); |
| 109 virtual gfx::Rect GetWindowRect(); | 111 virtual gfx::Rect GetWindowRect(); |
| 110 virtual gfx::Rect GetRootWindowRect(); | 112 virtual gfx::Rect GetRootWindowRect(); |
| 111 virtual void SetActive(bool active); | 113 virtual void SetActive(bool active); |
| 112 virtual void SetWindowVisibility(bool visible); | 114 virtual void SetWindowVisibility(bool visible); |
| 113 virtual void SetBackground(const SkBitmap& background); | 115 virtual void SetBackground(const SkBitmap& background); |
| 114 | 116 |
| 117 // Methods associated with GPU plugin instances |
| 118 virtual gfx::PluginWindowHandle AllocateFakePluginWindowHandle(); |
| 119 virtual void DestroyFakePluginWindowHandle(gfx::PluginWindowHandle window); |
| 120 virtual void GPUPluginSetIOSurface(gfx::PluginWindowHandle window, |
| 121 int32 width, |
| 122 int32 height, |
| 123 uint64 io_surface_identifier); |
| 124 virtual void GPUPluginBuffersSwapped(gfx::PluginWindowHandle window); |
| 125 // Draws the current GPU plugin instances into the given context. |
| 126 virtual void DrawGPUPluginInstances(CGLContextObj context); |
| 127 |
| 115 void KillSelf(); | 128 void KillSelf(); |
| 116 | 129 |
| 117 void set_parent_view(BaseView* parent_view) { parent_view_ = parent_view; } | 130 void set_parent_view(BaseView* parent_view) { parent_view_ = parent_view; } |
| 118 | 131 |
| 119 // These member variables should be private, but the associated ObjC class | 132 // These member variables should be private, but the associated ObjC class |
| 120 // needs access to them and can't be made a friend. | 133 // needs access to them and can't be made a friend. |
| 121 | 134 |
| 122 // The associated Model. Can be NULL if Destroy() is called when | 135 // The associated Model. Can be NULL if Destroy() is called when |
| 123 // someone (other than superview) has retained |cocoa_view_|. | 136 // someone (other than superview) has retained |cocoa_view_|. |
| 124 RenderWidgetHost* render_widget_host_; | 137 RenderWidgetHost* render_widget_host_; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 // To create a Char event in NSTextInput methods, we save the latest state | 187 // To create a Char event in NSTextInput methods, we save the latest state |
| 175 // of modifier keys when we receive it. | 188 // of modifier keys when we receive it. |
| 176 int im_modifiers_; | 189 int im_modifiers_; |
| 177 | 190 |
| 178 // Represents the cursor position in this view coordinate. | 191 // Represents the cursor position in this view coordinate. |
| 179 // The renderer sends the cursor position through an IPC message. | 192 // The renderer sends the cursor position through an IPC message. |
| 180 // We save the latest cursor position here and return it when an input | 193 // We save the latest cursor position here and return it when an input |
| 181 // methods needs it. | 194 // methods needs it. |
| 182 NSRect im_caret_rect_; | 195 NSRect im_caret_rect_; |
| 183 | 196 |
| 197 // The Core Animation layer, if any, hosting the GPU plugins' output. |
| 198 scoped_nsobject<CALayer> gpu_plugin_layer_; |
| 199 |
| 184 private: | 200 private: |
| 185 // Updates the display cursor to the current cursor if the cursor is over this | 201 // Updates the display cursor to the current cursor if the cursor is over this |
| 186 // render view. | 202 // render view. |
| 187 void UpdateCursorIfOverSelf(); | 203 void UpdateCursorIfOverSelf(); |
| 188 | 204 |
| 189 // Shuts down the render_widget_host_. This is a separate function so we can | 205 // Shuts down the render_widget_host_. This is a separate function so we can |
| 190 // invoke it from the message loop. | 206 // invoke it from the message loop. |
| 191 void ShutdownHost(); | 207 void ShutdownHost(); |
| 192 | 208 |
| 193 // The associated view. This is weak and is inserted into the view hierarchy | 209 // The associated view. This is weak and is inserted into the view hierarchy |
| (...skipping 19 matching lines...) Expand all Loading... |
| 213 | 229 |
| 214 // The text to be shown in the tooltip, supplied by the renderer. | 230 // The text to be shown in the tooltip, supplied by the renderer. |
| 215 std::wstring tooltip_text_; | 231 std::wstring tooltip_text_; |
| 216 | 232 |
| 217 // Factory used to safely scope delayed calls to ShutdownHost(). | 233 // Factory used to safely scope delayed calls to ShutdownHost(). |
| 218 ScopedRunnableMethodFactory<RenderWidgetHostViewMac> shutdown_factory_; | 234 ScopedRunnableMethodFactory<RenderWidgetHostViewMac> shutdown_factory_; |
| 219 | 235 |
| 220 // Used for positioning a popup menu. | 236 // Used for positioning a popup menu. |
| 221 BaseView* parent_view_; | 237 BaseView* parent_view_; |
| 222 | 238 |
| 239 // Helper class for managing instances of the GPU plugin. |
| 240 MacGPUPluginContainerManager plugin_container_manager_; |
| 241 |
| 223 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewMac); | 242 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewMac); |
| 224 }; | 243 }; |
| 225 | 244 |
| 226 #endif // CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_ | 245 #endif // CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_ |
| OLD | NEW |