| 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 RenderWidgetHostViewMac; | 41 class RenderWidgetHostViewMac; |
| 41 class RenderWidgetHostViewMacEditCommandHelper; | 42 class RenderWidgetHostViewMacEditCommandHelper; |
| 42 class WebContents; | 43 class WebContents; |
| 43 } | 44 } |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 // "The lifetime of the RenderWidgetHost* is tied to the render process. | 201 // "The lifetime of the RenderWidgetHost* is tied to the render process. |
| 201 // If the render process dies, the RenderWidgetHost* goes away and all | 202 // If the render process dies, the RenderWidgetHost* goes away and all |
| 202 // references to it must become NULL." | 203 // references to it must become NULL." |
| 203 // | 204 // |
| 204 // RenderWidgetHostView class hierarchy described in render_widget_host_view.h. | 205 // RenderWidgetHostView class hierarchy described in render_widget_host_view.h. |
| 205 class CONTENT_EXPORT RenderWidgetHostViewMac | 206 class CONTENT_EXPORT RenderWidgetHostViewMac |
| 206 : public RenderWidgetHostViewBase, | 207 : public RenderWidgetHostViewBase, |
| 207 public DelegatedFrameHostClient, | 208 public DelegatedFrameHostClient, |
| 208 public BrowserCompositorViewMacClient, | 209 public BrowserCompositorViewMacClient, |
| 209 public IPC::Sender, | 210 public IPC::Sender, |
| 210 public gfx::DisplayObserver { | 211 public SoftwareFrameManagerClient, |
| 212 public CompositingIOSurfaceLayerClient, |
| 213 public gfx::DisplayObserver, |
| 214 public DisplayLinkMac::Observer, |
| 215 public ui::CompositorBeginFrameObserver { |
| 211 public: | 216 public: |
| 212 // The view will associate itself with the given widget. The native view must | 217 // The view will associate itself with the given widget. The native view must |
| 213 // be hooked up immediately to the view hierarchy, or else when it is | 218 // be hooked up immediately to the view hierarchy, or else when it is |
| 214 // deleted it will delete this out from under the caller. | 219 // deleted it will delete this out from under the caller. |
| 215 explicit RenderWidgetHostViewMac(RenderWidgetHost* widget); | 220 explicit RenderWidgetHostViewMac(RenderWidgetHost* widget); |
| 216 virtual ~RenderWidgetHostViewMac(); | 221 virtual ~RenderWidgetHostViewMac(); |
| 217 | 222 |
| 218 RenderWidgetHostViewCocoa* cocoa_view() const { return cocoa_view_; } | 223 RenderWidgetHostViewCocoa* cocoa_view() const { return cocoa_view_; } |
| 219 | 224 |
| 220 // |delegate| is used to separate out the logic from the NSResponder delegate. | 225 // |delegate| is used to separate out the logic from the NSResponder delegate. |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 virtual bool Send(IPC::Message* message) OVERRIDE; | 334 virtual bool Send(IPC::Message* message) OVERRIDE; |
| 330 | 335 |
| 331 virtual SkColorType PreferredReadbackFormat() OVERRIDE; | 336 virtual SkColorType PreferredReadbackFormat() OVERRIDE; |
| 332 | 337 |
| 333 // gfx::DisplayObserver implementation. | 338 // gfx::DisplayObserver implementation. |
| 334 virtual void OnDisplayAdded(const gfx::Display& new_display) OVERRIDE; | 339 virtual void OnDisplayAdded(const gfx::Display& new_display) OVERRIDE; |
| 335 virtual void OnDisplayRemoved(const gfx::Display& old_display) OVERRIDE; | 340 virtual void OnDisplayRemoved(const gfx::Display& old_display) OVERRIDE; |
| 336 virtual void OnDisplayMetricsChanged(const gfx::Display& display, | 341 virtual void OnDisplayMetricsChanged(const gfx::Display& display, |
| 337 uint32_t metrics) OVERRIDE; | 342 uint32_t metrics) OVERRIDE; |
| 338 | 343 |
| 344 // DisplayLinkMac::Observer implementation. |
| 345 virtual void OnVSync(base::TimeTicks timebase, |
| 346 base::TimeDelta interval) OVERRIDE; |
| 347 |
| 348 // ui::CompositorBeginFrameObserver implementation. |
| 349 virtual void OnSendBeginFrame(const cc::BeginFrameArgs& args) OVERRIDE; |
| 350 |
| 339 // Forwards the mouse event to the renderer. | 351 // Forwards the mouse event to the renderer. |
| 340 void ForwardMouseEvent(const blink::WebMouseEvent& event); | 352 void ForwardMouseEvent(const blink::WebMouseEvent& event); |
| 341 | 353 |
| 342 void KillSelf(); | 354 void KillSelf(); |
| 343 | 355 |
| 344 void SetTextInputActive(bool active); | 356 void SetTextInputActive(bool active); |
| 345 | 357 |
| 346 // Sends completed plugin IME notification and text back to the renderer. | 358 // Sends completed plugin IME notification and text back to the renderer. |
| 347 void PluginImeCompositionCompleted(const base::string16& text, int plugin_id); | 359 void PluginImeCompositionCompleted(const base::string16& text, int plugin_id); |
| 348 | 360 |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 void ShutdownBrowserCompositor(); | 470 void ShutdownBrowserCompositor(); |
| 459 | 471 |
| 460 void EnsureBrowserCompositorView(); | 472 void EnsureBrowserCompositorView(); |
| 461 void DestroyBrowserCompositorView(); | 473 void DestroyBrowserCompositorView(); |
| 462 | 474 |
| 463 // IPC message handlers. | 475 // IPC message handlers. |
| 464 void OnPluginFocusChanged(bool focused, int plugin_id); | 476 void OnPluginFocusChanged(bool focused, int plugin_id); |
| 465 void OnStartPluginIme(); | 477 void OnStartPluginIme(); |
| 466 void OnGetRenderedTextCompleted(const std::string& text); | 478 void OnGetRenderedTextCompleted(const std::string& text); |
| 467 | 479 |
| 468 // Send updated vsync parameters to the renderer. | 480 // Called when RenderWidget want to get BeginFrame message. |
| 469 void SendVSyncParametersToRenderer(); | 481 void OnSetNeedsBeginFrame(bool enabled); |
| 470 | 482 |
| 471 // Dispatches a TTS session. | 483 // Dispatches a TTS session. |
| 472 void SpeakText(const std::string& text); | 484 void SpeakText(const std::string& text); |
| 473 | 485 |
| 474 // The associated view. This is weak and is inserted into the view hierarchy | 486 // The associated view. This is weak and is inserted into the view hierarchy |
| 475 // to own this RenderWidgetHostViewMac object. Set to nil at the start of the | 487 // to own this RenderWidgetHostViewMac object. Set to nil at the start of the |
| 476 // destructor. | 488 // destructor. |
| 477 RenderWidgetHostViewCocoa* cocoa_view_; | 489 RenderWidgetHostViewCocoa* cocoa_view_; |
| 478 | 490 |
| 479 // Indicates if the page is loading. | 491 // Indicates if the page is loading. |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 511 base::TimeTicks vsync_timebase_; | 523 base::TimeTicks vsync_timebase_; |
| 512 base::TimeDelta vsync_interval_; | 524 base::TimeDelta vsync_interval_; |
| 513 | 525 |
| 514 // The current composition character range and its bounds. | 526 // The current composition character range and its bounds. |
| 515 gfx::Range composition_range_; | 527 gfx::Range composition_range_; |
| 516 std::vector<gfx::Rect> composition_bounds_; | 528 std::vector<gfx::Rect> composition_bounds_; |
| 517 | 529 |
| 518 // The current caret bounds. | 530 // The current caret bounds. |
| 519 gfx::Rect caret_rect_; | 531 gfx::Rect caret_rect_; |
| 520 | 532 |
| 533 // Subscriber that listens to frame presentation events. |
| 534 scoped_ptr<RenderWidgetHostViewFrameSubscriber> frame_subscriber_; |
| 535 |
| 536 // True when corresponding RenderWidget needs BeginFrame. |
| 537 bool needs_begin_frame_; |
| 538 |
| 539 // Pass |last_begin_frame_args_| to BeginFrameManager when |this| is added |
| 540 // as its observer. With this, BeginFrameManager can determine whether latest |
| 541 // BeginFrameArgs is used immediately or not. |
| 542 cc::BeginFrameArgs last_begin_frame_args_; |
| 543 |
| 544 base::WeakPtrFactory<RenderWidgetHostViewMac> |
| 545 software_frame_weak_ptr_factory_; |
| 521 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewMac); | 546 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewMac); |
| 522 }; | 547 }; |
| 523 | 548 |
| 524 } // namespace content | 549 } // namespace content |
| 525 | 550 |
| 526 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_ | 551 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_ |
| OLD | NEW |