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 879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
890 } | 890 } |
891 | 891 |
892 void WebContentsImpl::SendPageMessage(IPC::Message* msg) { | 892 void WebContentsImpl::SendPageMessage(IPC::Message* msg) { |
893 frame_tree_.root()->render_manager()->SendPageMessage(msg, nullptr); | 893 frame_tree_.root()->render_manager()->SendPageMessage(msg, nullptr); |
894 } | 894 } |
895 | 895 |
896 RenderViewHostImpl* WebContentsImpl::GetRenderViewHost() const { | 896 RenderViewHostImpl* WebContentsImpl::GetRenderViewHost() const { |
897 return GetRenderManager()->current_host(); | 897 return GetRenderManager()->current_host(); |
898 } | 898 } |
899 | 899 |
900 int WebContentsImpl::GetRoutingID() const { | |
901 if (!GetRenderViewHost()) | |
902 return MSG_ROUTING_NONE; | |
Charlie Reis
2016/11/23 07:53:35
Technically there's a small risk we could see some
| |
903 | |
904 return GetRenderViewHost()->GetRoutingID(); | |
905 } | |
906 | |
907 void WebContentsImpl::CancelActiveAndPendingDialogs() { | 900 void WebContentsImpl::CancelActiveAndPendingDialogs() { |
908 if (dialog_manager_) { | 901 if (dialog_manager_) { |
909 dialog_manager_->CancelDialogs(this, | 902 dialog_manager_->CancelDialogs(this, |
910 false, // suppress_callbacks, | 903 false, // suppress_callbacks, |
911 false); // reset_state | 904 false); // reset_state |
912 } | 905 } |
913 if (browser_plugin_embedder_) | 906 if (browser_plugin_embedder_) |
914 browser_plugin_embedder_->CancelGuestDialogs(); | 907 browser_plugin_embedder_->CancelGuestDialogs(); |
915 } | 908 } |
916 | 909 |
(...skipping 2159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3076 | 3069 |
3077 int WebContentsImpl::GetMinimumZoomPercent() const { | 3070 int WebContentsImpl::GetMinimumZoomPercent() const { |
3078 return minimum_zoom_percent_; | 3071 return minimum_zoom_percent_; |
3079 } | 3072 } |
3080 | 3073 |
3081 int WebContentsImpl::GetMaximumZoomPercent() const { | 3074 int WebContentsImpl::GetMaximumZoomPercent() const { |
3082 return maximum_zoom_percent_; | 3075 return maximum_zoom_percent_; |
3083 } | 3076 } |
3084 | 3077 |
3085 void WebContentsImpl::SetPageScale(float page_scale_factor) { | 3078 void WebContentsImpl::SetPageScale(float page_scale_factor) { |
3086 Send(new ViewMsg_SetPageScale(GetRoutingID(), page_scale_factor)); | 3079 Send(new ViewMsg_SetPageScale(GetRenderViewHost()->GetRoutingID(), |
3080 page_scale_factor)); | |
3087 } | 3081 } |
3088 | 3082 |
3089 gfx::Size WebContentsImpl::GetPreferredSize() const { | 3083 gfx::Size WebContentsImpl::GetPreferredSize() const { |
3090 return capturer_count_ == 0 ? preferred_size_ : preferred_size_for_capture_; | 3084 return capturer_count_ == 0 ? preferred_size_ : preferred_size_for_capture_; |
3091 } | 3085 } |
3092 | 3086 |
3093 bool WebContentsImpl::GotResponseToLockMouseRequest(bool allowed) { | 3087 bool WebContentsImpl::GotResponseToLockMouseRequest(bool allowed) { |
3094 if (GetBrowserPluginGuest()) | 3088 if (GetBrowserPluginGuest()) |
3095 return GetBrowserPluginGuest()->LockMouse(allowed); | 3089 return GetBrowserPluginGuest()->LockMouse(allowed); |
3096 | 3090 |
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3595 void WebContentsImpl::OnPageScaleFactorChanged(float page_scale_factor) { | 3589 void WebContentsImpl::OnPageScaleFactorChanged(float page_scale_factor) { |
3596 bool is_one = page_scale_factor == 1.f; | 3590 bool is_one = page_scale_factor == 1.f; |
3597 if (is_one != page_scale_factor_is_one_) { | 3591 if (is_one != page_scale_factor_is_one_) { |
3598 page_scale_factor_is_one_ = is_one; | 3592 page_scale_factor_is_one_ = is_one; |
3599 | 3593 |
3600 HostZoomMapImpl* host_zoom_map = | 3594 HostZoomMapImpl* host_zoom_map = |
3601 static_cast<HostZoomMapImpl*>(HostZoomMap::GetForWebContents(this)); | 3595 static_cast<HostZoomMapImpl*>(HostZoomMap::GetForWebContents(this)); |
3602 | 3596 |
3603 if (host_zoom_map && GetRenderProcessHost()) { | 3597 if (host_zoom_map && GetRenderProcessHost()) { |
3604 host_zoom_map->SetPageScaleFactorIsOneForView( | 3598 host_zoom_map->SetPageScaleFactorIsOneForView( |
3605 GetRenderProcessHost()->GetID(), GetRoutingID(), | 3599 GetRenderProcessHost()->GetID(), GetRenderViewHost()->GetRoutingID(), |
3606 page_scale_factor_is_one_); | 3600 page_scale_factor_is_one_); |
3607 } | 3601 } |
3608 } | 3602 } |
3609 | 3603 |
3610 for (auto& observer : observers_) | 3604 for (auto& observer : observers_) |
3611 observer.OnPageScaleFactorChanged(page_scale_factor); | 3605 observer.OnPageScaleFactorChanged(page_scale_factor); |
3612 } | 3606 } |
3613 | 3607 |
3614 void WebContentsImpl::OnEnumerateDirectory(int request_id, | 3608 void WebContentsImpl::OnEnumerateDirectory(int request_id, |
3615 const base::FilePath& path) { | 3609 const base::FilePath& path) { |
(...skipping 1665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5281 dialog_manager_ = dialog_manager; | 5275 dialog_manager_ = dialog_manager; |
5282 } | 5276 } |
5283 | 5277 |
5284 void WebContentsImpl::RemoveBindingSet(const std::string& interface_name) { | 5278 void WebContentsImpl::RemoveBindingSet(const std::string& interface_name) { |
5285 auto it = binding_sets_.find(interface_name); | 5279 auto it = binding_sets_.find(interface_name); |
5286 if (it != binding_sets_.end()) | 5280 if (it != binding_sets_.end()) |
5287 binding_sets_.erase(it); | 5281 binding_sets_.erase(it); |
5288 } | 5282 } |
5289 | 5283 |
5290 } // namespace content | 5284 } // namespace content |
OLD | NEW |