| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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, |
| 93 public DelegatedFrameHostClient, | 94 public DelegatedFrameHostClient, |
| 95 public TextInputManager::Observer, |
| 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: |
| 103 // When |is_guest_view_hack| is true, this view isn't really the view for | 105 // When |is_guest_view_hack| is true, this view isn't really the view for |
| (...skipping 23 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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 aura::Window* window() { return window_; } | 336 aura::Window* window() { return window_; } |
| 336 | 337 |
| 337 DelegatedFrameHost* GetDelegatedFrameHost() const { | 338 DelegatedFrameHost* GetDelegatedFrameHost() const { |
| 338 return delegated_frame_host_.get(); | 339 return delegated_frame_host_.get(); |
| 339 } | 340 } |
| 340 | 341 |
| 341 const ui::MotionEventAura& pointer_state() const { return pointer_state_; } | 342 const ui::MotionEventAura& pointer_state() const { return pointer_state_; } |
| 342 | 343 |
| 343 private: | 344 private: |
| 344 friend class RenderWidgetHostViewAuraCopyRequestTest; | 345 friend class RenderWidgetHostViewAuraCopyRequestTest; |
| 346 friend class TestInputMethodObserver; |
| 345 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, | 347 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, |
| 346 PopupRetainsCaptureAfterMouseRelease); | 348 PopupRetainsCaptureAfterMouseRelease); |
| 347 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, SetCompositionText); | 349 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, SetCompositionText); |
| 348 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, TouchEventState); | 350 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, TouchEventState); |
| 349 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, | 351 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, |
| 350 TouchEventPositionsArentRounded); | 352 TouchEventPositionsArentRounded); |
| 351 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, TouchEventSyncAsync); | 353 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, TouchEventSyncAsync); |
| 352 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, Resize); | 354 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, Resize); |
| 353 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, SwapNotifiesWindow); | 355 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, SwapNotifiesWindow); |
| 354 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, RecreateLayers); | 356 FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostViewAuraTest, RecreateLayers); |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 511 // handled if it should not be further processed. | 513 // handled if it should not be further processed. |
| 512 void HandleGestureForTouchSelection(ui::GestureEvent* event); | 514 void HandleGestureForTouchSelection(ui::GestureEvent* event); |
| 513 | 515 |
| 514 // Forwards a mouse event to this view's parent window delegate. | 516 // Forwards a mouse event to this view's parent window delegate. |
| 515 void ForwardMouseEventToParent(ui::MouseEvent* event); | 517 void ForwardMouseEventToParent(ui::MouseEvent* event); |
| 516 | 518 |
| 517 // Returns the RenderViewHostDelegateView instance for this view. Returns | 519 // Returns the RenderViewHostDelegateView instance for this view. Returns |
| 518 // NULL on failure. | 520 // NULL on failure. |
| 519 RenderViewHostDelegateView* GetRenderViewHostDelegateView(); | 521 RenderViewHostDelegateView* GetRenderViewHostDelegateView(); |
| 520 | 522 |
| 523 // TextInputManager::Observer implementation. |
| 524 void OnUpdateTextInputStateCalled(TextInputManager* text_input_manager, |
| 525 RenderWidgetHostViewBase* updated_view, |
| 526 bool did_update_state) override; |
| 527 |
| 521 // The model object. | 528 // The model object. |
| 522 RenderWidgetHostImpl* const host_; | 529 RenderWidgetHostImpl* const host_; |
| 523 | 530 |
| 524 aura::Window* window_; | 531 aura::Window* window_; |
| 525 | 532 |
| 526 std::unique_ptr<DelegatedFrameHost> delegated_frame_host_; | 533 std::unique_ptr<DelegatedFrameHost> delegated_frame_host_; |
| 527 | 534 |
| 528 std::unique_ptr<WindowObserver> window_observer_; | 535 std::unique_ptr<WindowObserver> window_observer_; |
| 529 | 536 |
| 530 // Tracks the ancestors of the RWHVA window for window location changes. | 537 // Tracks the ancestors of the RWHVA window for window location changes. |
| (...skipping 23 matching lines...) Expand all Loading... |
| 554 // True when content is being loaded. Used to show an hourglass cursor. | 561 // True when content is being loaded. Used to show an hourglass cursor. |
| 555 bool is_loading_; | 562 bool is_loading_; |
| 556 | 563 |
| 557 // The cursor for the page. This is passed up from the renderer. | 564 // The cursor for the page. This is passed up from the renderer. |
| 558 WebCursor current_cursor_; | 565 WebCursor current_cursor_; |
| 559 | 566 |
| 560 // Stores the current state of the active pointers targeting this | 567 // Stores the current state of the active pointers targeting this |
| 561 // object. | 568 // object. |
| 562 ui::MotionEventAura pointer_state_; | 569 ui::MotionEventAura pointer_state_; |
| 563 | 570 |
| 564 // The current text input type. | |
| 565 ui::TextInputType text_input_type_; | |
| 566 // The current text input mode corresponding to HTML5 inputmode attribute. | |
| 567 ui::TextInputMode text_input_mode_; | |
| 568 // The current text input flags. | |
| 569 int text_input_flags_; | |
| 570 bool can_compose_inline_; | |
| 571 | |
| 572 // Bounds for the selection. | 571 // Bounds for the selection. |
| 573 ui::SelectionBound selection_anchor_; | 572 ui::SelectionBound selection_anchor_; |
| 574 ui::SelectionBound selection_focus_; | 573 ui::SelectionBound selection_focus_; |
| 575 | 574 |
| 576 // The current composition character bounds. | 575 // The current composition character bounds. |
| 577 std::vector<gfx::Rect> composition_character_bounds_; | 576 std::vector<gfx::Rect> composition_character_bounds_; |
| 578 | 577 |
| 579 // Indicates if there is onging composition text. | 578 // Indicates if there is onging composition text. |
| 580 bool has_composition_text_; | 579 bool has_composition_text_; |
| 581 | 580 |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 673 bool disable_input_event_router_for_testing_; | 672 bool disable_input_event_router_for_testing_; |
| 674 | 673 |
| 675 base::WeakPtrFactory<RenderWidgetHostViewAura> weak_ptr_factory_; | 674 base::WeakPtrFactory<RenderWidgetHostViewAura> weak_ptr_factory_; |
| 676 | 675 |
| 677 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAura); | 676 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAura); |
| 678 }; | 677 }; |
| 679 | 678 |
| 680 } // namespace content | 679 } // namespace content |
| 681 | 680 |
| 682 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_ | 681 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_ |
| OLD | NEW |