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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 RenderWidgetHostViewCocoa* cocoa_view() const { return cocoa_view_; } | 218 RenderWidgetHostViewCocoa* cocoa_view() const { return cocoa_view_; } |
219 | 219 |
220 // |delegate| is used to separate out the logic from the NSResponder delegate. | 220 // |delegate| is used to separate out the logic from the NSResponder delegate. |
221 // |delegate| is retained by this class. | 221 // |delegate| is retained by this class. |
222 // |delegate| should be set at most once. | 222 // |delegate| should be set at most once. |
223 CONTENT_EXPORT void SetDelegate( | 223 CONTENT_EXPORT void SetDelegate( |
224 NSObject<RenderWidgetHostViewMacDelegate>* delegate); | 224 NSObject<RenderWidgetHostViewMacDelegate>* delegate); |
225 void SetAllowPauseForResizeOrRepaint(bool allow); | 225 void SetAllowPauseForResizeOrRepaint(bool allow); |
226 | 226 |
227 // RenderWidgetHostView implementation. | 227 // RenderWidgetHostView implementation. |
228 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; | 228 virtual bool OnMessageReceived(const IPC::Message& msg) override; |
229 virtual void InitAsChild(gfx::NativeView parent_view) OVERRIDE; | 229 virtual void InitAsChild(gfx::NativeView parent_view) override; |
230 virtual RenderWidgetHost* GetRenderWidgetHost() const OVERRIDE; | 230 virtual RenderWidgetHost* GetRenderWidgetHost() const override; |
231 virtual void SetSize(const gfx::Size& size) OVERRIDE; | 231 virtual void SetSize(const gfx::Size& size) override; |
232 virtual void SetBounds(const gfx::Rect& rect) OVERRIDE; | 232 virtual void SetBounds(const gfx::Rect& rect) override; |
233 virtual gfx::Vector2dF GetLastScrollOffset() const OVERRIDE; | 233 virtual gfx::Vector2dF GetLastScrollOffset() const override; |
234 virtual gfx::NativeView GetNativeView() const OVERRIDE; | 234 virtual gfx::NativeView GetNativeView() const override; |
235 virtual gfx::NativeViewId GetNativeViewId() const OVERRIDE; | 235 virtual gfx::NativeViewId GetNativeViewId() const override; |
236 virtual gfx::NativeViewAccessible GetNativeViewAccessible() OVERRIDE; | 236 virtual gfx::NativeViewAccessible GetNativeViewAccessible() override; |
237 virtual bool HasFocus() const OVERRIDE; | 237 virtual bool HasFocus() const override; |
238 virtual bool IsSurfaceAvailableForCopy() const OVERRIDE; | 238 virtual bool IsSurfaceAvailableForCopy() const override; |
239 virtual void Show() OVERRIDE; | 239 virtual void Show() override; |
240 virtual void Hide() OVERRIDE; | 240 virtual void Hide() override; |
241 virtual bool IsShowing() OVERRIDE; | 241 virtual bool IsShowing() override; |
242 virtual gfx::Rect GetViewBounds() const OVERRIDE; | 242 virtual gfx::Rect GetViewBounds() const override; |
243 virtual void SetShowingContextMenu(bool showing) OVERRIDE; | 243 virtual void SetShowingContextMenu(bool showing) override; |
244 virtual void SetActive(bool active) OVERRIDE; | 244 virtual void SetActive(bool active) override; |
245 virtual void SetTakesFocusOnlyOnMouseDown(bool flag) OVERRIDE; | 245 virtual void SetTakesFocusOnlyOnMouseDown(bool flag) override; |
246 virtual void SetWindowVisibility(bool visible) OVERRIDE; | 246 virtual void SetWindowVisibility(bool visible) override; |
247 virtual void WindowFrameChanged() OVERRIDE; | 247 virtual void WindowFrameChanged() override; |
248 virtual void ShowDefinitionForSelection() OVERRIDE; | 248 virtual void ShowDefinitionForSelection() override; |
249 virtual bool SupportsSpeech() const OVERRIDE; | 249 virtual bool SupportsSpeech() const override; |
250 virtual void SpeakSelection() OVERRIDE; | 250 virtual void SpeakSelection() override; |
251 virtual bool IsSpeaking() const OVERRIDE; | 251 virtual bool IsSpeaking() const override; |
252 virtual void StopSpeaking() OVERRIDE; | 252 virtual void StopSpeaking() override; |
253 virtual void SetBackgroundOpaque(bool opaque) OVERRIDE; | 253 virtual void SetBackgroundOpaque(bool opaque) override; |
254 | 254 |
255 // Implementation of RenderWidgetHostViewBase. | 255 // Implementation of RenderWidgetHostViewBase. |
256 virtual void InitAsPopup(RenderWidgetHostView* parent_host_view, | 256 virtual void InitAsPopup(RenderWidgetHostView* parent_host_view, |
257 const gfx::Rect& pos) OVERRIDE; | 257 const gfx::Rect& pos) override; |
258 virtual void InitAsFullscreen( | 258 virtual void InitAsFullscreen( |
259 RenderWidgetHostView* reference_host_view) OVERRIDE; | 259 RenderWidgetHostView* reference_host_view) override; |
260 virtual void WasShown() OVERRIDE; | 260 virtual void WasShown() override; |
261 virtual void WasHidden() OVERRIDE; | 261 virtual void WasHidden() override; |
262 virtual void MovePluginWindows( | 262 virtual void MovePluginWindows( |
263 const std::vector<WebPluginGeometry>& moves) OVERRIDE; | 263 const std::vector<WebPluginGeometry>& moves) override; |
264 virtual void Focus() OVERRIDE; | 264 virtual void Focus() override; |
265 virtual void Blur() OVERRIDE; | 265 virtual void Blur() override; |
266 virtual void UpdateCursor(const WebCursor& cursor) OVERRIDE; | 266 virtual void UpdateCursor(const WebCursor& cursor) override; |
267 virtual void SetIsLoading(bool is_loading) OVERRIDE; | 267 virtual void SetIsLoading(bool is_loading) override; |
268 virtual void TextInputStateChanged( | 268 virtual void TextInputStateChanged( |
269 const ViewHostMsg_TextInputState_Params& params) OVERRIDE; | 269 const ViewHostMsg_TextInputState_Params& params) override; |
270 virtual void ImeCancelComposition() OVERRIDE; | 270 virtual void ImeCancelComposition() override; |
271 virtual void ImeCompositionRangeChanged( | 271 virtual void ImeCompositionRangeChanged( |
272 const gfx::Range& range, | 272 const gfx::Range& range, |
273 const std::vector<gfx::Rect>& character_bounds) OVERRIDE; | 273 const std::vector<gfx::Rect>& character_bounds) override; |
274 virtual void RenderProcessGone(base::TerminationStatus status, | 274 virtual void RenderProcessGone(base::TerminationStatus status, |
275 int error_code) OVERRIDE; | 275 int error_code) override; |
276 virtual void RenderWidgetHostGone() OVERRIDE; | 276 virtual void RenderWidgetHostGone() override; |
277 virtual void Destroy() OVERRIDE; | 277 virtual void Destroy() override; |
278 virtual void SetTooltipText(const base::string16& tooltip_text) OVERRIDE; | 278 virtual void SetTooltipText(const base::string16& tooltip_text) override; |
279 virtual void SelectionChanged(const base::string16& text, | 279 virtual void SelectionChanged(const base::string16& text, |
280 size_t offset, | 280 size_t offset, |
281 const gfx::Range& range) OVERRIDE; | 281 const gfx::Range& range) override; |
282 virtual void SelectionBoundsChanged( | 282 virtual void SelectionBoundsChanged( |
283 const ViewHostMsg_SelectionBounds_Params& params) OVERRIDE; | 283 const ViewHostMsg_SelectionBounds_Params& params) override; |
284 virtual void CopyFromCompositingSurface( | 284 virtual void CopyFromCompositingSurface( |
285 const gfx::Rect& src_subrect, | 285 const gfx::Rect& src_subrect, |
286 const gfx::Size& dst_size, | 286 const gfx::Size& dst_size, |
287 const base::Callback<void(bool, const SkBitmap&)>& callback, | 287 const base::Callback<void(bool, const SkBitmap&)>& callback, |
288 SkColorType color_type) OVERRIDE; | 288 SkColorType color_type) override; |
289 virtual void CopyFromCompositingSurfaceToVideoFrame( | 289 virtual void CopyFromCompositingSurfaceToVideoFrame( |
290 const gfx::Rect& src_subrect, | 290 const gfx::Rect& src_subrect, |
291 const scoped_refptr<media::VideoFrame>& target, | 291 const scoped_refptr<media::VideoFrame>& target, |
292 const base::Callback<void(bool)>& callback) OVERRIDE; | 292 const base::Callback<void(bool)>& callback) override; |
293 virtual bool CanCopyToVideoFrame() const OVERRIDE; | 293 virtual bool CanCopyToVideoFrame() const override; |
294 virtual bool CanSubscribeFrame() const OVERRIDE; | 294 virtual bool CanSubscribeFrame() const override; |
295 virtual void BeginFrameSubscription( | 295 virtual void BeginFrameSubscription( |
296 scoped_ptr<RenderWidgetHostViewFrameSubscriber> subscriber) OVERRIDE; | 296 scoped_ptr<RenderWidgetHostViewFrameSubscriber> subscriber) override; |
297 virtual void EndFrameSubscription() OVERRIDE; | 297 virtual void EndFrameSubscription() override; |
298 virtual void OnSwapCompositorFrame( | 298 virtual void OnSwapCompositorFrame( |
299 uint32 output_surface_id, scoped_ptr<cc::CompositorFrame> frame) OVERRIDE; | 299 uint32 output_surface_id, scoped_ptr<cc::CompositorFrame> frame) override; |
300 virtual BrowserAccessibilityManager* CreateBrowserAccessibilityManager( | 300 virtual BrowserAccessibilityManager* CreateBrowserAccessibilityManager( |
301 BrowserAccessibilityDelegate* delegate) OVERRIDE; | 301 BrowserAccessibilityDelegate* delegate) override; |
302 virtual gfx::Point AccessibilityOriginInScreen(const gfx::Rect& bounds) | 302 virtual gfx::Point AccessibilityOriginInScreen(const gfx::Rect& bounds) |
303 OVERRIDE; | 303 override; |
304 virtual void AccessibilityShowMenu(const gfx::Point& point) OVERRIDE; | 304 virtual void AccessibilityShowMenu(const gfx::Point& point) override; |
305 virtual bool PostProcessEventForPluginIme( | 305 virtual bool PostProcessEventForPluginIme( |
306 const NativeWebKeyboardEvent& event) OVERRIDE; | 306 const NativeWebKeyboardEvent& event) override; |
307 | 307 |
308 virtual bool HasAcceleratedSurface(const gfx::Size& desired_size) OVERRIDE; | 308 virtual bool HasAcceleratedSurface(const gfx::Size& desired_size) override; |
309 virtual void GetScreenInfo(blink::WebScreenInfo* results) OVERRIDE; | 309 virtual void GetScreenInfo(blink::WebScreenInfo* results) override; |
310 virtual gfx::Rect GetBoundsInRootWindow() OVERRIDE; | 310 virtual gfx::Rect GetBoundsInRootWindow() override; |
311 virtual gfx::GLSurfaceHandle GetCompositingSurface() OVERRIDE; | 311 virtual gfx::GLSurfaceHandle GetCompositingSurface() override; |
312 | 312 |
313 virtual bool LockMouse() OVERRIDE; | 313 virtual bool LockMouse() override; |
314 virtual void UnlockMouse() OVERRIDE; | 314 virtual void UnlockMouse() override; |
315 virtual void WheelEventAck(const blink::WebMouseWheelEvent& event, | 315 virtual void WheelEventAck(const blink::WebMouseWheelEvent& event, |
316 InputEventAckState ack_result) OVERRIDE; | 316 InputEventAckState ack_result) override; |
317 | 317 |
318 // IPC::Sender implementation. | 318 // IPC::Sender implementation. |
319 virtual bool Send(IPC::Message* message) OVERRIDE; | 319 virtual bool Send(IPC::Message* message) override; |
320 | 320 |
321 virtual SkColorType PreferredReadbackFormat() OVERRIDE; | 321 virtual SkColorType PreferredReadbackFormat() override; |
322 | 322 |
323 // gfx::DisplayObserver implementation. | 323 // gfx::DisplayObserver implementation. |
324 virtual void OnDisplayAdded(const gfx::Display& new_display) OVERRIDE; | 324 virtual void OnDisplayAdded(const gfx::Display& new_display) override; |
325 virtual void OnDisplayRemoved(const gfx::Display& old_display) OVERRIDE; | 325 virtual void OnDisplayRemoved(const gfx::Display& old_display) override; |
326 virtual void OnDisplayMetricsChanged(const gfx::Display& display, | 326 virtual void OnDisplayMetricsChanged(const gfx::Display& display, |
327 uint32_t metrics) OVERRIDE; | 327 uint32_t metrics) override; |
328 | 328 |
329 // Forwards the mouse event to the renderer. | 329 // Forwards the mouse event to the renderer. |
330 void ForwardMouseEvent(const blink::WebMouseEvent& event); | 330 void ForwardMouseEvent(const blink::WebMouseEvent& event); |
331 | 331 |
332 void KillSelf(); | 332 void KillSelf(); |
333 | 333 |
334 void SetTextInputActive(bool active); | 334 void SetTextInputActive(bool active); |
335 | 335 |
336 // Sends completed plugin IME notification and text back to the renderer. | 336 // Sends completed plugin IME notification and text back to the renderer. |
337 void PluginImeCompositionCompleted(const base::string16& text, int plugin_id); | 337 void PluginImeCompositionCompleted(const base::string16& text, int plugin_id); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 | 408 |
409 // Update the scale factor for the backing store and for any CALayers. | 409 // Update the scale factor for the backing store and for any CALayers. |
410 void UpdateBackingStoreScaleFactor(); | 410 void UpdateBackingStoreScaleFactor(); |
411 | 411 |
412 // Ensure that the display link is associated with the correct display. | 412 // Ensure that the display link is associated with the correct display. |
413 void UpdateDisplayLink(); | 413 void UpdateDisplayLink(); |
414 | 414 |
415 void PauseForPendingResizeOrRepaintsAndDraw(); | 415 void PauseForPendingResizeOrRepaintsAndDraw(); |
416 | 416 |
417 // DelegatedFrameHostClient implementation. | 417 // DelegatedFrameHostClient implementation. |
418 virtual ui::Compositor* GetCompositor() const OVERRIDE; | 418 virtual ui::Compositor* GetCompositor() const override; |
419 virtual ui::Layer* GetLayer() OVERRIDE; | 419 virtual ui::Layer* GetLayer() override; |
420 virtual RenderWidgetHostImpl* GetHost() OVERRIDE; | 420 virtual RenderWidgetHostImpl* GetHost() override; |
421 virtual bool IsVisible() OVERRIDE; | 421 virtual bool IsVisible() override; |
422 virtual scoped_ptr<ResizeLock> CreateResizeLock( | 422 virtual scoped_ptr<ResizeLock> CreateResizeLock( |
423 bool defer_compositor_lock) OVERRIDE; | 423 bool defer_compositor_lock) override; |
424 virtual gfx::Size DesiredFrameSize() OVERRIDE; | 424 virtual gfx::Size DesiredFrameSize() override; |
425 virtual float CurrentDeviceScaleFactor() OVERRIDE; | 425 virtual float CurrentDeviceScaleFactor() override; |
426 virtual gfx::Size ConvertViewSizeToPixel(const gfx::Size& size) OVERRIDE; | 426 virtual gfx::Size ConvertViewSizeToPixel(const gfx::Size& size) override; |
427 virtual DelegatedFrameHost* GetDelegatedFrameHost() const OVERRIDE; | 427 virtual DelegatedFrameHost* GetDelegatedFrameHost() const override; |
428 | 428 |
429 // BrowserCompositorViewMacClient implementation. | 429 // BrowserCompositorViewMacClient implementation. |
430 virtual bool BrowserCompositorViewShouldAckImmediately() const OVERRIDE; | 430 virtual bool BrowserCompositorViewShouldAckImmediately() const override; |
431 virtual void BrowserCompositorViewFrameSwapped( | 431 virtual void BrowserCompositorViewFrameSwapped( |
432 const std::vector<ui::LatencyInfo>& latency_info) OVERRIDE; | 432 const std::vector<ui::LatencyInfo>& latency_info) override; |
433 virtual NSView* BrowserCompositorSuperview() OVERRIDE; | 433 virtual NSView* BrowserCompositorSuperview() override; |
434 virtual ui::Layer* BrowserCompositorRootLayer() OVERRIDE; | 434 virtual ui::Layer* BrowserCompositorRootLayer() override; |
435 | 435 |
436 private: | 436 private: |
437 friend class RenderWidgetHostViewMacTest; | 437 friend class RenderWidgetHostViewMacTest; |
438 | 438 |
439 // Returns whether this render view is a popup (autocomplete window). | 439 // Returns whether this render view is a popup (autocomplete window). |
440 bool IsPopup() const; | 440 bool IsPopup() const; |
441 | 441 |
442 // Shuts down the render_widget_host_. This is a separate function so we can | 442 // Shuts down the render_widget_host_. This is a separate function so we can |
443 // invoke it from the message loop. | 443 // invoke it from the message loop. |
444 void ShutdownHost(); | 444 void ShutdownHost(); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
507 | 507 |
508 // The current caret bounds. | 508 // The current caret bounds. |
509 gfx::Rect caret_rect_; | 509 gfx::Rect caret_rect_; |
510 | 510 |
511 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewMac); | 511 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewMac); |
512 }; | 512 }; |
513 | 513 |
514 } // namespace content | 514 } // namespace content |
515 | 515 |
516 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_ | 516 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_ |
OLD | NEW |