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