Chromium Code Reviews| 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 13 matching lines...) Expand all Loading... | |
| 24 #include "content/browser/renderer_host/render_widget_host_view_base.h" | 24 #include "content/browser/renderer_host/render_widget_host_view_base.h" |
| 25 #include "content/browser/renderer_host/software_frame_manager.h" | 25 #include "content/browser/renderer_host/software_frame_manager.h" |
| 26 #include "content/common/content_export.h" | 26 #include "content/common/content_export.h" |
| 27 #include "content/common/cursors/webcursor.h" | 27 #include "content/common/cursors/webcursor.h" |
| 28 #include "content/common/edit_command.h" | 28 #include "content/common/edit_command.h" |
| 29 #import "content/public/browser/render_widget_host_view_mac_base.h" | 29 #import "content/public/browser/render_widget_host_view_mac_base.h" |
| 30 #include "ipc/ipc_sender.h" | 30 #include "ipc/ipc_sender.h" |
| 31 #include "third_party/WebKit/public/web/WebCompositionUnderline.h" | 31 #include "third_party/WebKit/public/web/WebCompositionUnderline.h" |
| 32 #include "ui/base/cocoa/base_view.h" | 32 #include "ui/base/cocoa/base_view.h" |
| 33 #include "ui/base/cocoa/remote_layer_api.h" | 33 #include "ui/base/cocoa/remote_layer_api.h" |
| 34 #include "ui/base/compositor/compositor_begin_frame_observer.h" | |
| 34 #include "ui/gfx/display_observer.h" | 35 #include "ui/gfx/display_observer.h" |
| 35 | 36 |
| 36 struct ViewHostMsg_TextInputState_Params; | 37 struct ViewHostMsg_TextInputState_Params; |
| 37 | 38 |
| 38 namespace content { | 39 namespace content { |
| 39 class BrowserCompositorviewMac; | 40 class BrowserCompositorviewMac; |
| 40 class CompositingIOSurfaceMac; | 41 class CompositingIOSurfaceMac; |
| 41 class CompositingIOSurfaceContext; | 42 class CompositingIOSurfaceContext; |
| 42 class RenderWidgetHostViewMac; | 43 class RenderWidgetHostViewMac; |
| 43 class RenderWidgetHostViewMacEditCommandHelper; | 44 class RenderWidgetHostViewMacEditCommandHelper; |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 214 // references to it must become NULL." | 215 // references to it must become NULL." |
| 215 // | 216 // |
| 216 // RenderWidgetHostView class hierarchy described in render_widget_host_view.h. | 217 // RenderWidgetHostView class hierarchy described in render_widget_host_view.h. |
| 217 class CONTENT_EXPORT RenderWidgetHostViewMac | 218 class CONTENT_EXPORT RenderWidgetHostViewMac |
| 218 : public RenderWidgetHostViewBase, | 219 : public RenderWidgetHostViewBase, |
| 219 public DelegatedFrameHostClient, | 220 public DelegatedFrameHostClient, |
| 220 public BrowserCompositorViewMacClient, | 221 public BrowserCompositorViewMacClient, |
| 221 public IPC::Sender, | 222 public IPC::Sender, |
| 222 public SoftwareFrameManagerClient, | 223 public SoftwareFrameManagerClient, |
| 223 public CompositingIOSurfaceLayerClient, | 224 public CompositingIOSurfaceLayerClient, |
| 224 public gfx::DisplayObserver { | 225 public gfx::DisplayObserver, |
| 226 public DisplayLinkMac::Observer, | |
| 227 public ui::CompositorBeginFrameObserver { | |
| 225 public: | 228 public: |
| 226 // The view will associate itself with the given widget. The native view must | 229 // The view will associate itself with the given widget. The native view must |
| 227 // be hooked up immediately to the view hierarchy, or else when it is | 230 // be hooked up immediately to the view hierarchy, or else when it is |
| 228 // deleted it will delete this out from under the caller. | 231 // deleted it will delete this out from under the caller. |
| 229 explicit RenderWidgetHostViewMac(RenderWidgetHost* widget); | 232 explicit RenderWidgetHostViewMac(RenderWidgetHost* widget); |
| 230 virtual ~RenderWidgetHostViewMac(); | 233 virtual ~RenderWidgetHostViewMac(); |
| 231 | 234 |
| 232 RenderWidgetHostViewCocoa* cocoa_view() const { return cocoa_view_; } | 235 RenderWidgetHostViewCocoa* cocoa_view() const { return cocoa_view_; } |
| 233 | 236 |
| 234 // |delegate| is used to separate out the logic from the NSResponder delegate. | 237 // |delegate| is used to separate out the logic from the NSResponder delegate. |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 352 // CompositingIOSurfaceLayerClient implementation. | 355 // CompositingIOSurfaceLayerClient implementation. |
| 353 virtual bool AcceleratedLayerShouldAckImmediately() const OVERRIDE; | 356 virtual bool AcceleratedLayerShouldAckImmediately() const OVERRIDE; |
| 354 virtual void AcceleratedLayerDidDrawFrame(bool succeeded) OVERRIDE; | 357 virtual void AcceleratedLayerDidDrawFrame(bool succeeded) OVERRIDE; |
| 355 | 358 |
| 356 // gfx::DisplayObserver implementation. | 359 // gfx::DisplayObserver implementation. |
| 357 virtual void OnDisplayAdded(const gfx::Display& new_display) OVERRIDE; | 360 virtual void OnDisplayAdded(const gfx::Display& new_display) OVERRIDE; |
| 358 virtual void OnDisplayRemoved(const gfx::Display& old_display) OVERRIDE; | 361 virtual void OnDisplayRemoved(const gfx::Display& old_display) OVERRIDE; |
| 359 virtual void OnDisplayMetricsChanged(const gfx::Display& display, | 362 virtual void OnDisplayMetricsChanged(const gfx::Display& display, |
| 360 uint32_t metrics) OVERRIDE; | 363 uint32_t metrics) OVERRIDE; |
| 361 | 364 |
| 365 // DisplayLinkMac::Observer implementation. | |
| 366 virtual void OnVSync(base::TimeTicks timebase, | |
| 367 base::TimeDelta interval) OVERRIDE; | |
| 368 | |
| 369 // ui::CompositorBeginFrameObserver implementation. | |
| 370 virtual void OnSendBeginFrame(const cc::BeginFrameArgs& args) OVERRIDE; | |
| 371 | |
| 362 // Forwards the mouse event to the renderer. | 372 // Forwards the mouse event to the renderer. |
| 363 void ForwardMouseEvent(const blink::WebMouseEvent& event); | 373 void ForwardMouseEvent(const blink::WebMouseEvent& event); |
| 364 | 374 |
| 365 void KillSelf(); | 375 void KillSelf(); |
| 366 | 376 |
| 367 void SetTextInputActive(bool active); | 377 void SetTextInputActive(bool active); |
| 368 | 378 |
| 369 // Sends completed plugin IME notification and text back to the renderer. | 379 // Sends completed plugin IME notification and text back to the renderer. |
| 370 void PluginImeCompositionCompleted(const base::string16& text, int plugin_id); | 380 void PluginImeCompositionCompleted(const base::string16& text, int plugin_id); |
| 371 | 381 |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 575 void GotSoftwareFrame(); | 585 void GotSoftwareFrame(); |
| 576 | 586 |
| 577 // IPC message handlers. | 587 // IPC message handlers. |
| 578 void OnPluginFocusChanged(bool focused, int plugin_id); | 588 void OnPluginFocusChanged(bool focused, int plugin_id); |
| 579 void OnStartPluginIme(); | 589 void OnStartPluginIme(); |
| 580 | 590 |
| 581 // Convert |rect| from the views coordinate (upper-left origin) into | 591 // Convert |rect| from the views coordinate (upper-left origin) into |
| 582 // the OpenGL coordinate (lower-left origin) and scale for HiDPI displays. | 592 // the OpenGL coordinate (lower-left origin) and scale for HiDPI displays. |
| 583 gfx::Rect GetScaledOpenGLPixelRect(const gfx::Rect& rect); | 593 gfx::Rect GetScaledOpenGLPixelRect(const gfx::Rect& rect); |
| 584 | 594 |
| 585 // Send updated vsync parameters to the renderer. | 595 // Called when RenderWidget want to get BeginFrame message. |
| 586 void SendVSyncParametersToRenderer(); | 596 void OnSetNeedsBeginFrame(bool enabled); |
|
brianderson
2014/09/04 18:45:46
Should this be grouped with OnSendBeginFrame?
| |
| 587 | 597 |
| 588 // The associated view. This is weak and is inserted into the view hierarchy | 598 // The associated view. This is weak and is inserted into the view hierarchy |
| 589 // to own this RenderWidgetHostViewMac object. Set to nil at the start of the | 599 // to own this RenderWidgetHostViewMac object. Set to nil at the start of the |
| 590 // destructor. | 600 // destructor. |
| 591 RenderWidgetHostViewCocoa* cocoa_view_; | 601 RenderWidgetHostViewCocoa* cocoa_view_; |
| 592 | 602 |
| 593 // Indicates if the page is loading. | 603 // Indicates if the page is loading. |
| 594 bool is_loading_; | 604 bool is_loading_; |
| 595 | 605 |
| 596 // Whether it's allowed to pause waiting for a new frame. | 606 // Whether it's allowed to pause waiting for a new frame. |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 625 // The current composition character range and its bounds. | 635 // The current composition character range and its bounds. |
| 626 gfx::Range composition_range_; | 636 gfx::Range composition_range_; |
| 627 std::vector<gfx::Rect> composition_bounds_; | 637 std::vector<gfx::Rect> composition_bounds_; |
| 628 | 638 |
| 629 // The current caret bounds. | 639 // The current caret bounds. |
| 630 gfx::Rect caret_rect_; | 640 gfx::Rect caret_rect_; |
| 631 | 641 |
| 632 // Subscriber that listens to frame presentation events. | 642 // Subscriber that listens to frame presentation events. |
| 633 scoped_ptr<RenderWidgetHostViewFrameSubscriber> frame_subscriber_; | 643 scoped_ptr<RenderWidgetHostViewFrameSubscriber> frame_subscriber_; |
| 634 | 644 |
| 645 // True when corresponding RenderWidget needs BeginFrame. | |
| 646 bool needs_begin_frame_; | |
| 647 | |
| 648 // Pass |last_begin_frame_args_| to BeginFrameManager when |this| is added | |
| 649 // as its observer. With this, BeginFrameManager can determine whether latest | |
| 650 // BeginFrameArgs is used immediately or not. | |
| 651 cc::BeginFrameArgs last_begin_frame_args_; | |
| 652 | |
| 635 base::WeakPtrFactory<RenderWidgetHostViewMac> | 653 base::WeakPtrFactory<RenderWidgetHostViewMac> |
| 636 software_frame_weak_ptr_factory_; | 654 software_frame_weak_ptr_factory_; |
| 637 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewMac); | 655 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewMac); |
| 638 }; | 656 }; |
| 639 | 657 |
| 640 } // namespace content | 658 } // namespace content |
| 641 | 659 |
| 642 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_ | 660 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_ |
| OLD | NEW |