| 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/gtest_prod_util.h" | 18 #include "base/gtest_prod_util.h" |
| 19 #include "base/macros.h" | 19 #include "base/macros.h" |
| 20 #include "base/memory/linked_ptr.h" | 20 #include "base/memory/linked_ptr.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" | 28 #include "content/browser/renderer_host/delegated_frame_host.h" |
| 29 #include "content/browser/renderer_host/render_widget_host_view_base.h" | 29 #include "content/browser/renderer_host/render_widget_host_view_base.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/public/common/context_menu_params.h" | 33 #include "content/public/common/context_menu_params.h" |
| 33 #include "third_party/skia/include/core/SkRegion.h" | 34 #include "third_party/skia/include/core/SkRegion.h" |
| 34 #include "ui/aura/client/cursor_client_observer.h" | 35 #include "ui/aura/client/cursor_client_observer.h" |
| 35 #include "ui/aura/client/focus_change_observer.h" | 36 #include "ui/aura/client/focus_change_observer.h" |
| 36 #include "ui/aura/window_delegate.h" | 37 #include "ui/aura/window_delegate.h" |
| 37 #include "ui/aura/window_tracker.h" | 38 #include "ui/aura/window_tracker.h" |
| 38 #include "ui/aura/window_tree_host_observer.h" | 39 #include "ui/aura/window_tree_host_observer.h" |
| 39 #include "ui/base/ime/text_input_client.h" | 40 #include "ui/base/ime/text_input_client.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 class RenderFrameHostImpl; | 84 class RenderFrameHostImpl; |
| 84 class RenderViewHostDelegateView; | 85 class RenderViewHostDelegateView; |
| 85 class RenderWidgetHostImpl; | 86 class RenderWidgetHostImpl; |
| 86 class RenderWidgetHostView; | 87 class RenderWidgetHostView; |
| 87 class TouchSelectionControllerClientAura; | 88 class TouchSelectionControllerClientAura; |
| 88 struct TextInputState; | 89 struct TextInputState; |
| 89 | 90 |
| 90 // RenderWidgetHostView class hierarchy described in render_widget_host_view.h. | 91 // RenderWidgetHostView class hierarchy described in render_widget_host_view.h. |
| 91 class CONTENT_EXPORT RenderWidgetHostViewAura | 92 class CONTENT_EXPORT RenderWidgetHostViewAura |
| 92 : public RenderWidgetHostViewBase, | 93 : public RenderWidgetHostViewBase, |
| 94 public TextInputManager::Observer, |
| 93 public DelegatedFrameHostClient, | 95 public DelegatedFrameHostClient, |
| 94 public ui::TextInputClient, | 96 public ui::TextInputClient, |
| 95 public display::DisplayObserver, | 97 public display::DisplayObserver, |
| 96 public aura::WindowTreeHostObserver, | 98 public aura::WindowTreeHostObserver, |
| 97 public aura::WindowDelegate, | 99 public aura::WindowDelegate, |
| 98 public aura::client::ActivationDelegate, | 100 public aura::client::ActivationDelegate, |
| 99 public aura::client::FocusChangeObserver, | 101 public aura::client::FocusChangeObserver, |
| 100 public aura::client::CursorClientObserver, | 102 public aura::client::CursorClientObserver, |
| 101 public cc::BeginFrameObserver { | 103 public cc::BeginFrameObserver { |
| 102 public: | 104 public: |
| (...skipping 24 matching lines...) Expand all Loading... |
| 127 gfx::Size GetVisibleViewportSize() const override; | 129 gfx::Size GetVisibleViewportSize() const override; |
| 128 void SetInsets(const gfx::Insets& insets) override; | 130 void SetInsets(const gfx::Insets& insets) override; |
| 129 | 131 |
| 130 // Overridden from RenderWidgetHostViewBase: | 132 // Overridden from RenderWidgetHostViewBase: |
| 131 void InitAsPopup(RenderWidgetHostView* parent_host_view, | 133 void InitAsPopup(RenderWidgetHostView* parent_host_view, |
| 132 const gfx::Rect& pos) override; | 134 const gfx::Rect& pos) override; |
| 133 void InitAsFullscreen(RenderWidgetHostView* reference_host_view) override; | 135 void InitAsFullscreen(RenderWidgetHostView* reference_host_view) override; |
| 134 void Focus() override; | 136 void Focus() override; |
| 135 void UpdateCursor(const WebCursor& cursor) override; | 137 void UpdateCursor(const WebCursor& cursor) override; |
| 136 void SetIsLoading(bool is_loading) override; | 138 void SetIsLoading(bool is_loading) override; |
| 137 void TextInputStateChanged(const TextInputState& params) override; | |
| 138 void ImeCancelComposition() override; | 139 void ImeCancelComposition() override; |
| 139 void ImeCompositionRangeChanged( | 140 void ImeCompositionRangeChanged( |
| 140 const gfx::Range& range, | 141 const gfx::Range& range, |
| 141 const std::vector<gfx::Rect>& character_bounds) override; | 142 const std::vector<gfx::Rect>& character_bounds) override; |
| 142 void RenderProcessGone(base::TerminationStatus status, | 143 void RenderProcessGone(base::TerminationStatus status, |
| 143 int error_code) override; | 144 int error_code) override; |
| 144 void Destroy() override; | 145 void Destroy() override; |
| 145 void SetTooltipText(const base::string16& tooltip_text) override; | 146 void SetTooltipText(const base::string16& tooltip_text) override; |
| 146 void SelectionChanged(const base::string16& text, | 147 void SelectionChanged(const base::string16& text, |
| 147 size_t offset, | 148 size_t offset, |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 aura::Window* window() { return window_; } | 347 aura::Window* window() { return window_; } |
| 347 | 348 |
| 348 DelegatedFrameHost* GetDelegatedFrameHost() const { | 349 DelegatedFrameHost* GetDelegatedFrameHost() const { |
| 349 return delegated_frame_host_.get(); | 350 return delegated_frame_host_.get(); |
| 350 } | 351 } |
| 351 | 352 |
| 352 const ui::MotionEventAura& pointer_state() const { return pointer_state_; } | 353 const ui::MotionEventAura& pointer_state() const { return pointer_state_; } |
| 353 | 354 |
| 354 private: | 355 private: |
| 355 friend class RenderWidgetHostViewAuraCopyRequestTest; | 356 friend class RenderWidgetHostViewAuraCopyRequestTest; |
| 357 friend class TestInputMethodObserver; |
| 356 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, | 358 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, |
| 357 PopupRetainsCaptureAfterMouseRelease); | 359 PopupRetainsCaptureAfterMouseRelease); |
| 358 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, SetCompositionText); | 360 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, SetCompositionText); |
| 359 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, TouchEventState); | 361 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, TouchEventState); |
| 360 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, | 362 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, |
| 361 TouchEventPositionsArentRounded); | 363 TouchEventPositionsArentRounded); |
| 362 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, TouchEventSyncAsync); | 364 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, TouchEventSyncAsync); |
| 363 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, Resize); | 365 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, Resize); |
| 364 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, SwapNotifiesWindow); | 366 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, SwapNotifiesWindow); |
| 365 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, RecreateLayers); | 367 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, RecreateLayers); |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 521 // handled if it should not be further processed. | 523 // handled if it should not be further processed. |
| 522 void HandleGestureForTouchSelection(ui::GestureEvent* event); | 524 void HandleGestureForTouchSelection(ui::GestureEvent* event); |
| 523 | 525 |
| 524 // Forwards a mouse event to this view's parent window delegate. | 526 // Forwards a mouse event to this view's parent window delegate. |
| 525 void ForwardMouseEventToParent(ui::MouseEvent* event); | 527 void ForwardMouseEventToParent(ui::MouseEvent* event); |
| 526 | 528 |
| 527 // Returns the RenderViewHostDelegateView instance for this view. Returns | 529 // Returns the RenderViewHostDelegateView instance for this view. Returns |
| 528 // NULL on failure. | 530 // NULL on failure. |
| 529 RenderViewHostDelegateView* GetRenderViewHostDelegateView(); | 531 RenderViewHostDelegateView* GetRenderViewHostDelegateView(); |
| 530 | 532 |
| 533 // TextInputManager::Observer implementations. |
| 534 void OnTextInputStateUpdated(TextInputManager* text_input_manager, |
| 535 RenderWidgetHostViewBase* updated_view, |
| 536 bool changed) override; |
| 537 |
| 538 // RenderWidgetHostViewAura needs to observe the life time of TextInputManager |
| 539 // as in some cases, RWHV goes away after WebContentsImpl's destruction. |
| 540 void OnTextInputManagerDestroyed( |
| 541 TextInputManager* text_input_manager) override; |
| 542 |
| 531 // The model object. | 543 // The model object. |
| 532 RenderWidgetHostImpl* const host_; | 544 RenderWidgetHostImpl* const host_; |
| 533 | 545 |
| 534 aura::Window* window_; | 546 aura::Window* window_; |
| 535 | 547 |
| 536 std::unique_ptr<DelegatedFrameHost> delegated_frame_host_; | 548 std::unique_ptr<DelegatedFrameHost> delegated_frame_host_; |
| 537 | 549 |
| 538 std::unique_ptr<WindowObserver> window_observer_; | 550 std::unique_ptr<WindowObserver> window_observer_; |
| 539 | 551 |
| 540 // Tracks the ancestors of the RWHVA window for window location changes. | 552 // Tracks the ancestors of the RWHVA window for window location changes. |
| (...skipping 23 matching lines...) Expand all Loading... |
| 564 // True when content is being loaded. Used to show an hourglass cursor. | 576 // True when content is being loaded. Used to show an hourglass cursor. |
| 565 bool is_loading_; | 577 bool is_loading_; |
| 566 | 578 |
| 567 // The cursor for the page. This is passed up from the renderer. | 579 // The cursor for the page. This is passed up from the renderer. |
| 568 WebCursor current_cursor_; | 580 WebCursor current_cursor_; |
| 569 | 581 |
| 570 // Stores the current state of the active pointers targeting this | 582 // Stores the current state of the active pointers targeting this |
| 571 // object. | 583 // object. |
| 572 ui::MotionEventAura pointer_state_; | 584 ui::MotionEventAura pointer_state_; |
| 573 | 585 |
| 574 // The current text input type. | |
| 575 ui::TextInputType text_input_type_; | |
| 576 // The current text input mode corresponding to HTML5 inputmode attribute. | |
| 577 ui::TextInputMode text_input_mode_; | |
| 578 // The current text input flags. | |
| 579 int text_input_flags_; | |
| 580 bool can_compose_inline_; | |
| 581 | |
| 582 // Bounds for the selection. | 586 // Bounds for the selection. |
| 583 ui::SelectionBound selection_anchor_; | 587 ui::SelectionBound selection_anchor_; |
| 584 ui::SelectionBound selection_focus_; | 588 ui::SelectionBound selection_focus_; |
| 585 | 589 |
| 586 // The current composition character bounds. | 590 // The current composition character bounds. |
| 587 std::vector<gfx::Rect> composition_character_bounds_; | 591 std::vector<gfx::Rect> composition_character_bounds_; |
| 588 | 592 |
| 589 // Indicates if there is onging composition text. | 593 // Indicates if there is onging composition text. |
| 590 bool has_composition_text_; | 594 bool has_composition_text_; |
| 591 | 595 |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 690 bool disable_input_event_router_for_testing_; | 694 bool disable_input_event_router_for_testing_; |
| 691 | 695 |
| 692 base::WeakPtrFactory<RenderWidgetHostViewAura> weak_ptr_factory_; | 696 base::WeakPtrFactory<RenderWidgetHostViewAura> weak_ptr_factory_; |
| 693 | 697 |
| 694 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAura); | 698 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAura); |
| 695 }; | 699 }; |
| 696 | 700 |
| 697 } // namespace content | 701 } // namespace content |
| 698 | 702 |
| 699 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_ | 703 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_ |
| OLD | NEW |