| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #import <Cocoa/Cocoa.h> | 9 #import <Cocoa/Cocoa.h> |
| 10 | 10 |
| 11 #include "base/memory/scoped_nsobject.h" | 11 #include "base/memory/scoped_nsobject.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "base/time.h" | 14 #include "base/time.h" |
| 15 #include "content/browser/accessibility/browser_accessibility_delegate_mac.h" | 15 #include "content/browser/accessibility/browser_accessibility_delegate_mac.h" |
| 16 #include "content/browser/renderer_host/accelerated_surface_container_manager_ma
c.h" | 16 #include "content/browser/renderer_host/accelerated_surface_container_manager_ma
c.h" |
| 17 #include "content/browser/renderer_host/render_widget_host_view_base.h" | 17 #include "content/browser/renderer_host/render_widget_host_view_base.h" |
| 18 #include "content/common/edit_command.h" | 18 #include "content/common/edit_command.h" |
| 19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositionUnderli
ne.h" | 19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositionUnderli
ne.h" |
| 20 #include "ui/base/cocoa/base_view.h" | 20 #include "ui/base/cocoa/base_view.h" |
| 21 #include "webkit/glue/webcursor.h" | 21 #include "webkit/glue/webcursor.h" |
| 22 | 22 |
| 23 @class AcceleratedPluginView; | 23 @class AcceleratedPluginView; |
| 24 class RenderWidgetHostImpl; | |
| 25 class RenderWidgetHostViewMac; | 24 class RenderWidgetHostViewMac; |
| 26 @protocol RenderWidgetHostViewMacDelegate; | 25 @protocol RenderWidgetHostViewMacDelegate; |
| 27 class RenderWidgetHostViewMacEditCommandHelper; | 26 class RenderWidgetHostViewMacEditCommandHelper; |
| 28 @class ToolTip; | 27 @class ToolTip; |
| 29 | 28 |
| 29 namespace content { |
| 30 class RenderWidgetHostImpl; |
| 31 } |
| 32 |
| 30 @protocol RenderWidgetHostViewMacOwner | 33 @protocol RenderWidgetHostViewMacOwner |
| 31 - (RenderWidgetHostViewMac*)renderWidgetHostViewMac; | 34 - (RenderWidgetHostViewMac*)renderWidgetHostViewMac; |
| 32 @end | 35 @end |
| 33 | 36 |
| 34 // This is the view that lives in the Cocoa view hierarchy. In Windows-land, | 37 // This is the view that lives in the Cocoa view hierarchy. In Windows-land, |
| 35 // RenderWidgetHostViewWin is both the view and the delegate. We split the roles | 38 // RenderWidgetHostViewWin is both the view and the delegate. We split the roles |
| 36 // but that means that the view needs to own the delegate and will dispose of it | 39 // but that means that the view needs to own the delegate and will dispose of it |
| 37 // when it's removed from the view system. | 40 // when it's removed from the view system. |
| 38 @interface RenderWidgetHostViewCocoa | 41 @interface RenderWidgetHostViewCocoa |
| 39 : BaseView <RenderWidgetHostViewMacOwner, | 42 : BaseView <RenderWidgetHostViewMacOwner, |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 class RenderWidgetHostViewMac : public content::RenderWidgetHostViewBase { | 165 class RenderWidgetHostViewMac : public content::RenderWidgetHostViewBase { |
| 163 public: | 166 public: |
| 164 virtual ~RenderWidgetHostViewMac(); | 167 virtual ~RenderWidgetHostViewMac(); |
| 165 | 168 |
| 166 RenderWidgetHostViewCocoa* cocoa_view() const { return cocoa_view_; } | 169 RenderWidgetHostViewCocoa* cocoa_view() const { return cocoa_view_; } |
| 167 | 170 |
| 168 void SetDelegate(NSObject<RenderWidgetHostViewMacDelegate>* delegate); | 171 void SetDelegate(NSObject<RenderWidgetHostViewMacDelegate>* delegate); |
| 169 | 172 |
| 170 // RenderWidgetHostView implementation. | 173 // RenderWidgetHostView implementation. |
| 171 virtual void InitAsChild(gfx::NativeView parent_view) OVERRIDE; | 174 virtual void InitAsChild(gfx::NativeView parent_view) OVERRIDE; |
| 172 virtual RenderWidgetHost* GetRenderWidgetHost() const OVERRIDE; | 175 virtual content::RenderWidgetHost* GetRenderWidgetHost() const OVERRIDE; |
| 173 virtual void SetSize(const gfx::Size& size) OVERRIDE; | 176 virtual void SetSize(const gfx::Size& size) OVERRIDE; |
| 174 virtual void SetBounds(const gfx::Rect& rect) OVERRIDE; | 177 virtual void SetBounds(const gfx::Rect& rect) OVERRIDE; |
| 175 virtual gfx::NativeView GetNativeView() const OVERRIDE; | 178 virtual gfx::NativeView GetNativeView() const OVERRIDE; |
| 176 virtual gfx::NativeViewId GetNativeViewId() const OVERRIDE; | 179 virtual gfx::NativeViewId GetNativeViewId() const OVERRIDE; |
| 177 virtual gfx::NativeViewAccessible GetNativeViewAccessible() OVERRIDE; | 180 virtual gfx::NativeViewAccessible GetNativeViewAccessible() OVERRIDE; |
| 178 virtual bool HasFocus() const OVERRIDE; | 181 virtual bool HasFocus() const OVERRIDE; |
| 179 virtual void Show() OVERRIDE; | 182 virtual void Show() OVERRIDE; |
| 180 virtual void Hide() OVERRIDE; | 183 virtual void Hide() OVERRIDE; |
| 181 virtual bool IsShowing() OVERRIDE; | 184 virtual bool IsShowing() OVERRIDE; |
| 182 virtual gfx::Rect GetViewBounds() const OVERRIDE; | 185 virtual gfx::Rect GetViewBounds() const OVERRIDE; |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 // hidden until the software backing store has been updated. This method | 306 // hidden until the software backing store has been updated. This method |
| 304 // checks if the GPU view needs to be hidden and hides it if necessary. It | 307 // checks if the GPU view needs to be hidden and hides it if necessary. It |
| 305 // should be called after the software backing store has been painted to. | 308 // should be called after the software backing store has been painted to. |
| 306 void HandleDelayedGpuViewHiding(); | 309 void HandleDelayedGpuViewHiding(); |
| 307 | 310 |
| 308 // These member variables should be private, but the associated ObjC class | 311 // These member variables should be private, but the associated ObjC class |
| 309 // needs access to them and can't be made a friend. | 312 // needs access to them and can't be made a friend. |
| 310 | 313 |
| 311 // The associated Model. Can be NULL if Destroy() is called when | 314 // The associated Model. Can be NULL if Destroy() is called when |
| 312 // someone (other than superview) has retained |cocoa_view_|. | 315 // someone (other than superview) has retained |cocoa_view_|. |
| 313 RenderWidgetHostImpl* render_widget_host_; | 316 content::RenderWidgetHostImpl* render_widget_host_; |
| 314 | 317 |
| 315 // This is true when we are currently painting and thus should handle extra | 318 // This is true when we are currently painting and thus should handle extra |
| 316 // paint requests by expanding the invalid rect rather than actually painting. | 319 // paint requests by expanding the invalid rect rather than actually painting. |
| 317 bool about_to_validate_and_paint_; | 320 bool about_to_validate_and_paint_; |
| 318 | 321 |
| 319 // This is true when we have already scheduled a call to | 322 // This is true when we have already scheduled a call to |
| 320 // |-callSetNeedsDisplayInRect:| but it has not been fulfilled yet. Used to | 323 // |-callSetNeedsDisplayInRect:| but it has not been fulfilled yet. Used to |
| 321 // prevent us from scheduling multiple calls. | 324 // prevent us from scheduling multiple calls. |
| 322 bool call_set_needs_display_in_rect_pending_; | 325 bool call_set_needs_display_in_rect_pending_; |
| 323 | 326 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 347 | 350 |
| 348 // Helper class for managing instances of accelerated plug-ins. | 351 // Helper class for managing instances of accelerated plug-ins. |
| 349 AcceleratedSurfaceContainerManagerMac plugin_container_manager_; | 352 AcceleratedSurfaceContainerManagerMac plugin_container_manager_; |
| 350 | 353 |
| 351 private: | 354 private: |
| 352 friend class content::RenderWidgetHostView; | 355 friend class content::RenderWidgetHostView; |
| 353 | 356 |
| 354 // The view will associate itself with the given widget. The native view must | 357 // The view will associate itself with the given widget. The native view must |
| 355 // be hooked up immediately to the view hierarchy, or else when it is | 358 // be hooked up immediately to the view hierarchy, or else when it is |
| 356 // deleted it will delete this out from under the caller. | 359 // deleted it will delete this out from under the caller. |
| 357 explicit RenderWidgetHostViewMac(RenderWidgetHost* widget); | 360 explicit RenderWidgetHostViewMac(content::RenderWidgetHost* widget); |
| 358 | 361 |
| 359 // If the window is at the root of the plugin container hierachy, | 362 // If the window is at the root of the plugin container hierachy, |
| 360 // we need to update the geometry manually. | 363 // we need to update the geometry manually. |
| 361 void UpdatePluginGeometry(gfx::PluginWindowHandle window, | 364 void UpdatePluginGeometry(gfx::PluginWindowHandle window, |
| 362 int32 width, | 365 int32 width, |
| 363 int32 height); | 366 int32 height); |
| 364 | 367 |
| 365 // Returns whether this render view is a popup (autocomplete window). | 368 // Returns whether this render view is a popup (autocomplete window). |
| 366 bool IsPopup() const; | 369 bool IsPopup() const; |
| 367 | 370 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 // hidden until the software backing store has been updated. This variable is | 403 // hidden until the software backing store has been updated. This variable is |
| 401 // set when the gpu widget needs to be hidden once a paint is completed. | 404 // set when the gpu widget needs to be hidden once a paint is completed. |
| 402 bool needs_gpu_visibility_update_after_repaint_; | 405 bool needs_gpu_visibility_update_after_repaint_; |
| 403 | 406 |
| 404 gfx::PluginWindowHandle compositing_surface_; | 407 gfx::PluginWindowHandle compositing_surface_; |
| 405 | 408 |
| 406 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewMac); | 409 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewMac); |
| 407 }; | 410 }; |
| 408 | 411 |
| 409 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_ | 412 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_ |
| OLD | NEW |