Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(522)

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_mac.h

Issue 388803003: [Mac] Replace SetOverlayView with AllowOtherViews. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased, fixed comments Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
576 void SendVSyncParametersToRenderer(); 568 void SendVSyncParametersToRenderer();
577 569
578 // The associated view. This is weak and is inserted into the view hierarchy 570 // The associated view. This is weak and is inserted into the view hierarchy
579 // to own this RenderWidgetHostViewMac object. Set to nil at the start of the 571 // to own this RenderWidgetHostViewMac object. Set to nil at the start of the
580 // destructor. 572 // destructor.
581 RenderWidgetHostViewCocoa* cocoa_view_; 573 RenderWidgetHostViewCocoa* cocoa_view_;
582 574
583 // Indicates if the page is loading. 575 // Indicates if the page is loading.
584 bool is_loading_; 576 bool is_loading_;
585 577
578 // Whether it's allowed to pause waiting for a new frame.
579 bool allow_pause_for_resize_or_repaint_;
580
586 // The text to be shown in the tooltip, supplied by the renderer. 581 // The text to be shown in the tooltip, supplied by the renderer.
587 base::string16 tooltip_text_; 582 base::string16 tooltip_text_;
588 583
589 // Factory used to safely scope delayed calls to ShutdownHost(). 584 // Factory used to safely scope delayed calls to ShutdownHost().
590 base::WeakPtrFactory<RenderWidgetHostViewMac> weak_factory_; 585 base::WeakPtrFactory<RenderWidgetHostViewMac> weak_factory_;
591 586
592 // selected text on the renderer. 587 // selected text on the renderer.
593 std::string selected_text_; 588 std::string selected_text_;
594 589
595 // The window used for popup widgets. 590 // The window used for popup widgets.
596 base::scoped_nsobject<NSWindow> popup_window_; 591 base::scoped_nsobject<NSWindow> popup_window_;
597 592
598 // The fullscreen window used for pepper flash. 593 // The fullscreen window used for pepper flash.
599 base::scoped_nsobject<NSWindow> pepper_fullscreen_window_; 594 base::scoped_nsobject<NSWindow> pepper_fullscreen_window_;
600 base::scoped_nsobject<FullscreenWindowManager> fullscreen_window_manager_; 595 base::scoped_nsobject<FullscreenWindowManager> fullscreen_window_manager_;
601 // Our parent host view, if this is fullscreen. NULL otherwise. 596 // Our parent host view, if this is fullscreen. NULL otherwise.
602 RenderWidgetHostViewMac* fullscreen_parent_host_view_; 597 RenderWidgetHostViewMac* fullscreen_parent_host_view_;
603 598
604 // The overlay view which is rendered above this one in the same
605 // accelerated IOSurface.
606 // Overlay view has |underlay_view_| set to this view.
607 base::WeakPtr<RenderWidgetHostViewMac> overlay_view_;
608
609 // The underlay view which this view is rendered above in the same
610 // accelerated IOSurface.
611 // Underlay view has |overlay_view_| set to this view.
612 base::WeakPtr<RenderWidgetHostViewMac> underlay_view_;
613
614 // Factory used to safely reference overlay view set in SetOverlayView.
615 base::WeakPtrFactory<RenderWidgetHostViewMac>
616 overlay_view_weak_factory_;
617
618 // Display link for getting vsync info. 599 // Display link for getting vsync info.
619 scoped_refptr<DisplayLinkMac> display_link_; 600 scoped_refptr<DisplayLinkMac> display_link_;
620 601
621 // The current composition character range and its bounds. 602 // The current composition character range and its bounds.
622 gfx::Range composition_range_; 603 gfx::Range composition_range_;
623 std::vector<gfx::Rect> composition_bounds_; 604 std::vector<gfx::Rect> composition_bounds_;
624 605
625 // The current caret bounds. 606 // The current caret bounds.
626 gfx::Rect caret_rect_; 607 gfx::Rect caret_rect_;
627 608
628 // Subscriber that listens to frame presentation events. 609 // Subscriber that listens to frame presentation events.
629 scoped_ptr<RenderWidgetHostViewFrameSubscriber> frame_subscriber_; 610 scoped_ptr<RenderWidgetHostViewFrameSubscriber> frame_subscriber_;
630 611
631 base::WeakPtrFactory<RenderWidgetHostViewMac> 612 base::WeakPtrFactory<RenderWidgetHostViewMac>
632 software_frame_weak_ptr_factory_; 613 software_frame_weak_ptr_factory_;
633 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewMac); 614 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewMac);
634 }; 615 };
635 616
636 } // namespace content 617 } // namespace content
637 618
638 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_ 619 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698