| 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_AURA_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include <map> | 11 #include <map> |
| 12 #include <memory> | 12 #include <memory> |
| 13 #include <set> | 13 #include <set> |
| 14 #include <string> | 14 #include <string> |
| 15 #include <vector> | 15 #include <vector> |
| 16 | 16 |
| 17 #include "base/callback.h" | 17 #include "base/callback.h" |
| 18 #include "base/compiler_specific.h" | 18 #include "base/compiler_specific.h" |
| 19 #include "base/gtest_prod_util.h" | 19 #include "base/gtest_prod_util.h" |
| 20 #include "base/macros.h" | 20 #include "base/macros.h" |
| 21 #include "base/memory/ref_counted.h" | 21 #include "base/memory/ref_counted.h" |
| 22 #include "base/memory/weak_ptr.h" | 22 #include "base/memory/weak_ptr.h" |
| 23 #include "build/build_config.h" | 23 #include "build/build_config.h" |
| 24 #include "cc/scheduler/begin_frame_source.h" | 24 #include "cc/scheduler/begin_frame_source.h" |
| 25 #include "content/browser/accessibility/browser_accessibility_manager.h" | 25 #include "content/browser/accessibility/browser_accessibility_manager.h" |
| 26 #include "content/browser/compositor/image_transport_factory.h" | 26 #include "content/browser/compositor/image_transport_factory.h" |
| 27 #include "content/browser/compositor/owned_mailbox.h" | 27 #include "content/browser/compositor/owned_mailbox.h" |
| 28 #include "content/browser/renderer_host/delegated_frame_host.h" | |
| 29 #include "content/browser/renderer_host/render_widget_host_view_base.h" | 28 #include "content/browser/renderer_host/render_widget_host_view_base.h" |
| 30 #include "content/browser/renderer_host/render_widget_host_view_event_handler.h" | 29 #include "content/browser/renderer_host/render_widget_host_view_event_handler.h" |
| 31 #include "content/browser/renderer_host/text_input_manager.h" | 30 #include "content/browser/renderer_host/text_input_manager.h" |
| 32 #include "content/common/content_export.h" | 31 #include "content/common/content_export.h" |
| 33 #include "content/common/cursors/webcursor.h" | 32 #include "content/common/cursors/webcursor.h" |
| 34 #include "content/public/common/context_menu_params.h" | 33 #include "content/public/common/context_menu_params.h" |
| 35 #include "third_party/skia/include/core/SkRegion.h" | 34 #include "third_party/skia/include/core/SkRegion.h" |
| 36 #include "ui/aura/client/cursor_client_observer.h" | 35 #include "ui/aura/client/cursor_client_observer.h" |
| 37 #include "ui/aura/client/focus_change_observer.h" | 36 #include "ui/aura/client/focus_change_observer.h" |
| 38 #include "ui/aura/window_delegate.h" | 37 #include "ui/aura/window_delegate.h" |
| 39 #include "ui/aura/window_tree_host_observer.h" | 38 #include "ui/aura/window_tree_host_observer.h" |
| 40 #include "ui/base/ime/text_input_client.h" | 39 #include "ui/base/ime/text_input_client.h" |
| 41 #include "ui/display/display_observer.h" | 40 #include "ui/display/display_observer.h" |
| 42 #include "ui/gfx/geometry/insets.h" | 41 #include "ui/gfx/geometry/insets.h" |
| 43 #include "ui/gfx/geometry/rect.h" | 42 #include "ui/gfx/geometry/rect.h" |
| 44 #include "ui/gfx/selection_bound.h" | 43 #include "ui/gfx/selection_bound.h" |
| 45 #include "ui/wm/public/activation_delegate.h" | 44 #include "ui/wm/public/activation_delegate.h" |
| 45 #include "ui/wm/public/window_types.h" |
| 46 | 46 |
| 47 namespace aura { | 47 namespace aura { |
| 48 namespace client { | 48 namespace client { |
| 49 class ScopedTooltipDisabler; | 49 class ScopedTooltipDisabler; |
| 50 } | 50 } |
| 51 } | 51 } |
| 52 | 52 |
| 53 namespace gfx { | 53 namespace gfx { |
| 54 class Display; | 54 class Display; |
| 55 class Point; | 55 class Point; |
| 56 class Rect; | 56 class Rect; |
| 57 } | 57 } |
| 58 | 58 |
| 59 namespace ui { | 59 namespace ui { |
| 60 class InputMethod; | 60 class InputMethod; |
| 61 class LocatedEvent; | 61 class LocatedEvent; |
| 62 #if defined(OS_WIN) | 62 #if defined(OS_WIN) |
| 63 class OnScreenKeyboardObserver; | 63 class OnScreenKeyboardObserver; |
| 64 #endif | 64 #endif |
| 65 } | 65 } |
| 66 | 66 |
| 67 namespace content { | 67 namespace content { |
| 68 #if defined(OS_WIN) | 68 #if defined(OS_WIN) |
| 69 class LegacyRenderWidgetHostHWND; | 69 class LegacyRenderWidgetHostHWND; |
| 70 #endif | 70 #endif |
| 71 | 71 |
| 72 class DelegatedFrameHost; |
| 72 class RenderFrameHostImpl; | 73 class RenderFrameHostImpl; |
| 73 class RenderWidgetHostImpl; | 74 class RenderWidgetHostImpl; |
| 74 class RenderWidgetHostView; | 75 class RenderWidgetHostView; |
| 75 class TouchSelectionControllerClientAura; | 76 class TouchSelectionControllerClientAura; |
| 76 struct TextInputState; | 77 struct TextInputState; |
| 77 | 78 |
| 78 // RenderWidgetHostView class hierarchy described in render_widget_host_view.h. | 79 // RenderWidgetHostView class hierarchy described in render_widget_host_view.h. |
| 79 class CONTENT_EXPORT RenderWidgetHostViewAura | 80 class CONTENT_EXPORT RenderWidgetHostViewAura |
| 80 : public RenderWidgetHostViewBase, | 81 : public RenderWidgetHostViewBase, |
| 81 NON_EXPORTED_BASE(public RenderWidgetHostViewEventHandler::Delegate), | 82 NON_EXPORTED_BASE(public RenderWidgetHostViewEventHandler::Delegate), |
| 82 public DelegatedFrameHostClient, | |
| 83 public TextInputManager::Observer, | 83 public TextInputManager::Observer, |
| 84 public ui::TextInputClient, | 84 public ui::TextInputClient, |
| 85 public display::DisplayObserver, | 85 public display::DisplayObserver, |
| 86 public aura::WindowTreeHostObserver, | 86 public aura::WindowTreeHostObserver, |
| 87 public aura::WindowDelegate, | 87 public aura::WindowDelegate, |
| 88 public aura::client::ActivationDelegate, | 88 public aura::client::ActivationDelegate, |
| 89 public aura::client::FocusChangeObserver, | 89 public aura::client::FocusChangeObserver, |
| 90 public aura::client::CursorClientObserver, | 90 public aura::client::CursorClientObserver, |
| 91 public cc::BeginFrameObserver { | 91 public cc::BeginFrameObserver { |
| 92 public: | 92 public: |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 UpdateCursorIfOverSelf); | 358 UpdateCursorIfOverSelf); |
| 359 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, | 359 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, |
| 360 VisibleViewportTest); | 360 VisibleViewportTest); |
| 361 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, | 361 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, |
| 362 OverscrollResetsOnBlur); | 362 OverscrollResetsOnBlur); |
| 363 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, | 363 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, |
| 364 FinishCompositionByMouse); | 364 FinishCompositionByMouse); |
| 365 FRIEND_TEST_ALL_PREFIXES(WebContentsViewAuraTest, | 365 FRIEND_TEST_ALL_PREFIXES(WebContentsViewAuraTest, |
| 366 WebContentsViewReparent); | 366 WebContentsViewReparent); |
| 367 | 367 |
| 368 class DelegatedFrameHostClientImpl; |
| 369 |
| 368 class WindowObserver; | 370 class WindowObserver; |
| 369 friend class WindowObserver; | 371 friend class WindowObserver; |
| 370 | 372 |
| 371 class WindowAncestorObserver; | 373 class WindowAncestorObserver; |
| 372 friend class WindowAncestorObserver; | 374 friend class WindowAncestorObserver; |
| 373 | 375 |
| 374 void CreateAuraWindow(); | 376 void CreateAuraWindow(ui::wm::WindowType type); |
| 375 | 377 |
| 376 void UpdateCursorIfOverSelf(); | 378 void UpdateCursorIfOverSelf(); |
| 377 | 379 |
| 378 // Tracks whether SnapToPhysicalPixelBoundary() has been called. | 380 // Tracks whether SnapToPhysicalPixelBoundary() has been called. |
| 379 bool has_snapped_to_boundary() { return has_snapped_to_boundary_; } | 381 bool has_snapped_to_boundary() { return has_snapped_to_boundary_; } |
| 380 void ResetHasSnappedToBoundary() { has_snapped_to_boundary_ = false; } | 382 void ResetHasSnappedToBoundary() { has_snapped_to_boundary_ = false; } |
| 381 | 383 |
| 382 // Set the bounds of the window and handle size changes. Assumes the caller | 384 // Set the bounds of the window and handle size changes. Assumes the caller |
| 383 // has already adjusted the origin of |rect| to conform to whatever coordinate | 385 // has already adjusted the origin of |rect| to conform to whatever coordinate |
| 384 // space is required by the aura::Window. | 386 // space is required by the aura::Window. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 405 // If |clip| is non-empty and and doesn't contain |rect| or |clip| is empty | 407 // If |clip| is non-empty and and doesn't contain |rect| or |clip| is empty |
| 406 // SchedulePaint() is invoked for |rect|. | 408 // SchedulePaint() is invoked for |rect|. |
| 407 void SchedulePaintIfNotInClip(const gfx::Rect& rect, const gfx::Rect& clip); | 409 void SchedulePaintIfNotInClip(const gfx::Rect& rect, const gfx::Rect& clip); |
| 408 | 410 |
| 409 // Called after |window_| is parented to a WindowEventDispatcher. | 411 // Called after |window_| is parented to a WindowEventDispatcher. |
| 410 void AddedToRootWindow(); | 412 void AddedToRootWindow(); |
| 411 | 413 |
| 412 // Called prior to removing |window_| from a WindowEventDispatcher. | 414 // Called prior to removing |window_| from a WindowEventDispatcher. |
| 413 void RemovingFromRootWindow(); | 415 void RemovingFromRootWindow(); |
| 414 | 416 |
| 415 // DelegatedFrameHostClient implementation. | |
| 416 ui::Layer* DelegatedFrameHostGetLayer() const override; | |
| 417 bool DelegatedFrameHostIsVisible() const override; | |
| 418 SkColor DelegatedFrameHostGetGutterColor(SkColor color) const override; | |
| 419 gfx::Size DelegatedFrameHostDesiredSizeInDIP() const override; | |
| 420 bool DelegatedFrameCanCreateResizeLock() const override; | |
| 421 std::unique_ptr<ResizeLock> DelegatedFrameHostCreateResizeLock( | |
| 422 bool defer_compositor_lock) override; | |
| 423 void DelegatedFrameHostResizeLockWasReleased() override; | |
| 424 void DelegatedFrameHostSendReclaimCompositorResources( | |
| 425 int compositor_frame_sink_id, | |
| 426 bool is_swap_ack, | |
| 427 const cc::ReturnedResourceArray& resources) override; | |
| 428 void SetBeginFrameSource(cc::BeginFrameSource* source) override; | |
| 429 bool IsAutoResizeEnabled() const override; | |
| 430 | |
| 431 // TextInputManager::Observer implementation. | 417 // TextInputManager::Observer implementation. |
| 432 void OnUpdateTextInputStateCalled(TextInputManager* text_input_manager, | 418 void OnUpdateTextInputStateCalled(TextInputManager* text_input_manager, |
| 433 RenderWidgetHostViewBase* updated_view, | 419 RenderWidgetHostViewBase* updated_view, |
| 434 bool did_update_state) override; | 420 bool did_update_state) override; |
| 435 void OnImeCancelComposition(TextInputManager* text_input_manager, | 421 void OnImeCancelComposition(TextInputManager* text_input_manager, |
| 436 RenderWidgetHostViewBase* updated_view) override; | 422 RenderWidgetHostViewBase* updated_view) override; |
| 437 void OnSelectionBoundsChanged( | 423 void OnSelectionBoundsChanged( |
| 438 TextInputManager* text_input_manager, | 424 TextInputManager* text_input_manager, |
| 439 RenderWidgetHostViewBase* updated_view) override; | 425 RenderWidgetHostViewBase* updated_view) override; |
| 440 void OnTextSelectionChanged(TextInputManager* text_input_mangager, | 426 void OnTextSelectionChanged(TextInputManager* text_input_mangager, |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 479 void ForwardMouseEventToParent(ui::MouseEvent* event); | 465 void ForwardMouseEventToParent(ui::MouseEvent* event); |
| 480 | 466 |
| 481 // Adds/Removes frame observer based on state. | 467 // Adds/Removes frame observer based on state. |
| 482 void UpdateNeedsBeginFramesInternal(); | 468 void UpdateNeedsBeginFramesInternal(); |
| 483 | 469 |
| 484 // The model object. | 470 // The model object. |
| 485 RenderWidgetHostImpl* const host_; | 471 RenderWidgetHostImpl* const host_; |
| 486 | 472 |
| 487 aura::Window* window_; | 473 aura::Window* window_; |
| 488 | 474 |
| 475 std::unique_ptr<DelegatedFrameHostClientImpl> delegated_frame_host_client_; |
| 476 // NOTE: this may be null. |
| 489 std::unique_ptr<DelegatedFrameHost> delegated_frame_host_; | 477 std::unique_ptr<DelegatedFrameHost> delegated_frame_host_; |
| 490 | 478 |
| 491 std::unique_ptr<WindowObserver> window_observer_; | 479 std::unique_ptr<WindowObserver> window_observer_; |
| 492 | 480 |
| 493 // Tracks the ancestors of the RWHVA window for window location changes. | 481 // Tracks the ancestors of the RWHVA window for window location changes. |
| 494 std::unique_ptr<WindowAncestorObserver> ancestor_window_observer_; | 482 std::unique_ptr<WindowAncestorObserver> ancestor_window_observer_; |
| 495 | 483 |
| 496 // Are we in the process of closing? Tracked so fullscreen views can avoid | 484 // Are we in the process of closing? Tracked so fullscreen views can avoid |
| 497 // sending a second shutdown request to the host when they lose the focus | 485 // sending a second shutdown request to the host when they lose the focus |
| 498 // after requesting shutdown for another reason (e.g. Escape key). | 486 // after requesting shutdown for another reason (e.g. Escape key). |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 599 std::unique_ptr<RenderWidgetHostViewEventHandler> event_handler_; | 587 std::unique_ptr<RenderWidgetHostViewEventHandler> event_handler_; |
| 600 | 588 |
| 601 base::WeakPtrFactory<RenderWidgetHostViewAura> weak_ptr_factory_; | 589 base::WeakPtrFactory<RenderWidgetHostViewAura> weak_ptr_factory_; |
| 602 | 590 |
| 603 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAura); | 591 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAura); |
| 604 }; | 592 }; |
| 605 | 593 |
| 606 } // namespace content | 594 } // namespace content |
| 607 | 595 |
| 608 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_ | 596 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_ |
| OLD | NEW |