Chromium Code Reviews| 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 a938e330d89984cf0a2911855a2209a2f6ea33ba..2eef7f1910bf9b175fa64777c66e7d58b81f30ed 100644 |
| --- a/content/browser/web_contents/web_contents_impl.cc |
| +++ b/content/browser/web_contents/web_contents_impl.cc |
| @@ -413,6 +413,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, |
| @@ -637,6 +638,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) |
| @@ -2618,8 +2621,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 { |
| @@ -3117,6 +3120,28 @@ void WebContentsImpl::OnUpdateZoomLimits(int minimum_percent, |
| maximum_zoom_percent_ = maximum_percent; |
| } |
| +void WebContentsImpl::OnPageScaleFactorChanged(float page_scale_factor) { |
| + bool is_one = page_scale_factor == 1.f; |
| + if (is_one != page_scale_factor_is_one_) { |
| + page_scale_factor_is_one_ = is_one; |
| + |
| + if (GetSiteInstance()) { |
| + HostZoomMapImpl* host_zoom_map = |
| + static_cast<HostZoomMapImpl*>(HostZoomMap::Get(GetSiteInstance())); |
|
Charlie Reis
2015/10/21 21:37:09
I'm concerned about this, because there isn't a si
wjmaclean
2015/10/22 15:03:14
I would like to suggest that we do land this chang
Fady Samuel
2015/10/22 15:09:01
I'm not sure this needs changing for OOPIFs.
Zoom
Charlie Reis
2015/10/22 19:09:25
Sure.
Kevin McNee - google account
2015/10/22 20:28:48
Done.
|
| + |
| + 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_) |