Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(155)

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_mac.h

Issue 2688883002: Revert [MacViews] Implemented text context menu (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 bool IsSurfaceAvailableForCopy() const override; 265 bool IsSurfaceAvailableForCopy() const override;
266 void Show() override; 266 void Show() override;
267 void Hide() override; 267 void Hide() override;
268 bool IsShowing() override; 268 bool IsShowing() override;
269 void WasUnOccluded() override; 269 void WasUnOccluded() override;
270 void WasOccluded() override; 270 void WasOccluded() override;
271 gfx::Rect GetViewBounds() const override; 271 gfx::Rect GetViewBounds() const override;
272 void SetShowingContextMenu(bool showing) override; 272 void SetShowingContextMenu(bool showing) override;
273 void SetActive(bool active) override; 273 void SetActive(bool active) override;
274 void ShowDefinitionForSelection() override; 274 void ShowDefinitionForSelection() override;
275 bool SupportsSpeech() const override;
275 void SpeakSelection() override; 276 void SpeakSelection() override;
277 bool IsSpeaking() const override;
278 void StopSpeaking() override;
276 void SetBackgroundColor(SkColor color) override; 279 void SetBackgroundColor(SkColor color) override;
277 void SetNeedsBeginFrames(bool needs_begin_frames) override; 280 void SetNeedsBeginFrames(bool needs_begin_frames) override;
278 281
279 // Implementation of RenderWidgetHostViewBase. 282 // Implementation of RenderWidgetHostViewBase.
280 void InitAsPopup(RenderWidgetHostView* parent_host_view, 283 void InitAsPopup(RenderWidgetHostView* parent_host_view,
281 const gfx::Rect& pos) override; 284 const gfx::Rect& pos) override;
282 void InitAsFullscreen(RenderWidgetHostView* reference_host_view) override; 285 void InitAsFullscreen(RenderWidgetHostView* reference_host_view) override;
283 void Focus() override; 286 void Focus() override;
284 void UpdateCursor(const WebCursor& cursor) override; 287 void UpdateCursor(const WebCursor& cursor) override;
285 void SetIsLoading(bool is_loading) override; 288 void SetIsLoading(bool is_loading) override;
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 void OnDisplayMetricsChanged(const display::Display& display, 370 void OnDisplayMetricsChanged(const display::Display& display,
368 uint32_t metrics) override; 371 uint32_t metrics) override;
369 372
370 // Forwards the mouse event to the renderer. 373 // Forwards the mouse event to the renderer.
371 void ForwardMouseEvent(const blink::WebMouseEvent& event); 374 void ForwardMouseEvent(const blink::WebMouseEvent& event);
372 375
373 void KillSelf(); 376 void KillSelf();
374 377
375 void SetTextInputActive(bool active); 378 void SetTextInputActive(bool active);
376 379
377 const base::string16& selected_text() const { return selected_text_; } 380 const std::string& selected_text() const { return selected_text_; }
378 const gfx::Range& composition_range() const { return composition_range_; } 381 const gfx::Range& composition_range() const { return composition_range_; }
379 const base::string16& selection_text() const { return selection_text_; } 382 const base::string16& selection_text() const { return selection_text_; }
380 size_t selection_text_offset() const { return selection_text_offset_; } 383 size_t selection_text_offset() const { return selection_text_offset_; }
381 384
382 // Returns true and stores first rectangle for character range if the 385 // Returns true and stores first rectangle for character range if the
383 // requested |range| is already cached, otherwise returns false. 386 // requested |range| is already cached, otherwise returns false.
384 // Exposed for testing. 387 // Exposed for testing.
385 CONTENT_EXPORT bool GetCachedFirstRectForCharacterRange( 388 CONTENT_EXPORT bool GetCachedFirstRectForCharacterRange(
386 NSRange range, NSRect* rect, NSRange* actual_range); 389 NSRange range, NSRect* rect, NSRange* actual_range);
387 390
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 friend class RenderWidgetHostViewMacTest; 481 friend class RenderWidgetHostViewMacTest;
479 482
480 // Returns whether this render view is a popup (autocomplete window). 483 // Returns whether this render view is a popup (autocomplete window).
481 bool IsPopup() const; 484 bool IsPopup() const;
482 485
483 // Shuts down the render_widget_host_. This is a separate function so we can 486 // Shuts down the render_widget_host_. This is a separate function so we can
484 // invoke it from the message loop. 487 // invoke it from the message loop.
485 void ShutdownHost(); 488 void ShutdownHost();
486 489
487 // IPC message handlers. 490 // IPC message handlers.
488 // TODO(spqchan): Change |text| to be the type string16.
489 void OnGetRenderedTextCompleted(const std::string& text); 491 void OnGetRenderedTextCompleted(const std::string& text);
490 492
491 // Send updated vsync parameters to the top level display. 493 // Send updated vsync parameters to the top level display.
492 void UpdateDisplayVSyncParameters(); 494 void UpdateDisplayVSyncParameters();
493 495
496 // Dispatches a TTS session.
497 void SpeakText(const std::string& text);
498
494 // Get the focused view that should be used for retrieving the text selection. 499 // Get the focused view that should be used for retrieving the text selection.
495 RenderWidgetHostViewBase* GetFocusedViewForTextSelection(); 500 RenderWidgetHostViewBase* GetFocusedViewForTextSelection();
496 501
497 // Adds/Removes frame observer based on state. 502 // Adds/Removes frame observer based on state.
498 void UpdateNeedsBeginFramesInternal(); 503 void UpdateNeedsBeginFramesInternal();
499 504
500 // The associated view. This is weak and is inserted into the view hierarchy 505 // The associated view. This is weak and is inserted into the view hierarchy
501 // to own this RenderWidgetHostViewMac object. Set to nil at the start of the 506 // to own this RenderWidgetHostViewMac object. Set to nil at the start of the
502 // destructor. 507 // destructor.
503 RenderWidgetHostViewCocoa* cocoa_view_; 508 RenderWidgetHostViewCocoa* cocoa_view_;
504 509
505 // Indicates if the page is loading. 510 // Indicates if the page is loading.
506 bool is_loading_; 511 bool is_loading_;
507 512
508 // Whether it's allowed to pause waiting for a new frame. 513 // Whether it's allowed to pause waiting for a new frame.
509 bool allow_pause_for_resize_or_repaint_; 514 bool allow_pause_for_resize_or_repaint_;
510 515
511 // The last scroll offset of the view. 516 // The last scroll offset of the view.
512 gfx::Vector2dF last_scroll_offset_; 517 gfx::Vector2dF last_scroll_offset_;
513 518
514 // The text to be shown in the tooltip, supplied by the renderer. 519 // The text to be shown in the tooltip, supplied by the renderer.
515 base::string16 tooltip_text_; 520 base::string16 tooltip_text_;
516 521
517 // True when this view acts as a platform view hack for a 522 // True when this view acts as a platform view hack for a
518 // RenderWidgetHostViewGuest. 523 // RenderWidgetHostViewGuest.
519 bool is_guest_view_hack_; 524 bool is_guest_view_hack_;
520 525
521 // Selected text on the renderer. 526 // selected text on the renderer.
522 base::string16 selected_text_; 527 std::string selected_text_;
523 528
524 // The window used for popup widgets. 529 // The window used for popup widgets.
525 base::scoped_nsobject<NSWindow> popup_window_; 530 base::scoped_nsobject<NSWindow> popup_window_;
526 531
527 // The fullscreen window used for pepper flash. 532 // The fullscreen window used for pepper flash.
528 base::scoped_nsobject<NSWindow> pepper_fullscreen_window_; 533 base::scoped_nsobject<NSWindow> pepper_fullscreen_window_;
529 base::scoped_nsobject<FullscreenWindowManager> fullscreen_window_manager_; 534 base::scoped_nsobject<FullscreenWindowManager> fullscreen_window_manager_;
530 // Our parent host view, if this is fullscreen. NULL otherwise. 535 // Our parent host view, if this is fullscreen. NULL otherwise.
531 RenderWidgetHostViewMac* fullscreen_parent_host_view_; 536 RenderWidgetHostViewMac* fullscreen_parent_host_view_;
532 537
(...skipping 10 matching lines...) Expand all
543 std::vector<gfx::Rect> composition_bounds_; 548 std::vector<gfx::Rect> composition_bounds_;
544 549
545 // Whether a request for begin frames has been issued. 550 // Whether a request for begin frames has been issued.
546 bool needs_begin_frames_; 551 bool needs_begin_frames_;
547 552
548 // Whether a request to flush input has been issued. 553 // Whether a request to flush input has been issued.
549 bool needs_flush_input_; 554 bool needs_flush_input_;
550 555
551 // TODO(ekaramad): Remove the following locals and get the selection 556 // TODO(ekaramad): Remove the following locals and get the selection
552 // information directly from TextInputManager. 557 // information directly from TextInputManager.
553 // A buffer containing the text inside and around the current selection 558 // A buffer containing the text inside and around the current selection range.
554 // range. This is for text selected in an editable element.
555 base::string16 selection_text_; 559 base::string16 selection_text_;
556 560
557 // The offset of the text stored in |selection_text_| relative to the start of 561 // The offset of the text stored in |selection_text_| relative to the start of
558 // the web page. 562 // the web page.
559 size_t selection_text_offset_; 563 size_t selection_text_offset_;
560 564
561 // The current selection range relative to the start of the web page. 565 // The current selection range relative to the start of the web page.
562 gfx::Range selection_range_; 566 gfx::Range selection_range_;
563 567
564 // Factory used to safely scope delayed calls to ShutdownHost(). 568 // Factory used to safely scope delayed calls to ShutdownHost().
565 base::WeakPtrFactory<RenderWidgetHostViewMac> weak_factory_; 569 base::WeakPtrFactory<RenderWidgetHostViewMac> weak_factory_;
566 570
567 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewMac); 571 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewMac);
568 }; 572 };
569 573
570 } // namespace content 574 } // namespace content
571 575
572 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_ 576 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698