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 #include "content/browser/renderer_host/render_widget_host_view_aura.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 23 matching lines...) Expand all Loading... |
34 #include "content/browser/renderer_host/overscroll_controller_delegate.h" | 34 #include "content/browser/renderer_host/overscroll_controller_delegate.h" |
35 #include "content/browser/renderer_host/render_view_host_factory.h" | 35 #include "content/browser/renderer_host/render_view_host_factory.h" |
36 #include "content/browser/renderer_host/render_widget_host_delegate.h" | 36 #include "content/browser/renderer_host/render_widget_host_delegate.h" |
37 #include "content/browser/renderer_host/render_widget_host_impl.h" | 37 #include "content/browser/renderer_host/render_widget_host_impl.h" |
38 #include "content/browser/renderer_host/resize_lock.h" | 38 #include "content/browser/renderer_host/resize_lock.h" |
39 #include "content/browser/web_contents/web_contents_view_aura.h" | 39 #include "content/browser/web_contents/web_contents_view_aura.h" |
40 #include "content/common/host_shared_bitmap_manager.h" | 40 #include "content/common/host_shared_bitmap_manager.h" |
41 #include "content/common/input/input_event_utils.h" | 41 #include "content/common/input/input_event_utils.h" |
42 #include "content/common/input/synthetic_web_input_event_builders.h" | 42 #include "content/common/input/synthetic_web_input_event_builders.h" |
43 #include "content/common/input_messages.h" | 43 #include "content/common/input_messages.h" |
| 44 #include "content/common/text_input_state.h" |
44 #include "content/common/view_messages.h" | 45 #include "content/common/view_messages.h" |
45 #include "content/public/browser/render_widget_host_view.h" | 46 #include "content/public/browser/render_widget_host_view.h" |
46 #include "content/public/browser/render_widget_host_view_frame_subscriber.h" | 47 #include "content/public/browser/render_widget_host_view_frame_subscriber.h" |
47 #include "content/public/browser/web_contents_view_delegate.h" | 48 #include "content/public/browser/web_contents_view_delegate.h" |
48 #include "content/public/common/context_menu_params.h" | 49 #include "content/public/common/context_menu_params.h" |
49 #include "content/public/test/mock_render_process_host.h" | 50 #include "content/public/test/mock_render_process_host.h" |
50 #include "content/public/test/test_browser_context.h" | 51 #include "content/public/test/test_browser_context.h" |
51 #include "content/test/test_render_view_host.h" | 52 #include "content/test/test_render_view_host.h" |
52 #include "content/test/test_web_contents.h" | 53 #include "content/test/test_web_contents.h" |
53 #include "ipc/ipc_test_sink.h" | 54 #include "ipc/ipc_test_sink.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 OverscrollMode current_mode_; | 146 OverscrollMode current_mode_; |
146 OverscrollMode completed_mode_; | 147 OverscrollMode completed_mode_; |
147 float delta_x_; | 148 float delta_x_; |
148 float delta_y_; | 149 float delta_y_; |
149 | 150 |
150 DISALLOW_COPY_AND_ASSIGN(TestOverscrollDelegate); | 151 DISALLOW_COPY_AND_ASSIGN(TestOverscrollDelegate); |
151 }; | 152 }; |
152 | 153 |
153 class MockRenderWidgetHostDelegate : public RenderWidgetHostDelegate { | 154 class MockRenderWidgetHostDelegate : public RenderWidgetHostDelegate { |
154 public: | 155 public: |
155 MockRenderWidgetHostDelegate() : rwh_(nullptr) {} | 156 MockRenderWidgetHostDelegate() |
| 157 : rwh_(nullptr), text_input_state_(new TextInputState()) {} |
156 ~MockRenderWidgetHostDelegate() override {} | 158 ~MockRenderWidgetHostDelegate() override {} |
157 const NativeWebKeyboardEvent* last_event() const { return last_event_.get(); } | 159 const NativeWebKeyboardEvent* last_event() const { return last_event_.get(); } |
158 void set_widget_host(RenderWidgetHostImpl* rwh) { rwh_ = rwh; } | 160 void set_widget_host(RenderWidgetHostImpl* rwh) { rwh_ = rwh; } |
159 | 161 |
160 protected: | 162 protected: |
161 // RenderWidgetHostDelegate: | 163 // RenderWidgetHostDelegate: |
162 bool PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event, | 164 bool PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event, |
163 bool* is_keyboard_shortcut) override { | 165 bool* is_keyboard_shortcut) override { |
164 last_event_.reset(new NativeWebKeyboardEvent(event)); | 166 last_event_.reset(new NativeWebKeyboardEvent(event)); |
165 return true; | 167 return true; |
166 } | 168 } |
| 169 |
| 170 const TextInputState* GetTextInputState() override { |
| 171 return text_input_state_.get(); |
| 172 } |
| 173 |
167 void Cut() override {} | 174 void Cut() override {} |
168 void Copy() override {} | 175 void Copy() override {} |
169 void Paste() override {} | 176 void Paste() override {} |
170 void SelectAll() override {} | 177 void SelectAll() override {} |
171 void SendScreenRects() override { | 178 void SendScreenRects() override { |
172 if (rwh_) | 179 if (rwh_) |
173 rwh_->SendScreenRects(); | 180 rwh_->SendScreenRects(); |
174 } | 181 } |
175 | 182 |
176 private: | 183 private: |
177 scoped_ptr<NativeWebKeyboardEvent> last_event_; | 184 scoped_ptr<NativeWebKeyboardEvent> last_event_; |
178 RenderWidgetHostImpl* rwh_; | 185 RenderWidgetHostImpl* rwh_; |
| 186 scoped_ptr<TextInputState> text_input_state_; |
| 187 |
179 DISALLOW_COPY_AND_ASSIGN(MockRenderWidgetHostDelegate); | 188 DISALLOW_COPY_AND_ASSIGN(MockRenderWidgetHostDelegate); |
180 }; | 189 }; |
181 | 190 |
182 // Simple observer that keeps track of changes to a window for tests. | 191 // Simple observer that keeps track of changes to a window for tests. |
183 class TestWindowObserver : public aura::WindowObserver { | 192 class TestWindowObserver : public aura::WindowObserver { |
184 public: | 193 public: |
185 explicit TestWindowObserver(aura::Window* window_to_observe) | 194 explicit TestWindowObserver(aura::Window* window_to_observe) |
186 : window_(window_to_observe) { | 195 : window_(window_to_observe) { |
187 window_->AddObserver(this); | 196 window_->AddObserver(this); |
188 } | 197 } |
(...skipping 4283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4472 view()->OnGestureEvent(&gesture_event); | 4481 view()->OnGestureEvent(&gesture_event); |
4473 | 4482 |
4474 EXPECT_TRUE(delegate->context_menu_request_received()); | 4483 EXPECT_TRUE(delegate->context_menu_request_received()); |
4475 EXPECT_EQ(delegate->context_menu_source_type(), ui::MENU_SOURCE_TOUCH); | 4484 EXPECT_EQ(delegate->context_menu_source_type(), ui::MENU_SOURCE_TOUCH); |
4476 #endif | 4485 #endif |
4477 | 4486 |
4478 RenderViewHostFactory::set_is_real_render_view_host(false); | 4487 RenderViewHostFactory::set_is_real_render_view_host(false); |
4479 } | 4488 } |
4480 | 4489 |
4481 } // namespace content | 4490 } // namespace content |
OLD | NEW |