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> |
11 #include <stdint.h> | 11 #include <stdint.h> |
12 | 12 |
13 #include <list> | 13 #include <list> |
14 #include <map> | 14 #include <map> |
15 #include <memory> | 15 #include <memory> |
16 #include <set> | 16 #include <set> |
17 #include <string> | 17 #include <string> |
18 #include <utility> | 18 #include <utility> |
19 #include <vector> | 19 #include <vector> |
20 | 20 |
21 #include "base/mac/scoped_nsobject.h" | 21 #include "base/mac/scoped_nsobject.h" |
22 #include "base/macros.h" | 22 #include "base/macros.h" |
23 #include "base/memory/weak_ptr.h" | 23 #include "base/memory/weak_ptr.h" |
24 #include "base/time/time.h" | 24 #include "base/time/time.h" |
25 #include "cc/surfaces/surface_id.h" | 25 #include "cc/surfaces/surface_id.h" |
26 #include "content/browser/renderer_host/browser_compositor_view_mac.h" | 26 #include "content/browser/renderer_host/browser_compositor_view_mac.h" |
27 #include "content/browser/renderer_host/input/mouse_wheel_rails_filter_mac.h" | 27 #include "content/browser/renderer_host/input/mouse_wheel_rails_filter_mac.h" |
28 #include "content/browser/renderer_host/mouse_wheel_phase_handler.h" | |
28 #include "content/browser/renderer_host/render_widget_host_view_base.h" | 29 #include "content/browser/renderer_host/render_widget_host_view_base.h" |
29 #include "content/browser/renderer_host/text_input_manager.h" | 30 #include "content/browser/renderer_host/text_input_manager.h" |
30 #include "content/common/content_export.h" | 31 #include "content/common/content_export.h" |
31 #include "content/common/cursors/webcursor.h" | 32 #include "content/common/cursors/webcursor.h" |
32 #include "content/common/edit_command.h" | 33 #include "content/common/edit_command.h" |
33 #include "ipc/ipc_sender.h" | 34 #include "ipc/ipc_sender.h" |
34 #include "third_party/WebKit/public/web/WebCompositionUnderline.h" | 35 #include "third_party/WebKit/public/web/WebCompositionUnderline.h" |
35 #include "ui/accelerated_widget_mac/accelerated_widget_mac.h" | 36 #include "ui/accelerated_widget_mac/accelerated_widget_mac.h" |
36 #include "ui/accelerated_widget_mac/display_link_mac.h" | 37 #include "ui/accelerated_widget_mac/display_link_mac.h" |
37 #import "ui/base/cocoa/command_dispatcher.h" | 38 #import "ui/base/cocoa/command_dispatcher.h" |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
405 // the conversion failed, return gfx::Range::InvalidRange. | 406 // the conversion failed, return gfx::Range::InvalidRange. |
406 gfx::Range ConvertCharacterRangeToCompositionRange( | 407 gfx::Range ConvertCharacterRangeToCompositionRange( |
407 const gfx::Range& request_range); | 408 const gfx::Range& request_range); |
408 | 409 |
409 WebContents* GetWebContents(); | 410 WebContents* GetWebContents(); |
410 | 411 |
411 // Applies background color without notifying the RenderWidget about | 412 // Applies background color without notifying the RenderWidget about |
412 // opaqueness changes. | 413 // opaqueness changes. |
413 void UpdateBackgroundColorFromRenderer(SkColor color); | 414 void UpdateBackgroundColorFromRenderer(SkColor color); |
414 | 415 |
416 bool HasPendingWheelEndEventForTesting() { | |
417 return mouse_wheel_phase_handler_->HasPendingWheelEndEvent(); | |
418 } | |
419 | |
415 // These member variables should be private, but the associated ObjC class | 420 // These member variables should be private, but the associated ObjC class |
416 // needs access to them and can't be made a friend. | 421 // needs access to them and can't be made a friend. |
417 | 422 |
418 // The associated Model. Can be NULL if Destroy() is called when | 423 // The associated Model. Can be NULL if Destroy() is called when |
419 // someone (other than superview) has retained |cocoa_view_|. | 424 // someone (other than superview) has retained |cocoa_view_|. |
420 RenderWidgetHostImpl* render_widget_host_; | 425 RenderWidgetHostImpl* render_widget_host_; |
421 | 426 |
422 // The background CoreAnimation layer which is hosted by |cocoa_view_|. | 427 // The background CoreAnimation layer which is hosted by |cocoa_view_|. |
423 base::scoped_nsobject<CALayer> background_layer_; | 428 base::scoped_nsobject<CALayer> background_layer_; |
424 | 429 |
425 // Delegated frame management and compositor interface. | 430 // Delegated frame management and compositor interface. |
426 std::unique_ptr<BrowserCompositorMac> browser_compositor_; | 431 std::unique_ptr<BrowserCompositorMac> browser_compositor_; |
427 | 432 |
428 // Set when the currently-displayed frame is the minimum scale. Used to | 433 // Set when the currently-displayed frame is the minimum scale. Used to |
429 // determine if pinch gestures need to be thresholded. | 434 // determine if pinch gestures need to be thresholded. |
430 bool page_at_minimum_scale_; | 435 bool page_at_minimum_scale_; |
431 | 436 |
437 std::unique_ptr<MouseWheelPhaseHandler> mouse_wheel_phase_handler_; | |
tdresser
2017/06/05 15:19:08
Why a unique_ptr?
sahel
2017/06/05 19:05:43
Done.
| |
438 | |
432 NSWindow* pepper_fullscreen_window() const { | 439 NSWindow* pepper_fullscreen_window() const { |
433 return pepper_fullscreen_window_; | 440 return pepper_fullscreen_window_; |
434 } | 441 } |
435 | 442 |
436 CONTENT_EXPORT void release_pepper_fullscreen_window_for_testing(); | 443 CONTENT_EXPORT void release_pepper_fullscreen_window_for_testing(); |
437 | 444 |
438 RenderWidgetHostViewMac* fullscreen_parent_host_view() const { | 445 RenderWidgetHostViewMac* fullscreen_parent_host_view() const { |
439 return fullscreen_parent_host_view_; | 446 return fullscreen_parent_host_view_; |
440 } | 447 } |
441 | 448 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
479 | 486 |
480 // Returns the TextSelection information for the active widget. If | 487 // Returns the TextSelection information for the active widget. If |
481 // |is_guest_view_hack_| is true, then it will return the TextSelection | 488 // |is_guest_view_hack_| is true, then it will return the TextSelection |
482 // information for this RenderWidgetHostViewMac (which is serving as a | 489 // information for this RenderWidgetHostViewMac (which is serving as a |
483 // platform view for a guest). | 490 // platform view for a guest). |
484 const TextInputManager::TextSelection* GetTextSelection(); | 491 const TextInputManager::TextSelection* GetTextSelection(); |
485 | 492 |
486 // Get the focused view that should be used for retrieving the text selection. | 493 // Get the focused view that should be used for retrieving the text selection. |
487 RenderWidgetHostViewBase* GetFocusedViewForTextSelection(); | 494 RenderWidgetHostViewBase* GetFocusedViewForTextSelection(); |
488 | 495 |
489 void ScheduleMouseWheelEndDispatching(blink::WebMouseWheelEvent wheel_event, | |
490 bool should_route_event); | |
491 void DispatchPendingWheelEndEvent(); | |
492 void IgnorePendingWheelEndEvent(); | |
493 bool HasPendingWheelEndEvent(); | |
494 | |
495 // Returns the RenderWidgetHostDelegate corresponding to the currently focused | 496 // Returns the RenderWidgetHostDelegate corresponding to the currently focused |
496 // RenderWidgetHost. It is different from |render_widget_host_->delegate()| | 497 // RenderWidgetHost. It is different from |render_widget_host_->delegate()| |
497 // when there are focused inner WebContentses on the page. Also, this method | 498 // when there are focused inner WebContentses on the page. Also, this method |
498 // can return nullptr; for instance when |render_widget_host_| becomes nullptr | 499 // can return nullptr; for instance when |render_widget_host_| becomes nullptr |
499 // in the destruction path of the WebContentsImpl. | 500 // in the destruction path of the WebContentsImpl. |
500 RenderWidgetHostDelegate* GetFocusedRenderWidgetHostDelegate(); | 501 RenderWidgetHostDelegate* GetFocusedRenderWidgetHostDelegate(); |
501 | 502 |
502 private: | 503 private: |
503 friend class RenderWidgetHostViewMacTest; | 504 friend class RenderWidgetHostViewMacTest; |
504 | 505 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
567 bool needs_begin_frames_; | 568 bool needs_begin_frames_; |
568 | 569 |
569 // Whether a request to flush input has been issued. | 570 // Whether a request to flush input has been issued. |
570 bool needs_flush_input_; | 571 bool needs_flush_input_; |
571 | 572 |
572 // The background color of the web content. This color will be drawn when the | 573 // The background color of the web content. This color will be drawn when the |
573 // web content is not able to draw in time. | 574 // web content is not able to draw in time. |
574 SkColor background_color_ = SK_ColorTRANSPARENT; | 575 SkColor background_color_ = SK_ColorTRANSPARENT; |
575 SkColor last_frame_root_background_color_ = SK_ColorTRANSPARENT; | 576 SkColor last_frame_root_background_color_ = SK_ColorTRANSPARENT; |
576 | 577 |
577 base::OneShotTimer mouse_wheel_end_dispatch_timer_; | |
578 | |
579 // Factory used to safely scope delayed calls to ShutdownHost(). | 578 // Factory used to safely scope delayed calls to ShutdownHost(). |
580 base::WeakPtrFactory<RenderWidgetHostViewMac> weak_factory_; | 579 base::WeakPtrFactory<RenderWidgetHostViewMac> weak_factory_; |
581 | 580 |
582 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewMac); | 581 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewMac); |
583 }; | 582 }; |
584 | 583 |
585 } // namespace content | 584 } // namespace content |
586 | 585 |
587 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_ | 586 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_ |
OLD | NEW |