Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(300)

Unified Diff: content/browser/web_contents/web_contents_impl.cc

Issue 1408393003: Propagate pageScaleFactor to GuestViews (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove redundant initialization of AwLayoutSizer's page scale factor in tests Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/web_contents/web_contents_impl.cc
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index e01a4d5484380c82981615cd9ccd33e2f8c18092..3349b1b1eef82e3669e51b9d350ec9b4b8912d74 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -415,6 +415,7 @@ WebContentsImpl::WebContentsImpl(BrowserContext* browser_context)
BrowserAccessibilityStateImpl::GetInstance()->accessibility_mode()),
audio_stream_monitor_(this),
virtual_keyboard_requested_(false),
+ page_scale_factor_is_one_(true),
loading_weak_factory_(this) {
frame_tree_.SetFrameRemoveListener(
base::Bind(&WebContentsImpl::OnFrameRemoved,
@@ -638,6 +639,8 @@ bool WebContentsImpl::OnMessageReceived(RenderViewHost* render_view_host,
OnDidRunInsecureContent)
IPC_MESSAGE_HANDLER(ViewHostMsg_GoToEntryAtOffset, OnGoToEntryAtOffset)
IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateZoomLimits, OnUpdateZoomLimits)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_PageScaleFactorChanged,
+ OnPageScaleFactorChanged)
IPC_MESSAGE_HANDLER(ViewHostMsg_EnumerateDirectory, OnEnumerateDirectory)
IPC_MESSAGE_HANDLER(FrameHostMsg_RegisterProtocolHandler,
OnRegisterProtocolHandler)
@@ -2652,8 +2655,8 @@ int WebContentsImpl::GetMaximumZoomPercent() const {
return maximum_zoom_percent_;
}
-void WebContentsImpl::ResetPageScale() {
- Send(new ViewMsg_ResetPageScale(GetRoutingID()));
+void WebContentsImpl::SetPageScale(float page_scale_factor) {
+ Send(new ViewMsg_SetPageScale(GetRoutingID(), page_scale_factor));
}
gfx::Size WebContentsImpl::GetPreferredSize() const {
@@ -3151,6 +3154,26 @@ void WebContentsImpl::OnUpdateZoomLimits(int minimum_percent,
maximum_zoom_percent_ = maximum_percent;
}
+void WebContentsImpl::OnPageScaleFactorChanged(float page_scale_factor) {
wjmaclean 2015/11/18 16:37:37 is page_scale_factor always guaranteed to be diffe
Kevin McNee - google account 2015/11/18 19:41:34 We only get notifications when the page scale fact
+ bool is_one = page_scale_factor == 1.f;
+ if (is_one != page_scale_factor_is_one_) {
+ page_scale_factor_is_one_ = is_one;
+
+ HostZoomMapImpl* host_zoom_map =
+ static_cast<HostZoomMapImpl*>(HostZoomMap::GetForWebContents(this));
+
+ if (host_zoom_map && GetRenderProcessHost()) {
+ host_zoom_map->SetPageScaleFactorIsOneForView(
+ GetRenderProcessHost()->GetID(), GetRoutingID(),
+ page_scale_factor_is_one_);
+ }
+ }
+
+ FOR_EACH_OBSERVER(WebContentsObserver,
+ observers_,
+ OnPageScaleFactorChanged(page_scale_factor));
+}
+
void WebContentsImpl::OnEnumerateDirectory(int request_id,
const base::FilePath& path) {
if (!delegate_)

Powered by Google App Engine
This is Rietveld 408576698