| 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 | 9 |
| 10 #include <tuple> | 10 #include <tuple> |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 #include "content/browser/renderer_host/delegated_frame_host_client_aura.h" | 40 #include "content/browser/renderer_host/delegated_frame_host_client_aura.h" |
| 41 #include "content/browser/renderer_host/input/input_router.h" | 41 #include "content/browser/renderer_host/input/input_router.h" |
| 42 #include "content/browser/renderer_host/input/mouse_wheel_event_queue.h" | 42 #include "content/browser/renderer_host/input/mouse_wheel_event_queue.h" |
| 43 #include "content/browser/renderer_host/overscroll_controller.h" | 43 #include "content/browser/renderer_host/overscroll_controller.h" |
| 44 #include "content/browser/renderer_host/overscroll_controller_delegate.h" | 44 #include "content/browser/renderer_host/overscroll_controller_delegate.h" |
| 45 #include "content/browser/renderer_host/render_view_host_factory.h" | 45 #include "content/browser/renderer_host/render_view_host_factory.h" |
| 46 #include "content/browser/renderer_host/render_widget_host_delegate.h" | 46 #include "content/browser/renderer_host/render_widget_host_delegate.h" |
| 47 #include "content/browser/renderer_host/render_widget_host_impl.h" | 47 #include "content/browser/renderer_host/render_widget_host_impl.h" |
| 48 #include "content/browser/renderer_host/render_widget_host_view_event_handler.h" | 48 #include "content/browser/renderer_host/render_widget_host_view_event_handler.h" |
| 49 #include "content/browser/renderer_host/render_widget_host_view_frame_subscriber
.h" | 49 #include "content/browser/renderer_host/render_widget_host_view_frame_subscriber
.h" |
| 50 #include "content/browser/renderer_host/resize_lock.h" | |
| 51 #include "content/browser/renderer_host/text_input_manager.h" | 50 #include "content/browser/renderer_host/text_input_manager.h" |
| 52 #include "content/browser/web_contents/web_contents_view_aura.h" | 51 #include "content/browser/web_contents/web_contents_view_aura.h" |
| 53 #include "content/common/host_shared_bitmap_manager.h" | 52 #include "content/common/host_shared_bitmap_manager.h" |
| 54 #include "content/common/input/synthetic_web_input_event_builders.h" | 53 #include "content/common/input/synthetic_web_input_event_builders.h" |
| 55 #include "content/common/input_messages.h" | 54 #include "content/common/input_messages.h" |
| 56 #include "content/common/text_input_state.h" | 55 #include "content/common/text_input_state.h" |
| 57 #include "content/common/view_messages.h" | 56 #include "content/common/view_messages.h" |
| 58 #include "content/public/browser/keyboard_event_processing_result.h" | 57 #include "content/public/browser/keyboard_event_processing_result.h" |
| 59 #include "content/public/browser/render_widget_host_view.h" | 58 #include "content/public/browser/render_widget_host_view.h" |
| 60 #include "content/public/browser/web_contents_view_delegate.h" | 59 #include "content/public/browser/web_contents_view_delegate.h" |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 | 353 |
| 355 private: | 354 private: |
| 356 size_t processed_touch_event_count_; | 355 size_t processed_touch_event_count_; |
| 357 }; | 356 }; |
| 358 | 357 |
| 359 class FakeDelegatedFrameHostClientAura : public DelegatedFrameHostClientAura { | 358 class FakeDelegatedFrameHostClientAura : public DelegatedFrameHostClientAura { |
| 360 public: | 359 public: |
| 361 explicit FakeDelegatedFrameHostClientAura( | 360 explicit FakeDelegatedFrameHostClientAura( |
| 362 RenderWidgetHostViewAura* render_widget_host_view) | 361 RenderWidgetHostViewAura* render_widget_host_view) |
| 363 : DelegatedFrameHostClientAura(render_widget_host_view) {} | 362 : DelegatedFrameHostClientAura(render_widget_host_view) {} |
| 364 ~FakeDelegatedFrameHostClientAura() override {} | 363 ~FakeDelegatedFrameHostClientAura() override = default; |
| 365 | 364 |
| 366 void DisableResizeLock() { can_create_resize_lock_ = false; } | 365 void DisableResizeLock() { can_create_resize_lock_ = false; } |
| 367 | 366 |
| 368 private: | 367 private: |
| 369 // A lock that doesn't actually do anything to the compositor, and does not | 368 // DelegatedFrameHostClientAura implementation. |
| 370 // time out. | |
| 371 class FakeResizeLock : public ResizeLock { | |
| 372 public: | |
| 373 FakeResizeLock(const gfx::Size new_size, bool defer_compositor_lock) | |
| 374 : ResizeLock(new_size, defer_compositor_lock) {} | |
| 375 }; | |
| 376 | |
| 377 // DelegatedFrameHostClientAura: | |
| 378 std::unique_ptr<ResizeLock> DelegatedFrameHostCreateResizeLock( | |
| 379 bool defer_compositor_lock) override { | |
| 380 gfx::Size desired_size = | |
| 381 render_widget_host_view()->GetNativeView()->bounds().size(); | |
| 382 return std::unique_ptr<ResizeLock>( | |
| 383 new FakeResizeLock(desired_size, defer_compositor_lock)); | |
| 384 } | |
| 385 bool DelegatedFrameCanCreateResizeLock() const override { | 369 bool DelegatedFrameCanCreateResizeLock() const override { |
| 386 return can_create_resize_lock_; | 370 return can_create_resize_lock_; |
| 387 } | 371 } |
| 388 | 372 |
| 373 // CompositorResizeLockClient implemention. Overrides from |
| 374 // DelegatedFrameHostClientAura, to prevent the lock from timing out. |
| 375 std::unique_ptr<ui::CompositorLock> GetCompositorLock( |
| 376 ui::CompositorLockClient* client) override { |
| 377 return base::MakeUnique<ui::CompositorLock>(nullptr, nullptr); |
| 378 } |
| 379 |
| 389 bool can_create_resize_lock_ = true; | 380 bool can_create_resize_lock_ = true; |
| 390 | 381 |
| 391 DISALLOW_COPY_AND_ASSIGN(FakeDelegatedFrameHostClientAura); | 382 DISALLOW_COPY_AND_ASSIGN(FakeDelegatedFrameHostClientAura); |
| 392 }; | 383 }; |
| 393 | 384 |
| 394 class FakeRenderWidgetHostViewAura : public RenderWidgetHostViewAura { | 385 class FakeRenderWidgetHostViewAura : public RenderWidgetHostViewAura { |
| 395 public: | 386 public: |
| 396 FakeRenderWidgetHostViewAura(RenderWidgetHost* widget, | 387 FakeRenderWidgetHostViewAura(RenderWidgetHost* widget, |
| 397 bool is_guest_view_hack) | 388 bool is_guest_view_hack) |
| 398 : RenderWidgetHostViewAura(widget, is_guest_view_hack), | 389 : RenderWidgetHostViewAura(widget, is_guest_view_hack), |
| 399 delegated_frame_host_client_( | 390 delegated_frame_host_client_( |
| 400 new FakeDelegatedFrameHostClientAura(this)) { | 391 new FakeDelegatedFrameHostClientAura(this)) { |
| 401 std::unique_ptr<DelegatedFrameHostClient> client( | 392 InstallDelegatedFrameHostClient( |
| 402 delegated_frame_host_client_); | 393 this, base::WrapUnique(delegated_frame_host_client_)); |
| 403 InstallDelegatedFrameHostClient(this, std::move(client)); | |
| 404 } | 394 } |
| 405 | 395 |
| 406 ~FakeRenderWidgetHostViewAura() override {} | 396 ~FakeRenderWidgetHostViewAura() override {} |
| 407 | 397 |
| 408 void DisableResizeLock() { | 398 void DisableResizeLock() { |
| 409 delegated_frame_host_client_->DisableResizeLock(); | 399 delegated_frame_host_client_->DisableResizeLock(); |
| 410 } | 400 } |
| 411 | 401 |
| 412 void UseFakeDispatcher() { | 402 void UseFakeDispatcher() { |
| 413 dispatcher_ = new FakeWindowEventDispatcher(window()->GetHost()); | 403 dispatcher_ = new FakeWindowEventDispatcher(window()->GetHost()); |
| (...skipping 4616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5030 // There is no composition in the beginning. | 5020 // There is no composition in the beginning. |
| 5031 EXPECT_FALSE(has_composition_text()); | 5021 EXPECT_FALSE(has_composition_text()); |
| 5032 SetHasCompositionTextToTrue(); | 5022 SetHasCompositionTextToTrue(); |
| 5033 view->ImeCancelComposition(); | 5023 view->ImeCancelComposition(); |
| 5034 // The composition must have been canceled. | 5024 // The composition must have been canceled. |
| 5035 EXPECT_FALSE(has_composition_text()); | 5025 EXPECT_FALSE(has_composition_text()); |
| 5036 } | 5026 } |
| 5037 } | 5027 } |
| 5038 | 5028 |
| 5039 } // namespace content | 5029 } // namespace content |
| OLD | NEW |