Home | History | Annotate | Download | only in renderer_host
      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
      3 // found in the LICENSE file.
      4 
      5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_
      6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_
      7 
      8 #import <Cocoa/Cocoa.h>
      9 #include <list>
     10 #include <map>
     11 #include <string>
     12 #include <utility>
     13 #include <vector>
     14 
     15 #include "base/mac/scoped_nsobject.h"
     16 #include "base/memory/scoped_ptr.h"
     17 #include "base/memory/weak_ptr.h"
     18 #include "base/time/time.h"
     19 #include "content/browser/accessibility/browser_accessibility_delegate_mac.h"
     20 #include "content/browser/renderer_host/render_widget_host_view_base.h"
     21 #include "content/common/edit_command.h"
     22 #import "content/public/browser/render_widget_host_view_mac_base.h"
     23 #include "ipc/ipc_sender.h"
     24 #include "third_party/WebKit/public/web/WebCompositionUnderline.h"
     25 #include "ui/base/cocoa/base_view.h"
     26 #include "webkit/common/cursors/webcursor.h"
     27 
     28 namespace content {
     29 class CompositingIOSurfaceMac;
     30 class CompositingIOSurfaceContext;
     31 class RenderWidgetHostViewMac;
     32 class RenderWidgetHostViewMacEditCommandHelper;
     33 }
     34 
     35 @class CompositingIOSurfaceLayer;
     36 @class FullscreenWindowManager;
     37 @protocol RenderWidgetHostViewMacDelegate;
     38 @class ToolTip;
     39 
     40 @protocol RenderWidgetHostViewMacOwner
     41 - (content::RenderWidgetHostViewMac*)renderWidgetHostViewMac;
     42 @end
     43 
     44 // This is the view that lives in the Cocoa view hierarchy. In Windows-land,
     45 // RenderWidgetHostViewWin is both the view and the delegate. We split the roles
     46 // but that means that the view needs to own the delegate and will dispose of it
     47 // when it's removed from the view system.
     48 @interface RenderWidgetHostViewCocoa
     49     : BaseView <RenderWidgetHostViewMacBase,
     50                 RenderWidgetHostViewMacOwner,
     51                 NSTextInputClient,
     52                 BrowserAccessibilityDelegateCocoa> {
     53  @private
     54   scoped_ptr<content::RenderWidgetHostViewMac> renderWidgetHostView_;
     55   NSObject<RenderWidgetHostViewMacDelegate>* delegate_;  // weak
     56   BOOL canBeKeyView_;
     57   BOOL takesFocusOnlyOnMouseDown_;
     58   BOOL closeOnDeactivate_;
     59   scoped_ptr<content::RenderWidgetHostViewMacEditCommandHelper>
     60       editCommand_helper_;
     61 
     62   // These are part of the magic tooltip code from WebKit's WebHTMLView:
     63   id trackingRectOwner_;              // (not retained)
     64   void* trackingRectUserData_;
     65   NSTrackingRectTag lastToolTipTag_;
     66   base::scoped_nsobject<NSString> toolTip_;
     67 
     68   // Is YES if there was a mouse-down as yet unbalanced with a mouse-up.
     69   BOOL hasOpenMouseDown_;
     70 
     71   NSWindow* lastWindow_;  // weak
     72 
     73   // The cursor for the page. This is passed up from the renderer.
     74   base::scoped_nsobject<NSCursor> currentCursor_;
     75 
     76   // Variables used by our implementaion of the NSTextInput protocol.
     77   // An input method of Mac calls the methods of this protocol not only to
     78   // notify an application of its status, but also to retrieve the status of
     79   // the application. That is, an application cannot control an input method
     80   // directly.
     81   // This object keeps the status of a composition of the renderer and returns
     82   // it when an input method asks for it.
     83   // We need to implement Objective-C methods for the NSTextInput protocol. On
     84   // the other hand, we need to implement a C++ method for an IPC-message
     85   // handler which receives input-method events from the renderer.
     86 
     87   // Represents the input-method attributes supported by this object.
     88   base::scoped_nsobject<NSArray> validAttributesForMarkedText_;
     89 
     90   // Indicates if we are currently handling a key down event.
     91   BOOL handlingKeyDown_;
     92 
     93   // Indicates if there is any marked text.
     94   BOOL hasMarkedText_;
     95 
     96   // Indicates if unmarkText is called or not when handling a keyboard
     97   // event.
     98   BOOL unmarkTextCalled_;
     99 
    100   // The range of current marked text inside the whole content of the DOM node
    101   // being edited.
    102   // TODO(suzhe): This is currently a fake value, as we do not support accessing
    103   // the whole content yet.
    104   NSRange markedRange_;
    105 
    106   // The selected range, cached from a message sent by the renderer.
    107   NSRange selectedRange_;
    108 
    109   // Text to be inserted which was generated by handling a key down event.
    110   string16 textToBeInserted_;
    111 
    112   // Marked text which was generated by handling a key down event.
    113   string16 markedText_;
    114 
    115   // Underline information of the |markedText_|.
    116   std::vector<WebKit::WebCompositionUnderline> underlines_;
    117 
    118   // Indicates if doCommandBySelector method receives any edit command when
    119   // handling a key down event.
    120   BOOL hasEditCommands_;
    121 
    122   // Contains edit commands received by the -doCommandBySelector: method when
    123   // handling a key down event, not including inserting commands, eg. insertTab,
    124   // etc.
    125   content::EditCommands editCommands_;
    126 
    127   // The plugin that currently has focus (-1 if no plugin has focus).
    128   int focusedPluginIdentifier_;
    129 
    130   // Whether or not plugin IME is currently enabled active.
    131   BOOL pluginImeActive_;
    132 
    133   // Whether the previous mouse event was ignored due to hitTest check.
    134   BOOL mouseEventWasIgnored_;
    135 
    136   // Event monitor for scroll wheel end event.
    137   id endWheelMonitor_;
    138 
    139   // OpenGL Support:
    140 
    141   // recursive globalFrameDidChange protection:
    142   BOOL handlingGlobalFrameDidChange_;
    143 
    144   // The scale factor of the display this view is in.
    145   float deviceScaleFactor_;
    146 
    147   // If true then escape key down events are suppressed until the first escape
    148   // key up event. (The up event is suppressed as well). This is used by the
    149   // flash fullscreen code to avoid sending a key up event without a matching
    150   // key down event.
    151   BOOL suppressNextEscapeKeyUp_;
    152 }
    153 
    154 @property(nonatomic, readonly) NSRange selectedRange;
    155 @property(nonatomic, readonly) BOOL suppressNextEscapeKeyUp;
    156 
    157 - (void)setCanBeKeyView:(BOOL)can;
    158 - (void)setTakesFocusOnlyOnMouseDown:(BOOL)b;
    159 - (void)setCloseOnDeactivate:(BOOL)b;
    160 - (void)setToolTipAtMousePoint:(NSString *)string;
    161 // True for always-on-top special windows (e.g. Balloons and Panels).
    162 - (BOOL)acceptsMouseEventsWhenInactive;
    163 // Cancel ongoing composition (abandon the marked text).
    164 - (void)cancelComposition;
    165 // Confirm ongoing composition.
    166 - (void)confirmComposition;
    167 // Enables or disables plugin IME.
    168 - (void)setPluginImeActive:(BOOL)active;
    169 // Updates the current plugin focus state.
    170 - (void)pluginFocusChanged:(BOOL)focused forPlugin:(int)pluginId;
    171 // Evaluates the event in the context of plugin IME, if plugin IME is enabled.
    172 // Returns YES if the event was handled.
    173 - (BOOL)postProcessEventForPluginIme:(NSEvent*)event;
    174 - (void)updateCursor:(NSCursor*)cursor;
    175 - (NSRect)firstViewRectForCharacterRange:(NSRange)theRange
    176                              actualRange:(NSRangePointer)actualRange;
    177 @end
    178 
    179 namespace content {
    180 class RenderWidgetHostImpl;
    181 
    182 ///////////////////////////////////////////////////////////////////////////////
    183 // RenderWidgetHostViewMac
    184 //
    185 //  An object representing the "View" of a rendered web page. This object is
    186 //  responsible for displaying the content of the web page, and integrating with
    187 //  the Cocoa view system. It is the implementation of the RenderWidgetHostView
    188 //  that the cross-platform RenderWidgetHost object uses
    189 //  to display the data.
    190 //
    191 //  Comment excerpted from render_widget_host.h:
    192 //
    193 //    "The lifetime of the RenderWidgetHost* is tied to the render process.
    194 //     If the render process dies, the RenderWidgetHost* goes away and all
    195 //     references to it must become NULL."
    196 //
    197 // RenderWidgetHostView class hierarchy described in render_widget_host_view.h.
    198 class RenderWidgetHostViewMac : public RenderWidgetHostViewBase,
    199                                 public IPC::Sender {
    200  public:
    201   virtual ~RenderWidgetHostViewMac();
    202 
    203   RenderWidgetHostViewCocoa* cocoa_view() const { return cocoa_view_; }
    204 
    205   CONTENT_EXPORT void SetDelegate(
    206     NSObject<RenderWidgetHostViewMacDelegate>* delegate);
    207   void SetAllowOverlappingViews(bool overlapping);
    208 
    209   // RenderWidgetHostView implementation.
    210   virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE;
    211   virtual void InitAsChild(gfx::NativeView parent_view) OVERRIDE;
    212   virtual RenderWidgetHost* GetRenderWidgetHost() const OVERRIDE;
    213   virtual void SetSize(const gfx::Size& size) OVERRIDE;
    214   virtual void SetBounds(const gfx::Rect& rect) OVERRIDE;
    215   virtual gfx::NativeView GetNativeView() const OVERRIDE;
    216   virtual gfx::NativeViewId GetNativeViewId() const OVERRIDE;
    217   virtual gfx::NativeViewAccessible GetNativeViewAccessible() OVERRIDE;
    218   virtual bool HasFocus() const OVERRIDE;
    219   virtual bool IsSurfaceAvailableForCopy() const OVERRIDE;
    220   virtual void Show() OVERRIDE;
    221   virtual void Hide() OVERRIDE;
    222   virtual bool IsShowing() OVERRIDE;
    223   virtual gfx::Rect GetViewBounds() const OVERRIDE;
    224   virtual void SetShowingContextMenu(bool showing) OVERRIDE;
    225   virtual void SetActive(bool active) OVERRIDE;
    226   virtual void SetTakesFocusOnlyOnMouseDown(bool flag) OVERRIDE;
    227   virtual void SetWindowVisibility(bool visible) OVERRIDE;
    228   virtual void WindowFrameChanged() OVERRIDE;
    229   virtual void ShowDefinitionForSelection() OVERRIDE;
    230   virtual bool SupportsSpeech() const OVERRIDE;
    231   virtual void SpeakSelection() OVERRIDE;
    232   virtual bool IsSpeaking() const OVERRIDE;
    233   virtual void StopSpeaking() OVERRIDE;
    234   virtual void SetBackground(const SkBitmap& background) OVERRIDE;
    235 
    236   // Implementation of RenderWidgetHostViewPort.
    237   virtual void InitAsPopup(RenderWidgetHostView* parent_host_view,
    238                            const gfx::Rect& pos) OVERRIDE;
    239   virtual void InitAsFullscreen(
    240       RenderWidgetHostView* reference_host_view) OVERRIDE;
    241   virtual void WasShown() OVERRIDE;
    242   virtual void WasHidden() OVERRIDE;
    243   virtual void MovePluginWindows(
    244       const gfx::Vector2d& scroll_offset,
    245       const std::vector<WebPluginGeometry>& moves) OVERRIDE;
    246   virtual void Focus() OVERRIDE;
    247   virtual void Blur() OVERRIDE;
    248   virtual void UpdateCursor(const WebCursor& cursor) OVERRIDE;
    249   virtual void SetIsLoading(bool is_loading) OVERRIDE;
    250   virtual void TextInputTypeChanged(ui::TextInputType type,
    251                                     bool can_compose_inline,
    252                                     ui::TextInputMode input_mode) OVERRIDE;
    253   virtual void ImeCancelComposition() OVERRIDE;
    254   virtual void ImeCompositionRangeChanged(
    255       const ui::Range& range,
    256       const std::vector<gfx::Rect>& character_bounds) OVERRIDE;
    257   virtual void DidUpdateBackingStore(
    258       const gfx::Rect& scroll_rect,
    259       const gfx::Vector2d& scroll_delta,
    260       const std::vector<gfx::Rect>& copy_rects,
    261       const ui::LatencyInfo& latency_info) OVERRIDE;
    262   virtual void RenderProcessGone(base::TerminationStatus status,
    263                                  int error_code) OVERRIDE;
    264   virtual void Destroy() OVERRIDE;
    265   virtual void SetTooltipText(const string16& tooltip_text) OVERRIDE;
    266   virtual void SelectionChanged(const string16& text,
    267                                 size_t offset,
    268                                 const ui::Range& range) OVERRIDE;
    269   virtual void SelectionBoundsChanged(
    270       const ViewHostMsg_SelectionBounds_Params& params) OVERRIDE;
    271   virtual void ScrollOffsetChanged() OVERRIDE;
    272   virtual BackingStore* AllocBackingStore(const gfx::Size& size) OVERRIDE;
    273   virtual void CopyFromCompositingSurface(
    274       const gfx::Rect& src_subrect,
    275       const gfx::Size& dst_size,
    276       const base::Callback<void(bool, const SkBitmap&)>& callback) OVERRIDE;
    277   virtual void CopyFromCompositingSurfaceToVideoFrame(
    278       const gfx::Rect& src_subrect,
    279       const scoped_refptr<media::VideoFrame>& target,
    280       const base::Callback<void(bool)>& callback) OVERRIDE;
    281   virtual bool CanCopyToVideoFrame() const OVERRIDE;
    282   virtual bool CanSubscribeFrame() const OVERRIDE;
    283   virtual void BeginFrameSubscription(
    284       scoped_ptr<RenderWidgetHostViewFrameSubscriber> subscriber) OVERRIDE;
    285   virtual void EndFrameSubscription() OVERRIDE;
    286   virtual void OnAcceleratedCompositingStateChange() OVERRIDE;
    287   virtual void OnAccessibilityNotifications(
    288       const std::vector<AccessibilityHostMsg_NotificationParams>& params
    289       ) OVERRIDE;
    290   virtual bool PostProcessEventForPluginIme(
    291       const NativeWebKeyboardEvent& event) OVERRIDE;
    292 
    293   virtual void AcceleratedSurfaceBuffersSwapped(
    294       const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params,
    295       int gpu_host_id) OVERRIDE;
    296   virtual void AcceleratedSurfacePostSubBuffer(
    297       const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params,
    298       int gpu_host_id) OVERRIDE;
    299   virtual void AcceleratedSurfaceSuspend() OVERRIDE;
    300   virtual void AcceleratedSurfaceRelease() OVERRIDE;
    301   virtual bool HasAcceleratedSurface(const gfx::Size& desired_size) OVERRIDE;
    302   virtual void AboutToWaitForBackingStoreMsg() OVERRIDE;
    303   virtual void GetScreenInfo(WebKit::WebScreenInfo* results) OVERRIDE;
    304   virtual gfx::Rect GetBoundsInRootWindow() OVERRIDE;
    305   virtual gfx::GLSurfaceHandle GetCompositingSurface() OVERRIDE;
    306 
    307   virtual void SetHasHorizontalScrollbar(
    308       bool has_horizontal_scrollbar) OVERRIDE;
    309   virtual void SetScrollOffsetPinning(
    310       bool is_pinned_to_left, bool is_pinned_to_right) OVERRIDE;
    311   virtual bool LockMouse() OVERRIDE;
    312   virtual void UnlockMouse() OVERRIDE;
    313   virtual void UnhandledWheelEvent(
    314       const WebKit::WebMouseWheelEvent& event) OVERRIDE;
    315 
    316   // IPC::Sender implementation.
    317   virtual bool Send(IPC::Message* message) OVERRIDE;
    318 
    319   // Forwards the mouse event to the renderer.
    320   void ForwardMouseEvent(const WebKit::WebMouseEvent& event);
    321 
    322   void KillSelf();
    323 
    324   void SetTextInputActive(bool active);
    325 
    326   // Change this view to use CoreAnimation to draw.
    327   void EnableCoreAnimation();
    328 
    329   // Sends completed plugin IME notification and text back to the renderer.
    330   void PluginImeCompositionCompleted(const string16& text, int plugin_id);
    331 
    332   const std::string& selected_text() const { return selected_text_; }
    333 
    334   // Update the IOSurface to be drawn and call setNeedsDisplay on
    335   // |cocoa_view_|.
    336   void CompositorSwapBuffers(uint64 surface_handle,
    337                              const gfx::Size& size,
    338                              float scale_factor,
    339                              const ui::LatencyInfo& latency_info);
    340 
    341   // Draw the IOSurface by making its context current to this view.
    342   bool DrawIOSurfaceWithoutCoreAnimation();
    343 
    344   // Called when a GPU error is detected. Deletes all compositing state.
    345   void GotAcceleratedCompositingError();
    346 
    347   // Returns true and stores first rectangle for character range if the
    348   // requested |range| is already cached, otherwise returns false.
    349   // Exposed for testing.
    350   CONTENT_EXPORT bool GetCachedFirstRectForCharacterRange(
    351       NSRange range, NSRect* rect, NSRange* actual_range);
    352 
    353   // Returns true if there is line break in |range| and stores line breaking
    354   // point to |line_breaking_point|. The |line_break_point| is valid only if
    355   // this function returns true.
    356   bool GetLineBreakIndex(const std::vector<gfx::Rect>& bounds,
    357                          const ui::Range& range,
    358                          size_t* line_break_point);
    359 
    360   // Returns composition character boundary rectangle. The |range| is
    361   // composition based range. Also stores |actual_range| which is corresponding
    362   // to actually used range for returned rectangle.
    363   gfx::Rect GetFirstRectForCompositionRange(const ui::Range& range,
    364                                             ui::Range* actual_range);
    365 
    366   // Converts from given whole character range to composition oriented range. If
    367   // the conversion failed, return ui::Range::InvalidRange.
    368   ui::Range ConvertCharacterRangeToCompositionRange(
    369       const ui::Range& request_range);
    370 
    371   // These member variables should be private, but the associated ObjC class
    372   // needs access to them and can't be made a friend.
    373 
    374   // The associated Model.  Can be NULL if Destroy() is called when
    375   // someone (other than superview) has retained |cocoa_view_|.
    376   RenderWidgetHostImpl* render_widget_host_;
    377 
    378   // This is true when we are currently painting and thus should handle extra
    379   // paint requests by expanding the invalid rect rather than actually painting.
    380   bool about_to_validate_and_paint_;
    381 
    382   // This is true when we have already scheduled a call to
    383   // |-callSetNeedsDisplayInRect:| but it has not been fulfilled yet.  Used to
    384   // prevent us from scheduling multiple calls.
    385   bool call_set_needs_display_in_rect_pending_;
    386 
    387   // Whether last rendered frame was accelerated.
    388   bool last_frame_was_accelerated_;
    389 
    390   // The invalid rect that needs to be painted by callSetNeedsDisplayInRect.
    391   // This value is only meaningful when
    392   // |call_set_needs_display_in_rect_pending_| is true.
    393   NSRect invalid_rect_;
    394 
    395   // The time at which this view started displaying white pixels as a result of
    396   // not having anything to paint (empty backing store from renderer). This
    397   // value returns true for is_null() if we are not recording whiteout times.
    398   base::TimeTicks whiteout_start_time_;
    399 
    400   // The time it took after this view was selected for it to be fully painted.
    401   base::TimeTicks web_contents_switch_paint_time_;
    402 
    403   // Current text input type.
    404   ui::TextInputType text_input_type_;
    405   bool can_compose_inline_;
    406 
    407   base::scoped_nsobject<CALayer> software_layer_;
    408 
    409   // Accelerated compositing structures. These may be dynamically created and
    410   // destroyed together in Create/DestroyCompositedIOSurfaceAndLayer.
    411   base::scoped_nsobject<CompositingIOSurfaceLayer> compositing_iosurface_layer_;
    412   scoped_ptr<CompositingIOSurfaceMac> compositing_iosurface_;
    413   scoped_refptr<CompositingIOSurfaceContext> compositing_iosurface_context_;
    414 
    415   // Whether to allow overlapping views.
    416   bool allow_overlapping_views_;
    417 
    418   // Whether to use the CoreAnimation path to draw content.
    419   bool use_core_animation_;
    420 
    421   ui::LatencyInfo software_latency_info_;
    422 
    423   NSWindow* pepper_fullscreen_window() const {
    424     return pepper_fullscreen_window_;
    425   }
    426 
    427   CONTENT_EXPORT void release_pepper_fullscreen_window_for_testing();
    428 
    429   RenderWidgetHostViewMac* fullscreen_parent_host_view() const {
    430     return fullscreen_parent_host_view_;
    431   }
    432 
    433   RenderWidgetHostViewFrameSubscriber* frame_subscriber() const {
    434     return frame_subscriber_.get();
    435   }
    436 
    437   int window_number() const;
    438 
    439   float scale_factor() const;
    440 
    441   bool is_hidden() const { return is_hidden_; }
    442 
    443   void FrameSwapped();
    444 
    445  private:
    446   friend class RenderWidgetHostView;
    447   friend class RenderWidgetHostViewMacTest;
    448 
    449   void GetVSyncParameters(
    450       base::TimeTicks* timebase, base::TimeDelta* interval);
    451 
    452   // The view will associate itself with the given widget. The native view must
    453   // be hooked up immediately to the view hierarchy, or else when it is
    454   // deleted it will delete this out from under the caller.
    455   explicit RenderWidgetHostViewMac(RenderWidgetHost* widget);
    456 
    457   // Returns whether this render view is a popup (autocomplete window).
    458   bool IsPopup() const;
    459 
    460   // Shuts down the render_widget_host_.  This is a separate function so we can
    461   // invoke it from the message loop.
    462   void ShutdownHost();
    463 
    464   bool CreateCompositedIOSurface();
    465   bool CreateCompositedIOSurfaceLayer();
    466   enum DestroyContextBehavior {
    467     kLeaveContextBoundToView,
    468     kDestroyContext,
    469   };
    470   void DestroyCompositedIOSurfaceAndLayer(DestroyContextBehavior
    471       destroy_context_behavior);
    472 
    473   // Unbind the GL context (if any) that is bound to |cocoa_view_|.
    474   void ClearBoundContextDrawable();
    475 
    476   // Called when a GPU SwapBuffers is received.
    477   void GotAcceleratedFrame();
    478 
    479   // Called when a software DIB is received.
    480   void GotSoftwareFrame();
    481 
    482   // Ack pending SwapBuffers requests, if any, to unblock the GPU process. Has
    483   // no effect if there are no pending requests.
    484   void AckPendingSwapBuffers();
    485 
    486   // Ack pending SwapBuffers requests, but no more frequently than the vsync
    487   // rate if the renderer is not throttling the swap rate.
    488   void ThrottledAckPendingSwapBuffers();
    489 
    490   void OnPluginFocusChanged(bool focused, int plugin_id);
    491   void OnStartPluginIme();
    492   CONTENT_EXPORT void OnAcceleratedSurfaceSetIOSurface(
    493       gfx::PluginWindowHandle window,
    494       int32 width,
    495       int32 height,
    496       uint64 mach_port);
    497   void OnAcceleratedSurfaceSetTransportDIB(gfx::PluginWindowHandle window,
    498                                            int32 width,
    499                                            int32 height,
    500                                            TransportDIB::Handle transport_dib);
    501   void OnAcceleratedSurfaceBuffersSwapped(gfx::PluginWindowHandle window,
    502                                           uint64 surface_handle);
    503 
    504   // Convert |rect| from the views coordinate (upper-left origin) into
    505   // the OpenGL coordinate (lower-left origin) and scale for HiDPI displays.
    506   gfx::Rect GetScaledOpenGLPixelRect(const gfx::Rect& rect);
    507 
    508   // The associated view. This is weak and is inserted into the view hierarchy
    509   // to own this RenderWidgetHostViewMac object. Set to nil at the start of the
    510   // destructor.
    511   RenderWidgetHostViewCocoa* cocoa_view_;
    512 
    513   // Indicates if the page is loading.
    514   bool is_loading_;
    515 
    516   // true if the View is not visible.
    517   bool is_hidden_;
    518 
    519   // The text to be shown in the tooltip, supplied by the renderer.
    520   string16 tooltip_text_;
    521 
    522   // Factory used to safely scope delayed calls to ShutdownHost().
    523   base::WeakPtrFactory<RenderWidgetHostViewMac> weak_factory_;
    524 
    525   // selected text on the renderer.
    526   std::string selected_text_;
    527 
    528   // The window used for popup widgets.
    529   base::scoped_nsobject<NSWindow> popup_window_;
    530 
    531   // The fullscreen window used for pepper flash.
    532   base::scoped_nsobject<NSWindow> pepper_fullscreen_window_;
    533   base::scoped_nsobject<FullscreenWindowManager> fullscreen_window_manager_;
    534   // Our parent host view, if this is fullscreen.  NULL otherwise.
    535   RenderWidgetHostViewMac* fullscreen_parent_host_view_;
    536 
    537   // List of pending swaps for deferred acking:
    538   //   pairs of (route_id, gpu_host_id).
    539   std::list<std::pair<int32, int32> > pending_swap_buffers_acks_;
    540 
    541   // Factory used to cancel outstanding throttled AckPendingSwapBuffers calls.
    542   base::WeakPtrFactory<RenderWidgetHostViewMac>
    543       pending_swap_buffers_acks_weak_factory_;
    544 
    545   // The earliest time at which the next swap ack may be sent. Only relevant
    546   // when swaps are not being throttled by the renderer (when threaded
    547   // compositing is off).
    548   base::Time next_swap_ack_time_;
    549 
    550   // The current composition character range and its bounds.
    551   ui::Range composition_range_;
    552   std::vector<gfx::Rect> composition_bounds_;
    553 
    554   // The current caret bounds.
    555   gfx::Rect caret_rect_;
    556 
    557   // Subscriber that listens to frame presentation events.
    558   scoped_ptr<RenderWidgetHostViewFrameSubscriber> frame_subscriber_;
    559 
    560   DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewMac);
    561 };
    562 
    563 }  // namespace content
    564 
    565 #endif  // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_
    566