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; | |
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 2160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3077 | 3070 |
3078 int WebContentsImpl::GetMinimumZoomPercent() const { | 3071 int WebContentsImpl::GetMinimumZoomPercent() const { |
3079 return minimum_zoom_percent_; | 3072 return minimum_zoom_percent_; |
3080 } | 3073 } |
3081 | 3074 |
3082 int WebContentsImpl::GetMaximumZoomPercent() const { | 3075 int WebContentsImpl::GetMaximumZoomPercent() const { |
3083 return maximum_zoom_percent_; | 3076 return maximum_zoom_percent_; |
3084 } | 3077 } |
3085 | 3078 |
3086 void WebContentsImpl::SetPageScale(float page_scale_factor) { | 3079 void WebContentsImpl::SetPageScale(float page_scale_factor) { |
3087 Send(new ViewMsg_SetPageScale(GetRoutingID(), page_scale_factor)); | 3080 Send(new ViewMsg_SetPageScale(GetRenderViewHost()->GetRoutingID(), |
| 3081 page_scale_factor)); |
3088 } | 3082 } |
3089 | 3083 |
3090 gfx::Size WebContentsImpl::GetPreferredSize() const { | 3084 gfx::Size WebContentsImpl::GetPreferredSize() const { |
3091 return capturer_count_ == 0 ? preferred_size_ : preferred_size_for_capture_; | 3085 return capturer_count_ == 0 ? preferred_size_ : preferred_size_for_capture_; |
3092 } | 3086 } |
3093 | 3087 |
3094 bool WebContentsImpl::GotResponseToLockMouseRequest(bool allowed) { | 3088 bool WebContentsImpl::GotResponseToLockMouseRequest(bool allowed) { |
3095 if (GetBrowserPluginGuest()) | 3089 if (GetBrowserPluginGuest()) |
3096 return GetBrowserPluginGuest()->LockMouse(allowed); | 3090 return GetBrowserPluginGuest()->LockMouse(allowed); |
3097 | 3091 |
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3596 void WebContentsImpl::OnPageScaleFactorChanged(float page_scale_factor) { | 3590 void WebContentsImpl::OnPageScaleFactorChanged(float page_scale_factor) { |
3597 bool is_one = page_scale_factor == 1.f; | 3591 bool is_one = page_scale_factor == 1.f; |
3598 if (is_one != page_scale_factor_is_one_) { | 3592 if (is_one != page_scale_factor_is_one_) { |
3599 page_scale_factor_is_one_ = is_one; | 3593 page_scale_factor_is_one_ = is_one; |
3600 | 3594 |
3601 HostZoomMapImpl* host_zoom_map = | 3595 HostZoomMapImpl* host_zoom_map = |
3602 static_cast<HostZoomMapImpl*>(HostZoomMap::GetForWebContents(this)); | 3596 static_cast<HostZoomMapImpl*>(HostZoomMap::GetForWebContents(this)); |
3603 | 3597 |
3604 if (host_zoom_map && GetRenderProcessHost()) { | 3598 if (host_zoom_map && GetRenderProcessHost()) { |
3605 host_zoom_map->SetPageScaleFactorIsOneForView( | 3599 host_zoom_map->SetPageScaleFactorIsOneForView( |
3606 GetRenderProcessHost()->GetID(), GetRoutingID(), | 3600 GetRenderProcessHost()->GetID(), GetRenderViewHost()->GetRoutingID(), |
3607 page_scale_factor_is_one_); | 3601 page_scale_factor_is_one_); |
3608 } | 3602 } |
3609 } | 3603 } |
3610 | 3604 |
3611 for (auto& observer : observers_) | 3605 for (auto& observer : observers_) |
3612 observer.OnPageScaleFactorChanged(page_scale_factor); | 3606 observer.OnPageScaleFactorChanged(page_scale_factor); |
3613 } | 3607 } |
3614 | 3608 |
3615 void WebContentsImpl::OnEnumerateDirectory(int request_id, | 3609 void WebContentsImpl::OnEnumerateDirectory(int request_id, |
3616 const base::FilePath& path) { | 3610 const base::FilePath& path) { |
(...skipping 1665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5282 dialog_manager_ = dialog_manager; | 5276 dialog_manager_ = dialog_manager; |
5283 } | 5277 } |
5284 | 5278 |
5285 void WebContentsImpl::RemoveBindingSet(const std::string& interface_name) { | 5279 void WebContentsImpl::RemoveBindingSet(const std::string& interface_name) { |
5286 auto it = binding_sets_.find(interface_name); | 5280 auto it = binding_sets_.find(interface_name); |
5287 if (it != binding_sets_.end()) | 5281 if (it != binding_sets_.end()) |
5288 binding_sets_.erase(it); | 5282 binding_sets_.erase(it); |
5289 } | 5283 } |
5290 | 5284 |
5291 } // namespace content | 5285 } // namespace content |
OLD | NEW |