| 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 | 7 |
| 8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
| 9 #include <IOSurface/IOSurfaceAPI.h> | 9 #include <IOSurface/IOSurfaceAPI.h> |
| 10 #include <list> | 10 #include <list> |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 virtual ~RenderWidgetHostViewMac(); | 228 virtual ~RenderWidgetHostViewMac(); |
| 229 | 229 |
| 230 RenderWidgetHostViewCocoa* cocoa_view() const { return cocoa_view_; } | 230 RenderWidgetHostViewCocoa* cocoa_view() const { return cocoa_view_; } |
| 231 | 231 |
| 232 // |delegate| is used to separate out the logic from the NSResponder delegate. | 232 // |delegate| is used to separate out the logic from the NSResponder delegate. |
| 233 // |delegate| is retained by this class. | 233 // |delegate| is retained by this class. |
| 234 // |delegate| should be set at most once. | 234 // |delegate| should be set at most once. |
| 235 CONTENT_EXPORT void SetDelegate( | 235 CONTENT_EXPORT void SetDelegate( |
| 236 NSObject<RenderWidgetHostViewMacDelegate>* delegate); | 236 NSObject<RenderWidgetHostViewMacDelegate>* delegate); |
| 237 void SetAllowOverlappingViews(bool overlapping); | 237 void SetAllowOverlappingViews(bool overlapping); |
| 238 void SetAllowPauseForResizeOrRepaint(bool allow); |
| 238 | 239 |
| 239 // RenderWidgetHostView implementation. | 240 // RenderWidgetHostView implementation. |
| 240 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; | 241 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; |
| 241 virtual void InitAsChild(gfx::NativeView parent_view) OVERRIDE; | 242 virtual void InitAsChild(gfx::NativeView parent_view) OVERRIDE; |
| 242 virtual RenderWidgetHost* GetRenderWidgetHost() const OVERRIDE; | 243 virtual RenderWidgetHost* GetRenderWidgetHost() const OVERRIDE; |
| 243 virtual void SetSize(const gfx::Size& size) OVERRIDE; | 244 virtual void SetSize(const gfx::Size& size) OVERRIDE; |
| 244 virtual void SetBounds(const gfx::Rect& rect) OVERRIDE; | 245 virtual void SetBounds(const gfx::Rect& rect) OVERRIDE; |
| 245 virtual gfx::NativeView GetNativeView() const OVERRIDE; | 246 virtual gfx::NativeView GetNativeView() const OVERRIDE; |
| 246 virtual gfx::NativeViewId GetNativeViewId() const OVERRIDE; | 247 virtual gfx::NativeViewId GetNativeViewId() const OVERRIDE; |
| 247 virtual gfx::NativeViewAccessible GetNativeViewAccessible() OVERRIDE; | 248 virtual gfx::NativeViewAccessible GetNativeViewAccessible() OVERRIDE; |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 // |cocoa_view_|. | 366 // |cocoa_view_|. |
| 366 void CompositorSwapBuffers(IOSurfaceID surface_handle, | 367 void CompositorSwapBuffers(IOSurfaceID surface_handle, |
| 367 const gfx::Size& size, | 368 const gfx::Size& size, |
| 368 float scale_factor, | 369 float scale_factor, |
| 369 const std::vector<ui::LatencyInfo>& latency_info); | 370 const std::vector<ui::LatencyInfo>& latency_info); |
| 370 | 371 |
| 371 // Called when a GPU error is detected. Posts a task to destroy all | 372 // Called when a GPU error is detected. Posts a task to destroy all |
| 372 // compositing state. | 373 // compositing state. |
| 373 void GotAcceleratedCompositingError(); | 374 void GotAcceleratedCompositingError(); |
| 374 | 375 |
| 375 // Sets the overlay view, which should be drawn in the same IOSurface | |
| 376 // atop of this view, if both views are drawing accelerated content. | |
| 377 // Overlay is stored as a weak ptr. | |
| 378 void SetOverlayView(RenderWidgetHostViewMac* overlay, | |
| 379 const gfx::Point& offset); | |
| 380 | |
| 381 // Removes the previously set overlay view. | |
| 382 void RemoveOverlayView(); | |
| 383 | |
| 384 // Returns true and stores first rectangle for character range if the | 376 // Returns true and stores first rectangle for character range if the |
| 385 // requested |range| is already cached, otherwise returns false. | 377 // requested |range| is already cached, otherwise returns false. |
| 386 // Exposed for testing. | 378 // Exposed for testing. |
| 387 CONTENT_EXPORT bool GetCachedFirstRectForCharacterRange( | 379 CONTENT_EXPORT bool GetCachedFirstRectForCharacterRange( |
| 388 NSRange range, NSRect* rect, NSRange* actual_range); | 380 NSRange range, NSRect* rect, NSRange* actual_range); |
| 389 | 381 |
| 390 // Returns true if there is line break in |range| and stores line breaking | 382 // Returns true if there is line break in |range| and stores line breaking |
| 391 // point to |line_breaking_point|. The |line_break_point| is valid only if | 383 // point to |line_breaking_point|. The |line_break_point| is valid only if |
| 392 // this function returns true. | 384 // this function returns true. |
| 393 bool GetLineBreakIndex(const std::vector<gfx::Rect>& bounds, | 385 bool GetLineBreakIndex(const std::vector<gfx::Rect>& bounds, |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 586 // destructor. | 578 // destructor. |
| 587 RenderWidgetHostViewCocoa* cocoa_view_; | 579 RenderWidgetHostViewCocoa* cocoa_view_; |
| 588 | 580 |
| 589 // Indicates if the page is loading. | 581 // Indicates if the page is loading. |
| 590 bool is_loading_; | 582 bool is_loading_; |
| 591 | 583 |
| 592 // Indicates if the view is currently stalled waiting for a new frame to come | 584 // Indicates if the view is currently stalled waiting for a new frame to come |
| 593 // in. | 585 // in. |
| 594 bool is_paused_for_resize_or_repaint_; | 586 bool is_paused_for_resize_or_repaint_; |
| 595 | 587 |
| 588 // Whether it's allowed to pause waiting for a new frame. |
| 589 bool allow_pause_for_resize_or_repaint_; |
| 590 |
| 596 // The text to be shown in the tooltip, supplied by the renderer. | 591 // The text to be shown in the tooltip, supplied by the renderer. |
| 597 base::string16 tooltip_text_; | 592 base::string16 tooltip_text_; |
| 598 | 593 |
| 599 // Factory used to safely scope delayed calls to ShutdownHost(). | 594 // Factory used to safely scope delayed calls to ShutdownHost(). |
| 600 base::WeakPtrFactory<RenderWidgetHostViewMac> weak_factory_; | 595 base::WeakPtrFactory<RenderWidgetHostViewMac> weak_factory_; |
| 601 | 596 |
| 602 // selected text on the renderer. | 597 // selected text on the renderer. |
| 603 std::string selected_text_; | 598 std::string selected_text_; |
| 604 | 599 |
| 605 // The window used for popup widgets. | 600 // The window used for popup widgets. |
| 606 base::scoped_nsobject<NSWindow> popup_window_; | 601 base::scoped_nsobject<NSWindow> popup_window_; |
| 607 | 602 |
| 608 // The fullscreen window used for pepper flash. | 603 // The fullscreen window used for pepper flash. |
| 609 base::scoped_nsobject<NSWindow> pepper_fullscreen_window_; | 604 base::scoped_nsobject<NSWindow> pepper_fullscreen_window_; |
| 610 base::scoped_nsobject<FullscreenWindowManager> fullscreen_window_manager_; | 605 base::scoped_nsobject<FullscreenWindowManager> fullscreen_window_manager_; |
| 611 // Our parent host view, if this is fullscreen. NULL otherwise. | 606 // Our parent host view, if this is fullscreen. NULL otherwise. |
| 612 RenderWidgetHostViewMac* fullscreen_parent_host_view_; | 607 RenderWidgetHostViewMac* fullscreen_parent_host_view_; |
| 613 | 608 |
| 614 // The overlay view which is rendered above this one in the same | |
| 615 // accelerated IOSurface. | |
| 616 // Overlay view has |underlay_view_| set to this view. | |
| 617 base::WeakPtr<RenderWidgetHostViewMac> overlay_view_; | |
| 618 | |
| 619 // The underlay view which this view is rendered above in the same | |
| 620 // accelerated IOSurface. | |
| 621 // Underlay view has |overlay_view_| set to this view. | |
| 622 base::WeakPtr<RenderWidgetHostViewMac> underlay_view_; | |
| 623 | |
| 624 // Factory used to safely reference overlay view set in SetOverlayView. | |
| 625 base::WeakPtrFactory<RenderWidgetHostViewMac> | |
| 626 overlay_view_weak_factory_; | |
| 627 | |
| 628 // Display link for getting vsync info. | 609 // Display link for getting vsync info. |
| 629 scoped_refptr<DisplayLinkMac> display_link_; | 610 scoped_refptr<DisplayLinkMac> display_link_; |
| 630 | 611 |
| 631 // The current composition character range and its bounds. | 612 // The current composition character range and its bounds. |
| 632 gfx::Range composition_range_; | 613 gfx::Range composition_range_; |
| 633 std::vector<gfx::Rect> composition_bounds_; | 614 std::vector<gfx::Rect> composition_bounds_; |
| 634 | 615 |
| 635 // The current caret bounds. | 616 // The current caret bounds. |
| 636 gfx::Rect caret_rect_; | 617 gfx::Rect caret_rect_; |
| 637 | 618 |
| 638 // Subscriber that listens to frame presentation events. | 619 // Subscriber that listens to frame presentation events. |
| 639 scoped_ptr<RenderWidgetHostViewFrameSubscriber> frame_subscriber_; | 620 scoped_ptr<RenderWidgetHostViewFrameSubscriber> frame_subscriber_; |
| 640 | 621 |
| 641 base::WeakPtrFactory<RenderWidgetHostViewMac> | 622 base::WeakPtrFactory<RenderWidgetHostViewMac> |
| 642 software_frame_weak_ptr_factory_; | 623 software_frame_weak_ptr_factory_; |
| 643 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewMac); | 624 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewMac); |
| 644 }; | 625 }; |
| 645 | 626 |
| 646 } // namespace content | 627 } // namespace content |
| 647 | 628 |
| 648 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_ | 629 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_ |
| OLD | NEW |