| 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 636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 893 // This is defensive code to avoid infinite loops due to code run inside | 895 // This is defensive code to avoid infinite loops due to code run inside |
| 894 // UpdateWebkitPreferences() accidentally updating more preferences and thus | 896 // UpdateWebkitPreferences() accidentally updating more preferences and thus |
| 895 // calling back into this code. See crbug.com/398751 for one past example. | 897 // calling back into this code. See crbug.com/398751 for one past example. |
| 896 if (updating_web_preferences_) | 898 if (updating_web_preferences_) |
| 897 return; | 899 return; |
| 898 updating_web_preferences_ = true; | 900 updating_web_preferences_ = true; |
| 899 UpdateWebkitPreferences(ComputeWebkitPrefs()); | 901 UpdateWebkitPreferences(ComputeWebkitPrefs()); |
| 900 updating_web_preferences_ = false; | 902 updating_web_preferences_ = false; |
| 901 } | 903 } |
| 902 | 904 |
| 905 bool RenderViewHostImpl::InputDeviceFeaturesChanged() { |
| 906 WebPreferences prefs = GetWebkitPreferences(); |
| 907 int available_pointer_types, available_hover_types; |
| 908 std::tie(available_pointer_types, available_hover_types) = |
| 909 ui::GetAvailablePointerAndHoverTypes(); |
| 910 return prefs.available_pointer_types != available_pointer_types || |
| 911 prefs.available_hover_types != available_hover_types; |
| 912 } |
| 913 |
| 903 void RenderViewHostImpl::DisableScrollbarsForThreshold(const gfx::Size& size) { | 914 void RenderViewHostImpl::DisableScrollbarsForThreshold(const gfx::Size& size) { |
| 904 Send(new ViewMsg_DisableScrollbarsForSmallWindows(GetRoutingID(), size)); | 915 Send(new ViewMsg_DisableScrollbarsForSmallWindows(GetRoutingID(), size)); |
| 905 } | 916 } |
| 906 | 917 |
| 907 void RenderViewHostImpl::EnablePreferredSizeMode() { | 918 void RenderViewHostImpl::EnablePreferredSizeMode() { |
| 908 Send(new ViewMsg_EnablePreferredSizeChangedMode(GetRoutingID())); | 919 Send(new ViewMsg_EnablePreferredSizeChangedMode(GetRoutingID())); |
| 909 } | 920 } |
| 910 | 921 |
| 911 void RenderViewHostImpl::EnableAutoResize(const gfx::Size& min_size, | 922 void RenderViewHostImpl::EnableAutoResize(const gfx::Size& min_size, |
| 912 const gfx::Size& max_size) { | 923 const gfx::Size& max_size) { |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 956 } | 967 } |
| 957 | 968 |
| 958 void RenderViewHostImpl::ClosePageTimeout() { | 969 void RenderViewHostImpl::ClosePageTimeout() { |
| 959 if (delegate_->ShouldIgnoreUnresponsiveRenderer()) | 970 if (delegate_->ShouldIgnoreUnresponsiveRenderer()) |
| 960 return; | 971 return; |
| 961 | 972 |
| 962 ClosePageIgnoringUnloadEvents(); | 973 ClosePageIgnoringUnloadEvents(); |
| 963 } | 974 } |
| 964 | 975 |
| 965 } // namespace content | 976 } // namespace content |
| OLD | NEW |