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_base.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_base.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 #include "content/browser/accessibility/browser_accessibility_manager.h" | 9 #include "content/browser/accessibility/browser_accessibility_manager.h" |
10 #include "content/browser/gpu/gpu_data_manager_impl.h" | 10 #include "content/browser/gpu/gpu_data_manager_impl.h" |
11 #include "content/browser/renderer_host/input/synthetic_gesture_target_base.h" | 11 #include "content/browser/renderer_host/input/synthetic_gesture_target_base.h" |
12 #include "content/browser/renderer_host/render_process_host_impl.h" | 12 #include "content/browser/renderer_host/render_process_host_impl.h" |
| 13 #include "content/browser/renderer_host/render_view_host_delegate.h" |
| 14 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 15 #include "content/browser/renderer_host/render_widget_host_delegate.h" |
13 #include "content/browser/renderer_host/render_widget_host_impl.h" | 16 #include "content/browser/renderer_host/render_widget_host_impl.h" |
14 #include "content/common/content_switches_internal.h" | 17 #include "content/common/content_switches_internal.h" |
| 18 #include "content/common/input_messages.h" |
| 19 #include "content/common/site_isolation_policy.h" |
| 20 #include "content/common/text_input_state.h" |
| 21 #include "content/common/view_messages.h" |
15 #include "content/public/browser/render_widget_host_view_frame_subscriber.h" | 22 #include "content/public/browser/render_widget_host_view_frame_subscriber.h" |
| 23 #include "content/public/common/browser_plugin_guest_mode.h" |
16 #include "ui/gfx/display.h" | 24 #include "ui/gfx/display.h" |
17 #include "ui/gfx/geometry/point_conversions.h" | 25 #include "ui/gfx/geometry/point_conversions.h" |
18 #include "ui/gfx/geometry/size_conversions.h" | 26 #include "ui/gfx/geometry/size_conversions.h" |
19 #include "ui/gfx/geometry/size_f.h" | 27 #include "ui/gfx/geometry/size_f.h" |
20 #include "ui/gfx/screen.h" | 28 #include "ui/gfx/screen.h" |
21 | 29 |
22 #if defined(OS_WIN) | 30 #if defined(OS_WIN) |
23 #include "base/command_line.h" | 31 #include "base/command_line.h" |
24 #include "base/message_loop/message_loop.h" | 32 #include "base/message_loop/message_loop.h" |
25 #include "base/win/wrapped_window_proc.h" | 33 #include "base/win/wrapped_window_proc.h" |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 : popup_type_(blink::WebPopupTypeNone), | 378 : popup_type_(blink::WebPopupTypeNone), |
371 background_color_(SK_ColorWHITE), | 379 background_color_(SK_ColorWHITE), |
372 mouse_locked_(false), | 380 mouse_locked_(false), |
373 showing_context_menu_(false), | 381 showing_context_menu_(false), |
374 selection_text_offset_(0), | 382 selection_text_offset_(0), |
375 selection_range_(gfx::Range::InvalidRange()), | 383 selection_range_(gfx::Range::InvalidRange()), |
376 current_device_scale_factor_(0), | 384 current_device_scale_factor_(0), |
377 current_display_rotation_(gfx::Display::ROTATE_0), | 385 current_display_rotation_(gfx::Display::ROTATE_0), |
378 pinch_zoom_enabled_(content::IsPinchToZoomEnabled()), | 386 pinch_zoom_enabled_(content::IsPinchToZoomEnabled()), |
379 renderer_frame_number_(0), | 387 renderer_frame_number_(0), |
| 388 text_input_state_(new TextInputState), |
| 389 cached_text_input_state_(text_input_state_.get()), |
380 weak_factory_(this) { | 390 weak_factory_(this) { |
| 391 text_input_state_->can_compose_inline = true; |
381 } | 392 } |
382 | 393 |
383 RenderWidgetHostViewBase::~RenderWidgetHostViewBase() { | 394 RenderWidgetHostViewBase::~RenderWidgetHostViewBase() { |
384 DCHECK(!mouse_locked_); | 395 DCHECK(!mouse_locked_); |
385 } | 396 } |
386 | 397 |
387 bool RenderWidgetHostViewBase::OnMessageReceived(const IPC::Message& msg){ | 398 bool RenderWidgetHostViewBase::OnMessageReceived(const IPC::Message& msg){ |
388 return false; | 399 return false; |
389 } | 400 } |
390 | 401 |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
694 gfx::ToRoundedPoint(point))); | 705 gfx::ToRoundedPoint(point))); |
695 } | 706 } |
696 | 707 |
697 void RenderWidgetHostViewBase::TransformPointToLocalCoordSpace( | 708 void RenderWidgetHostViewBase::TransformPointToLocalCoordSpace( |
698 const gfx::Point& point, | 709 const gfx::Point& point, |
699 cc::SurfaceId original_surface, | 710 cc::SurfaceId original_surface, |
700 gfx::Point* transformed_point) { | 711 gfx::Point* transformed_point) { |
701 *transformed_point = point; | 712 *transformed_point = point; |
702 } | 713 } |
703 | 714 |
| 715 void RenderWidgetHostViewBase::TextInputStateChanged( |
| 716 const TextInputState& params) { |
| 717 #if defined(OS_ANDROID) |
| 718 if (params.is_non_ime_change) { |
| 719 // Sends an acknowledgement to the renderer of a processed IME event. |
| 720 GetRenderWidgetHost()->Send( |
| 721 new InputMsg_ImeEventAck(GetRenderWidgetHost()->GetRoutingID())); |
| 722 } |
| 723 #endif |
| 724 *text_input_state_ = params; |
| 725 UpdateTextInputState(); |
| 726 } |
| 727 |
| 728 const TextInputState* RenderWidgetHostViewBase::FindCurrentTextInputState() { |
| 729 if (!SiteIsolationPolicy::AreCrossProcessFramesPossible()) |
| 730 return text_input_state_.get(); |
| 731 |
| 732 const TextInputState* state = text_input_state_.get(); |
| 733 RenderWidgetHostViewBase* focused_view = |
| 734 RenderWidgetHostImpl::From(GetRenderWidgetHost()) |
| 735 ->delegate() |
| 736 ->GetFocusedView(); |
| 737 if (focused_view && focused_view != this) |
| 738 state = focused_view->FindCurrentTextInputState(); |
| 739 return state; |
| 740 } |
| 741 |
| 742 void RenderWidgetHostViewBase::UpdateTextInputState() { |
| 743 cached_text_input_state_ = FindCurrentTextInputState(); |
| 744 } |
| 745 |
704 } // namespace content | 746 } // namespace content |
OLD | NEW |