| 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/web_contents/web_contents_impl.h" | 5 #include "content/browser/web_contents/web_contents_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <cmath> | 9 #include <cmath> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 878 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 889 } | 889 } |
| 890 | 890 |
| 891 void WebContentsImpl::SendPageMessage(IPC::Message* msg) { | 891 void WebContentsImpl::SendPageMessage(IPC::Message* msg) { |
| 892 frame_tree_.root()->render_manager()->SendPageMessage(msg, nullptr); | 892 frame_tree_.root()->render_manager()->SendPageMessage(msg, nullptr); |
| 893 } | 893 } |
| 894 | 894 |
| 895 RenderViewHostImpl* WebContentsImpl::GetRenderViewHost() const { | 895 RenderViewHostImpl* WebContentsImpl::GetRenderViewHost() const { |
| 896 return GetRenderManager()->current_host(); | 896 return GetRenderManager()->current_host(); |
| 897 } | 897 } |
| 898 | 898 |
| 899 int WebContentsImpl::GetRoutingID() const { | |
| 900 if (!GetRenderViewHost()) | |
| 901 return MSG_ROUTING_NONE; | |
| 902 | |
| 903 return GetRenderViewHost()->GetRoutingID(); | |
| 904 } | |
| 905 | |
| 906 void WebContentsImpl::CancelActiveAndPendingDialogs() { | 899 void WebContentsImpl::CancelActiveAndPendingDialogs() { |
| 907 if (dialog_manager_) { | 900 if (dialog_manager_) { |
| 908 dialog_manager_->CancelDialogs(this, | 901 dialog_manager_->CancelDialogs(this, |
| 909 false, // suppress_callbacks, | 902 false, // suppress_callbacks, |
| 910 false); // reset_state | 903 false); // reset_state |
| 911 } | 904 } |
| 912 if (browser_plugin_embedder_) | 905 if (browser_plugin_embedder_) |
| 913 browser_plugin_embedder_->CancelGuestDialogs(); | 906 browser_plugin_embedder_->CancelGuestDialogs(); |
| 914 } | 907 } |
| 915 | 908 |
| (...skipping 2156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3072 | 3065 |
| 3073 int WebContentsImpl::GetMinimumZoomPercent() const { | 3066 int WebContentsImpl::GetMinimumZoomPercent() const { |
| 3074 return minimum_zoom_percent_; | 3067 return minimum_zoom_percent_; |
| 3075 } | 3068 } |
| 3076 | 3069 |
| 3077 int WebContentsImpl::GetMaximumZoomPercent() const { | 3070 int WebContentsImpl::GetMaximumZoomPercent() const { |
| 3078 return maximum_zoom_percent_; | 3071 return maximum_zoom_percent_; |
| 3079 } | 3072 } |
| 3080 | 3073 |
| 3081 void WebContentsImpl::SetPageScale(float page_scale_factor) { | 3074 void WebContentsImpl::SetPageScale(float page_scale_factor) { |
| 3082 Send(new ViewMsg_SetPageScale(GetRoutingID(), page_scale_factor)); | 3075 Send(new ViewMsg_SetPageScale(GetRenderViewHost()->GetRoutingID(), |
| 3076 page_scale_factor)); |
| 3083 } | 3077 } |
| 3084 | 3078 |
| 3085 gfx::Size WebContentsImpl::GetPreferredSize() const { | 3079 gfx::Size WebContentsImpl::GetPreferredSize() const { |
| 3086 return capturer_count_ == 0 ? preferred_size_ : preferred_size_for_capture_; | 3080 return capturer_count_ == 0 ? preferred_size_ : preferred_size_for_capture_; |
| 3087 } | 3081 } |
| 3088 | 3082 |
| 3089 bool WebContentsImpl::GotResponseToLockMouseRequest(bool allowed) { | 3083 bool WebContentsImpl::GotResponseToLockMouseRequest(bool allowed) { |
| 3090 if (GetBrowserPluginGuest()) | 3084 if (GetBrowserPluginGuest()) |
| 3091 return GetBrowserPluginGuest()->LockMouse(allowed); | 3085 return GetBrowserPluginGuest()->LockMouse(allowed); |
| 3092 | 3086 |
| (...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3591 void WebContentsImpl::OnPageScaleFactorChanged(float page_scale_factor) { | 3585 void WebContentsImpl::OnPageScaleFactorChanged(float page_scale_factor) { |
| 3592 bool is_one = page_scale_factor == 1.f; | 3586 bool is_one = page_scale_factor == 1.f; |
| 3593 if (is_one != page_scale_factor_is_one_) { | 3587 if (is_one != page_scale_factor_is_one_) { |
| 3594 page_scale_factor_is_one_ = is_one; | 3588 page_scale_factor_is_one_ = is_one; |
| 3595 | 3589 |
| 3596 HostZoomMapImpl* host_zoom_map = | 3590 HostZoomMapImpl* host_zoom_map = |
| 3597 static_cast<HostZoomMapImpl*>(HostZoomMap::GetForWebContents(this)); | 3591 static_cast<HostZoomMapImpl*>(HostZoomMap::GetForWebContents(this)); |
| 3598 | 3592 |
| 3599 if (host_zoom_map && GetRenderProcessHost()) { | 3593 if (host_zoom_map && GetRenderProcessHost()) { |
| 3600 host_zoom_map->SetPageScaleFactorIsOneForView( | 3594 host_zoom_map->SetPageScaleFactorIsOneForView( |
| 3601 GetRenderProcessHost()->GetID(), GetRoutingID(), | 3595 GetRenderProcessHost()->GetID(), GetRenderViewHost()->GetRoutingID(), |
| 3602 page_scale_factor_is_one_); | 3596 page_scale_factor_is_one_); |
| 3603 } | 3597 } |
| 3604 } | 3598 } |
| 3605 | 3599 |
| 3606 for (auto& observer : observers_) | 3600 for (auto& observer : observers_) |
| 3607 observer.OnPageScaleFactorChanged(page_scale_factor); | 3601 observer.OnPageScaleFactorChanged(page_scale_factor); |
| 3608 } | 3602 } |
| 3609 | 3603 |
| 3610 void WebContentsImpl::OnEnumerateDirectory(int request_id, | 3604 void WebContentsImpl::OnEnumerateDirectory(int request_id, |
| 3611 const base::FilePath& path) { | 3605 const base::FilePath& path) { |
| (...skipping 1664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5276 dialog_manager_ = dialog_manager; | 5270 dialog_manager_ = dialog_manager; |
| 5277 } | 5271 } |
| 5278 | 5272 |
| 5279 void WebContentsImpl::RemoveBindingSet(const std::string& interface_name) { | 5273 void WebContentsImpl::RemoveBindingSet(const std::string& interface_name) { |
| 5280 auto it = binding_sets_.find(interface_name); | 5274 auto it = binding_sets_.find(interface_name); |
| 5281 if (it != binding_sets_.end()) | 5275 if (it != binding_sets_.end()) |
| 5282 binding_sets_.erase(it); | 5276 binding_sets_.erase(it); |
| 5283 } | 5277 } |
| 5284 | 5278 |
| 5285 } // namespace content | 5279 } // namespace content |
| OLD | NEW |