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_view_host_impl.h" | 5 #include "content/browser/renderer_host/render_view_host_impl.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 if (ResourceDispatcherHostImpl::Get()) { | 227 if (ResourceDispatcherHostImpl::Get()) { |
228 BrowserThread::PostTask( | 228 BrowserThread::PostTask( |
229 BrowserThread::IO, FROM_HERE, | 229 BrowserThread::IO, FROM_HERE, |
230 base::Bind(&ResourceDispatcherHostImpl::OnRenderViewHostCreated, | 230 base::Bind(&ResourceDispatcherHostImpl::OnRenderViewHostCreated, |
231 base::Unretained(ResourceDispatcherHostImpl::Get()), | 231 base::Unretained(ResourceDispatcherHostImpl::Get()), |
232 GetProcess()->GetID(), GetRoutingID())); | 232 GetProcess()->GetID(), GetRoutingID())); |
233 } | 233 } |
234 | 234 |
235 close_timeout_.reset(new TimeoutMonitor(base::Bind( | 235 close_timeout_.reset(new TimeoutMonitor(base::Bind( |
236 &RenderViewHostImpl::ClosePageTimeout, weak_factory_.GetWeakPtr()))); | 236 &RenderViewHostImpl::ClosePageTimeout, weak_factory_.GetWeakPtr()))); |
| 237 |
| 238 input_device_change_observer_.reset(new InputDeviceChangeObserver(this)); |
237 } | 239 } |
238 | 240 |
239 RenderViewHostImpl::~RenderViewHostImpl() { | 241 RenderViewHostImpl::~RenderViewHostImpl() { |
240 if (ResourceDispatcherHostImpl::Get()) { | 242 if (ResourceDispatcherHostImpl::Get()) { |
241 BrowserThread::PostTask( | 243 BrowserThread::PostTask( |
242 BrowserThread::IO, FROM_HERE, | 244 BrowserThread::IO, FROM_HERE, |
243 base::Bind(&ResourceDispatcherHostImpl::OnRenderViewHostDeleted, | 245 base::Bind(&ResourceDispatcherHostImpl::OnRenderViewHostDeleted, |
244 base::Unretained(ResourceDispatcherHostImpl::Get()), | 246 base::Unretained(ResourceDispatcherHostImpl::Get()), |
245 GetProcess()->GetID(), GetRoutingID())); | 247 GetProcess()->GetID(), GetRoutingID())); |
246 } | 248 } |
247 | |
248 delegate_->RenderViewDeleted(this); | 249 delegate_->RenderViewDeleted(this); |
249 GetProcess()->RemoveObserver(this); | 250 GetProcess()->RemoveObserver(this); |
250 } | 251 } |
251 | 252 |
252 RenderViewHostDelegate* RenderViewHostImpl::GetDelegate() const { | 253 RenderViewHostDelegate* RenderViewHostImpl::GetDelegate() const { |
253 return delegate_; | 254 return delegate_; |
254 } | 255 } |
255 | 256 |
256 SiteInstanceImpl* RenderViewHostImpl::GetSiteInstance() const { | 257 SiteInstanceImpl* RenderViewHostImpl::GetSiteInstance() const { |
257 return instance_.get(); | 258 return instance_.get(); |
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
898 // This is defensive code to avoid infinite loops due to code run inside | 899 // This is defensive code to avoid infinite loops due to code run inside |
899 // UpdateWebkitPreferences() accidentally updating more preferences and thus | 900 // UpdateWebkitPreferences() accidentally updating more preferences and thus |
900 // calling back into this code. See crbug.com/398751 for one past example. | 901 // calling back into this code. See crbug.com/398751 for one past example. |
901 if (updating_web_preferences_) | 902 if (updating_web_preferences_) |
902 return; | 903 return; |
903 updating_web_preferences_ = true; | 904 updating_web_preferences_ = true; |
904 UpdateWebkitPreferences(ComputeWebkitPrefs()); | 905 UpdateWebkitPreferences(ComputeWebkitPrefs()); |
905 updating_web_preferences_ = false; | 906 updating_web_preferences_ = false; |
906 } | 907 } |
907 | 908 |
| 909 bool RenderViewHostImpl::InputDeviceFeaturesChanged() { |
| 910 WebPreferences prefs = GetWebkitPreferences(); |
| 911 int available_pointer_types, available_hover_types; |
| 912 std::tie(available_pointer_types, available_hover_types) = |
| 913 ui::GetAvailablePointerAndHoverTypes(); |
| 914 return prefs.available_pointer_types != available_pointer_types || |
| 915 prefs.available_hover_types != available_hover_types; |
| 916 } |
| 917 |
908 void RenderViewHostImpl::DisableScrollbarsForThreshold(const gfx::Size& size) { | 918 void RenderViewHostImpl::DisableScrollbarsForThreshold(const gfx::Size& size) { |
909 Send(new ViewMsg_DisableScrollbarsForSmallWindows(GetRoutingID(), size)); | 919 Send(new ViewMsg_DisableScrollbarsForSmallWindows(GetRoutingID(), size)); |
910 } | 920 } |
911 | 921 |
912 void RenderViewHostImpl::EnablePreferredSizeMode() { | 922 void RenderViewHostImpl::EnablePreferredSizeMode() { |
913 Send(new ViewMsg_EnablePreferredSizeChangedMode(GetRoutingID())); | 923 Send(new ViewMsg_EnablePreferredSizeChangedMode(GetRoutingID())); |
914 } | 924 } |
915 | 925 |
916 void RenderViewHostImpl::EnableAutoResize(const gfx::Size& min_size, | 926 void RenderViewHostImpl::EnableAutoResize(const gfx::Size& min_size, |
917 const gfx::Size& max_size) { | 927 const gfx::Size& max_size) { |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
961 } | 971 } |
962 | 972 |
963 void RenderViewHostImpl::ClosePageTimeout() { | 973 void RenderViewHostImpl::ClosePageTimeout() { |
964 if (delegate_->ShouldIgnoreUnresponsiveRenderer()) | 974 if (delegate_->ShouldIgnoreUnresponsiveRenderer()) |
965 return; | 975 return; |
966 | 976 |
967 ClosePageIgnoringUnloadEvents(); | 977 ClosePageIgnoringUnloadEvents(); |
968 } | 978 } |
969 | 979 |
970 } // namespace content | 980 } // namespace content |
OLD | NEW |