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_impl.h" | 5 #include "content/browser/renderer_host/render_widget_host_impl.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 #include <utility> | 10 #include <utility> |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 #include "content/browser/renderer_host/render_widget_host_input_event_router.h" | 50 #include "content/browser/renderer_host/render_widget_host_input_event_router.h" |
51 #include "content/browser/renderer_host/render_widget_host_owner_delegate.h" | 51 #include "content/browser/renderer_host/render_widget_host_owner_delegate.h" |
52 #include "content/browser/renderer_host/render_widget_host_view_base.h" | 52 #include "content/browser/renderer_host/render_widget_host_view_base.h" |
53 #include "content/common/content_constants_internal.h" | 53 #include "content/common/content_constants_internal.h" |
54 #include "content/common/content_switches_internal.h" | 54 #include "content/common/content_switches_internal.h" |
55 #include "content/common/cursors/webcursor.h" | 55 #include "content/common/cursors/webcursor.h" |
56 #include "content/common/frame_messages.h" | 56 #include "content/common/frame_messages.h" |
57 #include "content/common/host_shared_bitmap_manager.h" | 57 #include "content/common/host_shared_bitmap_manager.h" |
58 #include "content/common/input_messages.h" | 58 #include "content/common/input_messages.h" |
59 #include "content/common/resize_params.h" | 59 #include "content/common/resize_params.h" |
60 #include "content/common/text_input_state.h" | |
61 #include "content/common/view_messages.h" | 60 #include "content/common/view_messages.h" |
62 #include "content/public/browser/native_web_keyboard_event.h" | 61 #include "content/public/browser/native_web_keyboard_event.h" |
63 #include "content/public/browser/notification_service.h" | 62 #include "content/public/browser/notification_service.h" |
64 #include "content/public/browser/notification_types.h" | 63 #include "content/public/browser/notification_types.h" |
65 #include "content/public/browser/render_widget_host_iterator.h" | 64 #include "content/public/browser/render_widget_host_iterator.h" |
66 #include "content/public/common/content_constants.h" | 65 #include "content/public/common/content_constants.h" |
67 #include "content/public/common/content_switches.h" | 66 #include "content/public/common/content_switches.h" |
68 #include "content/public/common/result_codes.h" | 67 #include "content/public/common/result_codes.h" |
69 #include "content/public/common/web_preferences.h" | 68 #include "content/public/common/web_preferences.h" |
70 #include "gpu/GLES2/gl2extchromium.h" | 69 #include "gpu/GLES2/gl2extchromium.h" |
(...skipping 1652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1723 view_.get() ? content::GetScaleFactorForView(view_.get()) : 1.0f)); | 1722 view_.get() ? content::GetScaleFactorForView(view_.get()) : 1.0f)); |
1724 } | 1723 } |
1725 touch_emulator_->Enable(config_type); | 1724 touch_emulator_->Enable(config_type); |
1726 } else { | 1725 } else { |
1727 if (touch_emulator_) | 1726 if (touch_emulator_) |
1728 touch_emulator_->Disable(); | 1727 touch_emulator_->Disable(); |
1729 } | 1728 } |
1730 } | 1729 } |
1731 | 1730 |
1732 void RenderWidgetHostImpl::OnTextInputStateChanged( | 1731 void RenderWidgetHostImpl::OnTextInputStateChanged( |
1733 const TextInputState& params) { | 1732 const ViewHostMsg_TextInputState_Params& params) { |
1734 if (view_) | 1733 if (view_) |
1735 view_->TextInputStateChanged(params); | 1734 view_->TextInputStateChanged(params); |
1736 } | 1735 } |
1737 | 1736 |
1738 void RenderWidgetHostImpl::OnImeCompositionRangeChanged( | 1737 void RenderWidgetHostImpl::OnImeCompositionRangeChanged( |
1739 const gfx::Range& range, | 1738 const gfx::Range& range, |
1740 const std::vector<gfx::Rect>& character_bounds) { | 1739 const std::vector<gfx::Rect>& character_bounds) { |
1741 if (view_) | 1740 if (view_) |
1742 view_->ImeCompositionRangeChanged(range, character_bounds); | 1741 view_->ImeCompositionRangeChanged(range, character_bounds); |
1743 } | 1742 } |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2050 // DelayedAutoResized will not get called again). | 2049 // DelayedAutoResized will not get called again). |
2051 new_auto_size_.SetSize(0, 0); | 2050 new_auto_size_.SetSize(0, 0); |
2052 if (!auto_resize_enabled_) | 2051 if (!auto_resize_enabled_) |
2053 return; | 2052 return; |
2054 | 2053 |
2055 if (delegate_) | 2054 if (delegate_) |
2056 delegate_->ResizeDueToAutoResize(this, new_size); | 2055 delegate_->ResizeDueToAutoResize(this, new_size); |
2057 } | 2056 } |
2058 | 2057 |
2059 void RenderWidgetHostImpl::DetachDelegate() { | 2058 void RenderWidgetHostImpl::DetachDelegate() { |
2060 // If |view_| has active text input state, it will not be able to update the | |
2061 // |delegate_| about shut down and losing the state (see crbug.com/602144). | |
2062 if (view_) | |
2063 view_->TextInputStateChanged(TextInputState()); | |
2064 | |
2065 delegate_ = NULL; | 2059 delegate_ = NULL; |
2066 } | 2060 } |
2067 | 2061 |
2068 void RenderWidgetHostImpl::FrameSwapped(const ui::LatencyInfo& latency_info) { | 2062 void RenderWidgetHostImpl::FrameSwapped(const ui::LatencyInfo& latency_info) { |
2069 ui::LatencyInfo::LatencyComponent window_snapshot_component; | 2063 ui::LatencyInfo::LatencyComponent window_snapshot_component; |
2070 if (latency_info.FindLatency(ui::WINDOW_SNAPSHOT_FRAME_NUMBER_COMPONENT, | 2064 if (latency_info.FindLatency(ui::WINDOW_SNAPSHOT_FRAME_NUMBER_COMPONENT, |
2071 GetLatencyComponentId(), | 2065 GetLatencyComponentId(), |
2072 &window_snapshot_component)) { | 2066 &window_snapshot_component)) { |
2073 int sequence_number = static_cast<int>( | 2067 int sequence_number = static_cast<int>( |
2074 window_snapshot_component.sequence_number); | 2068 window_snapshot_component.sequence_number); |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2172 return delegate_ ? delegate_->GetRootBrowserAccessibilityManager() : NULL; | 2166 return delegate_ ? delegate_->GetRootBrowserAccessibilityManager() : NULL; |
2173 } | 2167 } |
2174 | 2168 |
2175 BrowserAccessibilityManager* | 2169 BrowserAccessibilityManager* |
2176 RenderWidgetHostImpl::GetOrCreateRootBrowserAccessibilityManager() { | 2170 RenderWidgetHostImpl::GetOrCreateRootBrowserAccessibilityManager() { |
2177 return delegate_ ? | 2171 return delegate_ ? |
2178 delegate_->GetOrCreateRootBrowserAccessibilityManager() : NULL; | 2172 delegate_->GetOrCreateRootBrowserAccessibilityManager() : NULL; |
2179 } | 2173 } |
2180 | 2174 |
2181 } // namespace content | 2175 } // namespace content |
OLD | NEW |