| 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" |
| 30 #include "content/browser/renderer_host/resize_lock.h" |
| 31 #include "content/browser/renderer_host/text_input_manager.h" | 31 #include "content/browser/renderer_host/text_input_manager.h" |
| 32 #include "content/common/content_export.h" | 32 #include "content/common/content_export.h" |
| 33 #include "content/common/cursors/webcursor.h" | 33 #include "content/common/cursors/webcursor.h" |
| 34 #include "content/public/common/context_menu_params.h" | 34 #include "content/public/common/context_menu_params.h" |
| 35 #include "third_party/skia/include/core/SkRegion.h" | 35 #include "third_party/skia/include/core/SkRegion.h" |
| 36 #include "ui/aura/client/cursor_client_observer.h" | 36 #include "ui/aura/client/cursor_client_observer.h" |
| 37 #include "ui/aura/client/focus_change_observer.h" | 37 #include "ui/aura/client/focus_change_observer.h" |
| 38 #include "ui/aura/window_delegate.h" | 38 #include "ui/aura/window_delegate.h" |
| 39 #include "ui/aura/window_tree_host_observer.h" | 39 #include "ui/aura/window_tree_host_observer.h" |
| 40 #include "ui/base/ime/text_input_client.h" | 40 #include "ui/base/ime/text_input_client.h" |
| 41 #include "ui/display/display_observer.h" | 41 #include "ui/display/display_observer.h" |
| 42 #include "ui/gfx/geometry/insets.h" | 42 #include "ui/gfx/geometry/insets.h" |
| 43 #include "ui/gfx/geometry/rect.h" | 43 #include "ui/gfx/geometry/rect.h" |
| 44 #include "ui/gfx/selection_bound.h" | 44 #include "ui/gfx/selection_bound.h" |
| 45 #include "ui/wm/public/activation_delegate.h" | 45 #include "ui/wm/public/activation_delegate.h" |
| 46 #include "ui/wm/public/window_types.h" |
| 46 | 47 |
| 47 namespace aura { | 48 namespace aura { |
| 48 namespace client { | 49 namespace client { |
| 49 class ScopedTooltipDisabler; | 50 class ScopedTooltipDisabler; |
| 50 } | 51 } |
| 51 } | 52 } |
| 52 | 53 |
| 53 namespace gfx { | 54 namespace gfx { |
| 54 class Display; | 55 class Display; |
| 55 class Point; | 56 class Point; |
| 56 class Rect; | 57 class Rect; |
| 57 } | 58 } |
| 58 | 59 |
| 59 namespace ui { | 60 namespace ui { |
| 60 class InputMethod; | 61 class InputMethod; |
| 61 class LocatedEvent; | 62 class LocatedEvent; |
| 62 #if defined(OS_WIN) | 63 #if defined(OS_WIN) |
| 63 class OnScreenKeyboardObserver; | 64 class OnScreenKeyboardObserver; |
| 64 #endif | 65 #endif |
| 65 } | 66 } |
| 66 | 67 |
| 67 namespace content { | 68 namespace content { |
| 68 #if defined(OS_WIN) | 69 #if defined(OS_WIN) |
| 69 class LegacyRenderWidgetHostHWND; | 70 class LegacyRenderWidgetHostHWND; |
| 70 #endif | 71 #endif |
| 71 | 72 |
| 73 class DelegatedFrameHost; |
| 74 class DelegatedFrameHostClient; |
| 72 class RenderFrameHostImpl; | 75 class RenderFrameHostImpl; |
| 73 class RenderWidgetHostImpl; | 76 class RenderWidgetHostImpl; |
| 74 class RenderWidgetHostView; | 77 class RenderWidgetHostView; |
| 75 class TouchSelectionControllerClientAura; | 78 class TouchSelectionControllerClientAura; |
| 76 struct TextInputState; | 79 struct TextInputState; |
| 77 | 80 |
| 78 // RenderWidgetHostView class hierarchy described in render_widget_host_view.h. | 81 // RenderWidgetHostView class hierarchy described in render_widget_host_view.h. |
| 79 class CONTENT_EXPORT RenderWidgetHostViewAura | 82 class CONTENT_EXPORT RenderWidgetHostViewAura |
| 80 : public RenderWidgetHostViewBase, | 83 : public RenderWidgetHostViewBase, |
| 81 NON_EXPORTED_BASE(public RenderWidgetHostViewEventHandler::Delegate), | 84 NON_EXPORTED_BASE(public RenderWidgetHostViewEventHandler::Delegate), |
| 82 public DelegatedFrameHostClient, | |
| 83 public TextInputManager::Observer, | 85 public TextInputManager::Observer, |
| 84 public ui::TextInputClient, | 86 public ui::TextInputClient, |
| 85 public display::DisplayObserver, | 87 public display::DisplayObserver, |
| 86 public aura::WindowTreeHostObserver, | 88 public aura::WindowTreeHostObserver, |
| 87 public aura::WindowDelegate, | 89 public aura::WindowDelegate, |
| 88 public aura::client::ActivationDelegate, | 90 public aura::client::ActivationDelegate, |
| 89 public aura::client::FocusChangeObserver, | 91 public aura::client::FocusChangeObserver, |
| 90 public aura::client::CursorClientObserver, | 92 public aura::client::CursorClientObserver, |
| 91 public cc::BeginFrameObserver { | 93 public cc::BeginFrameObserver { |
| 92 public: | 94 public: |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 ~RenderWidgetHostViewAura() override; | 326 ~RenderWidgetHostViewAura() override; |
| 325 | 327 |
| 326 // Exposed for tests. | 328 // Exposed for tests. |
| 327 aura::Window* window() { return window_; } | 329 aura::Window* window() { return window_; } |
| 328 | 330 |
| 329 DelegatedFrameHost* GetDelegatedFrameHost() const { | 331 DelegatedFrameHost* GetDelegatedFrameHost() const { |
| 330 return delegated_frame_host_.get(); | 332 return delegated_frame_host_.get(); |
| 331 } | 333 } |
| 332 | 334 |
| 333 private: | 335 private: |
| 336 friend class DelegatedFrameHostClientAura; |
| 334 friend class InputMethodAuraTestBase; | 337 friend class InputMethodAuraTestBase; |
| 338 friend class RenderWidgetHostViewAuraTest; |
| 335 friend class RenderWidgetHostViewAuraCopyRequestTest; | 339 friend class RenderWidgetHostViewAuraCopyRequestTest; |
| 336 friend class TestInputMethodObserver; | 340 friend class TestInputMethodObserver; |
| 337 FRIEND_TEST_ALL_PREFIXES(InputMethodResultAuraTest, | 341 FRIEND_TEST_ALL_PREFIXES(InputMethodResultAuraTest, |
| 338 FinishImeCompositionSession); | 342 FinishImeCompositionSession); |
| 339 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, | 343 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, |
| 340 PopupRetainsCaptureAfterMouseRelease); | 344 PopupRetainsCaptureAfterMouseRelease); |
| 341 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, SetCompositionText); | 345 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, SetCompositionText); |
| 342 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, TouchEventState); | 346 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, TouchEventState); |
| 343 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, | 347 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, |
| 344 TouchEventPositionsArentRounded); | 348 TouchEventPositionsArentRounded); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 364 FinishCompositionByMouse); | 368 FinishCompositionByMouse); |
| 365 FRIEND_TEST_ALL_PREFIXES(WebContentsViewAuraTest, | 369 FRIEND_TEST_ALL_PREFIXES(WebContentsViewAuraTest, |
| 366 WebContentsViewReparent); | 370 WebContentsViewReparent); |
| 367 | 371 |
| 368 class WindowObserver; | 372 class WindowObserver; |
| 369 friend class WindowObserver; | 373 friend class WindowObserver; |
| 370 | 374 |
| 371 class WindowAncestorObserver; | 375 class WindowAncestorObserver; |
| 372 friend class WindowAncestorObserver; | 376 friend class WindowAncestorObserver; |
| 373 | 377 |
| 374 void CreateAuraWindow(); | 378 void CreateAuraWindow(ui::wm::WindowType type); |
| 379 |
| 380 void CreateDelegatedFrameHostClient(); |
| 375 | 381 |
| 376 void UpdateCursorIfOverSelf(); | 382 void UpdateCursorIfOverSelf(); |
| 377 | 383 |
| 378 // Tracks whether SnapToPhysicalPixelBoundary() has been called. | 384 // Tracks whether SnapToPhysicalPixelBoundary() has been called. |
| 379 bool has_snapped_to_boundary() { return has_snapped_to_boundary_; } | 385 bool has_snapped_to_boundary() { return has_snapped_to_boundary_; } |
| 380 void ResetHasSnappedToBoundary() { has_snapped_to_boundary_ = false; } | 386 void ResetHasSnappedToBoundary() { has_snapped_to_boundary_ = false; } |
| 381 | 387 |
| 382 // Set the bounds of the window and handle size changes. Assumes the caller | 388 // 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 | 389 // has already adjusted the origin of |rect| to conform to whatever coordinate |
| 384 // space is required by the aura::Window. | 390 // 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 | 411 // If |clip| is non-empty and and doesn't contain |rect| or |clip| is empty |
| 406 // SchedulePaint() is invoked for |rect|. | 412 // SchedulePaint() is invoked for |rect|. |
| 407 void SchedulePaintIfNotInClip(const gfx::Rect& rect, const gfx::Rect& clip); | 413 void SchedulePaintIfNotInClip(const gfx::Rect& rect, const gfx::Rect& clip); |
| 408 | 414 |
| 409 // Called after |window_| is parented to a WindowEventDispatcher. | 415 // Called after |window_| is parented to a WindowEventDispatcher. |
| 410 void AddedToRootWindow(); | 416 void AddedToRootWindow(); |
| 411 | 417 |
| 412 // Called prior to removing |window_| from a WindowEventDispatcher. | 418 // Called prior to removing |window_| from a WindowEventDispatcher. |
| 413 void RemovingFromRootWindow(); | 419 void RemovingFromRootWindow(); |
| 414 | 420 |
| 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. | 421 // TextInputManager::Observer implementation. |
| 432 void OnUpdateTextInputStateCalled(TextInputManager* text_input_manager, | 422 void OnUpdateTextInputStateCalled(TextInputManager* text_input_manager, |
| 433 RenderWidgetHostViewBase* updated_view, | 423 RenderWidgetHostViewBase* updated_view, |
| 434 bool did_update_state) override; | 424 bool did_update_state) override; |
| 435 void OnImeCancelComposition(TextInputManager* text_input_manager, | 425 void OnImeCancelComposition(TextInputManager* text_input_manager, |
| 436 RenderWidgetHostViewBase* updated_view) override; | 426 RenderWidgetHostViewBase* updated_view) override; |
| 437 void OnSelectionBoundsChanged( | 427 void OnSelectionBoundsChanged( |
| 438 TextInputManager* text_input_manager, | 428 TextInputManager* text_input_manager, |
| 439 RenderWidgetHostViewBase* updated_view) override; | 429 RenderWidgetHostViewBase* updated_view) override; |
| 440 void OnTextSelectionChanged(TextInputManager* text_input_mangager, | 430 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); | 469 void ForwardMouseEventToParent(ui::MouseEvent* event); |
| 480 | 470 |
| 481 // Adds/Removes frame observer based on state. | 471 // Adds/Removes frame observer based on state. |
| 482 void UpdateNeedsBeginFramesInternal(); | 472 void UpdateNeedsBeginFramesInternal(); |
| 483 | 473 |
| 484 // The model object. | 474 // The model object. |
| 485 RenderWidgetHostImpl* const host_; | 475 RenderWidgetHostImpl* const host_; |
| 486 | 476 |
| 487 aura::Window* window_; | 477 aura::Window* window_; |
| 488 | 478 |
| 479 std::unique_ptr<DelegatedFrameHostClient> delegated_frame_host_client_; |
| 480 // NOTE: this may be null. |
| 489 std::unique_ptr<DelegatedFrameHost> delegated_frame_host_; | 481 std::unique_ptr<DelegatedFrameHost> delegated_frame_host_; |
| 490 | 482 |
| 491 std::unique_ptr<WindowObserver> window_observer_; | 483 std::unique_ptr<WindowObserver> window_observer_; |
| 492 | 484 |
| 493 // Tracks the ancestors of the RWHVA window for window location changes. | 485 // Tracks the ancestors of the RWHVA window for window location changes. |
| 494 std::unique_ptr<WindowAncestorObserver> ancestor_window_observer_; | 486 std::unique_ptr<WindowAncestorObserver> ancestor_window_observer_; |
| 495 | 487 |
| 496 // Are we in the process of closing? Tracked so fullscreen views can avoid | 488 // 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 | 489 // sending a second shutdown request to the host when they lose the focus |
| 498 // after requesting shutdown for another reason (e.g. Escape key). | 490 // 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_; | 591 std::unique_ptr<RenderWidgetHostViewEventHandler> event_handler_; |
| 600 | 592 |
| 601 base::WeakPtrFactory<RenderWidgetHostViewAura> weak_ptr_factory_; | 593 base::WeakPtrFactory<RenderWidgetHostViewAura> weak_ptr_factory_; |
| 602 | 594 |
| 603 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAura); | 595 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAura); |
| 604 }; | 596 }; |
| 605 | 597 |
| 606 } // namespace content | 598 } // namespace content |
| 607 | 599 |
| 608 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_ | 600 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_ |
| OLD | NEW |