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/IOSurface.h> | 9 #include <IOSurface/IOSurface.h> |
10 #include <stddef.h> | 10 #include <stddef.h> |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
260 bool IsSurfaceAvailableForCopy() const override; | 260 bool IsSurfaceAvailableForCopy() const override; |
261 void Show() override; | 261 void Show() override; |
262 void Hide() override; | 262 void Hide() override; |
263 bool IsShowing() override; | 263 bool IsShowing() override; |
264 void WasUnOccluded() override; | 264 void WasUnOccluded() override; |
265 void WasOccluded() override; | 265 void WasOccluded() override; |
266 gfx::Rect GetViewBounds() const override; | 266 gfx::Rect GetViewBounds() const override; |
267 void SetShowingContextMenu(bool showing) override; | 267 void SetShowingContextMenu(bool showing) override; |
268 void SetActive(bool active) override; | 268 void SetActive(bool active) override; |
269 void ShowDefinitionForSelection() override; | 269 void ShowDefinitionForSelection() override; |
270 bool SupportsSpeech() const override; | |
271 void SpeakSelection() override; | 270 void SpeakSelection() override; |
272 bool IsSpeaking() const override; | |
273 void StopSpeaking() override; | |
274 void SetBackgroundColor(SkColor color) override; | 271 void SetBackgroundColor(SkColor color) override; |
275 void SetNeedsBeginFrames(bool needs_begin_frames) override; | 272 void SetNeedsBeginFrames(bool needs_begin_frames) override; |
276 | 273 |
277 // Implementation of RenderWidgetHostViewBase. | 274 // Implementation of RenderWidgetHostViewBase. |
278 void InitAsPopup(RenderWidgetHostView* parent_host_view, | 275 void InitAsPopup(RenderWidgetHostView* parent_host_view, |
279 const gfx::Rect& pos) override; | 276 const gfx::Rect& pos) override; |
280 void InitAsFullscreen(RenderWidgetHostView* reference_host_view) override; | 277 void InitAsFullscreen(RenderWidgetHostView* reference_host_view) override; |
281 void Focus() override; | 278 void Focus() override; |
282 void UpdateCursor(const WebCursor& cursor) override; | 279 void UpdateCursor(const WebCursor& cursor) override; |
283 void SetIsLoading(bool is_loading) override; | 280 void SetIsLoading(bool is_loading) override; |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
367 void OnDisplayMetricsChanged(const display::Display& display, | 364 void OnDisplayMetricsChanged(const display::Display& display, |
368 uint32_t metrics) override; | 365 uint32_t metrics) override; |
369 | 366 |
370 // Forwards the mouse event to the renderer. | 367 // Forwards the mouse event to the renderer. |
371 void ForwardMouseEvent(const blink::WebMouseEvent& event); | 368 void ForwardMouseEvent(const blink::WebMouseEvent& event); |
372 | 369 |
373 void KillSelf(); | 370 void KillSelf(); |
374 | 371 |
375 void SetTextInputActive(bool active); | 372 void SetTextInputActive(bool active); |
376 | 373 |
377 const std::string& selected_text() const { return selected_text_; } | 374 const base::string16& selected_text() const { return selected_text_; } |
378 const gfx::Range& composition_range() const { return composition_range_; } | 375 const gfx::Range& composition_range() const { return composition_range_; } |
379 const base::string16& selection_text() const { return selection_text_; } | 376 const base::string16& selection_text() const { return selection_text_; } |
380 size_t selection_text_offset() const { return selection_text_offset_; } | 377 size_t selection_text_offset() const { return selection_text_offset_; } |
381 | 378 |
382 // Returns true and stores first rectangle for character range if the | 379 // Returns true and stores first rectangle for character range if the |
383 // requested |range| is already cached, otherwise returns false. | 380 // requested |range| is already cached, otherwise returns false. |
384 // Exposed for testing. | 381 // Exposed for testing. |
385 CONTENT_EXPORT bool GetCachedFirstRectForCharacterRange( | 382 CONTENT_EXPORT bool GetCachedFirstRectForCharacterRange( |
386 NSRange range, NSRect* rect, NSRange* actual_range); | 383 NSRange range, NSRect* rect, NSRange* actual_range); |
387 | 384 |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
478 friend class RenderWidgetHostViewMacTest; | 475 friend class RenderWidgetHostViewMacTest; |
479 | 476 |
480 // Returns whether this render view is a popup (autocomplete window). | 477 // Returns whether this render view is a popup (autocomplete window). |
481 bool IsPopup() const; | 478 bool IsPopup() const; |
482 | 479 |
483 // Shuts down the render_widget_host_. This is a separate function so we can | 480 // Shuts down the render_widget_host_. This is a separate function so we can |
484 // invoke it from the message loop. | 481 // invoke it from the message loop. |
485 void ShutdownHost(); | 482 void ShutdownHost(); |
486 | 483 |
487 // IPC message handlers. | 484 // IPC message handlers. |
485 // TODO(spqchan): Change |text| to be the type string16. | |
Alexei Svitkine (slow)
2017/02/01 19:12:37
Can you provide more context here? Why is string16
spqchan
2017/02/02 20:35:05
This is done to avoid some conversions, since sele
Alexei Svitkine (slow)
2017/02/02 20:50:24
If you keep it here, expand the comment to refer t
spqchan
2017/02/03 23:32:10
Done.
| |
488 void OnGetRenderedTextCompleted(const std::string& text); | 486 void OnGetRenderedTextCompleted(const std::string& text); |
489 | 487 |
490 // Send updated vsync parameters to the top level display. | 488 // Send updated vsync parameters to the top level display. |
491 void UpdateDisplayVSyncParameters(); | 489 void UpdateDisplayVSyncParameters(); |
492 | 490 |
493 // Dispatches a TTS session. | |
494 void SpeakText(const std::string& text); | |
495 | |
496 // Get the focused view that should be used for retrieving the text selection. | 491 // Get the focused view that should be used for retrieving the text selection. |
497 RenderWidgetHostViewBase* GetFocusedViewForTextSelection(); | 492 RenderWidgetHostViewBase* GetFocusedViewForTextSelection(); |
498 | 493 |
499 // Adds/Removes frame observer based on state. | 494 // Adds/Removes frame observer based on state. |
500 void UpdateNeedsBeginFramesInternal(); | 495 void UpdateNeedsBeginFramesInternal(); |
501 | 496 |
502 // The associated view. This is weak and is inserted into the view hierarchy | 497 // The associated view. This is weak and is inserted into the view hierarchy |
503 // to own this RenderWidgetHostViewMac object. Set to nil at the start of the | 498 // to own this RenderWidgetHostViewMac object. Set to nil at the start of the |
504 // destructor. | 499 // destructor. |
505 RenderWidgetHostViewCocoa* cocoa_view_; | 500 RenderWidgetHostViewCocoa* cocoa_view_; |
506 | 501 |
507 // Indicates if the page is loading. | 502 // Indicates if the page is loading. |
508 bool is_loading_; | 503 bool is_loading_; |
509 | 504 |
510 // Whether it's allowed to pause waiting for a new frame. | 505 // Whether it's allowed to pause waiting for a new frame. |
511 bool allow_pause_for_resize_or_repaint_; | 506 bool allow_pause_for_resize_or_repaint_; |
512 | 507 |
513 // The last scroll offset of the view. | 508 // The last scroll offset of the view. |
514 gfx::Vector2dF last_scroll_offset_; | 509 gfx::Vector2dF last_scroll_offset_; |
515 | 510 |
516 // The text to be shown in the tooltip, supplied by the renderer. | 511 // The text to be shown in the tooltip, supplied by the renderer. |
517 base::string16 tooltip_text_; | 512 base::string16 tooltip_text_; |
518 | 513 |
519 // True when this view acts as a platform view hack for a | 514 // True when this view acts as a platform view hack for a |
520 // RenderWidgetHostViewGuest. | 515 // RenderWidgetHostViewGuest. |
521 bool is_guest_view_hack_; | 516 bool is_guest_view_hack_; |
522 | 517 |
523 // selected text on the renderer. | 518 // selected text on the renderer. |
524 std::string selected_text_; | 519 base::string16 selected_text_; |
525 | 520 |
526 // The window used for popup widgets. | 521 // The window used for popup widgets. |
527 base::scoped_nsobject<NSWindow> popup_window_; | 522 base::scoped_nsobject<NSWindow> popup_window_; |
528 | 523 |
529 // The fullscreen window used for pepper flash. | 524 // The fullscreen window used for pepper flash. |
530 base::scoped_nsobject<NSWindow> pepper_fullscreen_window_; | 525 base::scoped_nsobject<NSWindow> pepper_fullscreen_window_; |
531 base::scoped_nsobject<FullscreenWindowManager> fullscreen_window_manager_; | 526 base::scoped_nsobject<FullscreenWindowManager> fullscreen_window_manager_; |
532 // Our parent host view, if this is fullscreen. NULL otherwise. | 527 // Our parent host view, if this is fullscreen. NULL otherwise. |
533 RenderWidgetHostViewMac* fullscreen_parent_host_view_; | 528 RenderWidgetHostViewMac* fullscreen_parent_host_view_; |
534 | 529 |
(...skipping 29 matching lines...) Expand all Loading... | |
564 | 559 |
565 // Factory used to safely scope delayed calls to ShutdownHost(). | 560 // Factory used to safely scope delayed calls to ShutdownHost(). |
566 base::WeakPtrFactory<RenderWidgetHostViewMac> weak_factory_; | 561 base::WeakPtrFactory<RenderWidgetHostViewMac> weak_factory_; |
567 | 562 |
568 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewMac); | 563 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewMac); |
569 }; | 564 }; |
570 | 565 |
571 } // namespace content | 566 } // namespace content |
572 | 567 |
573 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_ | 568 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_ |
OLD | NEW |