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 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_) |