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 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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
510 // handled if it should not be further processed. | 512 // handled if it should not be further processed. |
511 void HandleGestureForTouchSelection(ui::GestureEvent* event); | 513 void HandleGestureForTouchSelection(ui::GestureEvent* event); |
512 | 514 |
513 // Forwards a mouse event to this view's parent window delegate. | 515 // Forwards a mouse event to this view's parent window delegate. |
514 void ForwardMouseEventToParent(ui::MouseEvent* event); | 516 void ForwardMouseEventToParent(ui::MouseEvent* event); |
515 | 517 |
516 // Returns the RenderViewHostDelegateView instance for this view. Returns | 518 // Returns the RenderViewHostDelegateView instance for this view. Returns |
517 // NULL on failure. | 519 // NULL on failure. |
518 RenderViewHostDelegateView* GetRenderViewHostDelegateView(); | 520 RenderViewHostDelegateView* GetRenderViewHostDelegateView(); |
519 | 521 |
522 // TextInputManager::Observer implementations. | |
kenrb
2016/05/12 16:16:36
nit: 'implementation' singular not plural
EhsanK
2016/05/13 16:00:56
Done.
| |
523 void OnTextInputStateUpdated(TextInputManager* text_input_manager, | |
524 RenderWidgetHostViewBase* updated_view, | |
525 bool changed) override; | |
526 | |
527 // RenderWidgetHostViewAura needs to observe the life time of TextInputManager | |
528 // as in some cases, RWHV goes away after WebContentsImpl's destruction. | |
kenrb
2016/05/12 16:16:36
I don't think you need this comment. The comment o
EhsanK
2016/05/13 16:00:55
Done.
| |
529 void OnTextInputManagerDestroyed( | |
530 TextInputManager* text_input_manager) override; | |
531 | |
520 // The model object. | 532 // The model object. |
521 RenderWidgetHostImpl* const host_; | 533 RenderWidgetHostImpl* const host_; |
522 | 534 |
523 aura::Window* window_; | 535 aura::Window* window_; |
524 | 536 |
525 std::unique_ptr<DelegatedFrameHost> delegated_frame_host_; | 537 std::unique_ptr<DelegatedFrameHost> delegated_frame_host_; |
526 | 538 |
527 std::unique_ptr<WindowObserver> window_observer_; | 539 std::unique_ptr<WindowObserver> window_observer_; |
528 | 540 |
529 // Tracks the ancestors of the RWHVA window for window location changes. | 541 // Tracks the ancestors of the RWHVA window for window location changes. |
(...skipping 23 matching lines...) Expand all Loading... | |
553 // True when content is being loaded. Used to show an hourglass cursor. | 565 // True when content is being loaded. Used to show an hourglass cursor. |
554 bool is_loading_; | 566 bool is_loading_; |
555 | 567 |
556 // The cursor for the page. This is passed up from the renderer. | 568 // The cursor for the page. This is passed up from the renderer. |
557 WebCursor current_cursor_; | 569 WebCursor current_cursor_; |
558 | 570 |
559 // Stores the current state of the active pointers targeting this | 571 // Stores the current state of the active pointers targeting this |
560 // object. | 572 // object. |
561 ui::MotionEventAura pointer_state_; | 573 ui::MotionEventAura pointer_state_; |
562 | 574 |
563 // The current text input type. | |
564 ui::TextInputType text_input_type_; | |
565 // The current text input mode corresponding to HTML5 inputmode attribute. | |
566 ui::TextInputMode text_input_mode_; | |
567 // The current text input flags. | |
568 int text_input_flags_; | |
569 bool can_compose_inline_; | |
570 | |
571 // Bounds for the selection. | 575 // Bounds for the selection. |
572 ui::SelectionBound selection_anchor_; | 576 ui::SelectionBound selection_anchor_; |
573 ui::SelectionBound selection_focus_; | 577 ui::SelectionBound selection_focus_; |
574 | 578 |
575 // The current composition character bounds. | 579 // The current composition character bounds. |
576 std::vector<gfx::Rect> composition_character_bounds_; | 580 std::vector<gfx::Rect> composition_character_bounds_; |
577 | 581 |
578 // Indicates if there is onging composition text. | 582 // Indicates if there is onging composition text. |
579 bool has_composition_text_; | 583 bool has_composition_text_; |
580 | 584 |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
672 bool disable_input_event_router_for_testing_; | 676 bool disable_input_event_router_for_testing_; |
673 | 677 |
674 base::WeakPtrFactory<RenderWidgetHostViewAura> weak_ptr_factory_; | 678 base::WeakPtrFactory<RenderWidgetHostViewAura> weak_ptr_factory_; |
675 | 679 |
676 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAura); | 680 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewAura); |
677 }; | 681 }; |
678 | 682 |
679 } // namespace content | 683 } // namespace content |
680 | 684 |
681 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_ | 685 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_AURA_H_ |
OLD | NEW |