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

Side by Side Diff: content/browser/web_contents/web_contents_impl.cc

Issue 2122023002: Cross-process frames should be notified of device scale factor changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test. Created 4 years, 5 months 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 unified diff | Download patch
OLDNEW
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 952 matching lines...) Expand 10 before | Expand all | Expand 10 after
963 963
964 GURL url = HostZoomMap::GetURLFromEntry(entry); 964 GURL url = HostZoomMap::GetURLFromEntry(entry);
965 if (host != net::GetHostOrSpecFromURL(url) || 965 if (host != net::GetHostOrSpecFromURL(url) ||
966 (!scheme.empty() && !url.SchemeIs(scheme))) { 966 (!scheme.empty() && !url.SchemeIs(scheme))) {
967 return; 967 return;
968 } 968 }
969 969
970 UpdateZoom(level); 970 UpdateZoom(level);
971 } 971 }
972 972
973 void WebContentsImpl::UpdateDeviceScaleFactor(double device_scale_factor) {
974 SendPageMessage(
975 new PageMsg_SetDeviceScaleFactor(MSG_ROUTING_NONE, device_scale_factor));
oshima 2016/07/07 22:45:43 Doesn't a oop frame receive ScreenInfo? When dsf c
wjmaclean 2016/07/08 17:38:33 The OOP frame is informed, but in a sort of round-
976 }
977
978 double WebContentsImpl::DefaultDeviceScaleFactor() {
979 // TODO(wjmaclean): is it simpler to just remember the value from the last
980 // call to UpdateDeviceScaleFactor()? It's perhaps not the sort of state we
981 // expect WebContents to be hanging on to.
982 RenderWidgetHostViewBase* rwhv =
983 static_cast<RenderWidgetHostViewBase*>(GetRenderWidgetHostView());
984 if (rwhv) {
985 blink::WebScreenInfo screen_info;
986 rwhv->GetScreenInfo(&screen_info);
987 return screen_info.deviceScaleFactor;
988 }
989
990 return RenderWidgetHostDelegate::DefaultDeviceScaleFactor();
oshima 2016/07/07 22:45:43 web content's view should also knows about the cur
wjmaclean 2016/07/08 17:38:33 You mean WebContentsView? I looked there but didn'
991 }
992
973 WebUI* WebContentsImpl::CreateSubframeWebUI(const GURL& url, 993 WebUI* WebContentsImpl::CreateSubframeWebUI(const GURL& url,
974 const std::string& frame_name) { 994 const std::string& frame_name) {
975 DCHECK(!frame_name.empty()); 995 DCHECK(!frame_name.empty());
976 return CreateWebUI(url, frame_name); 996 return CreateWebUI(url, frame_name);
977 } 997 }
978 998
979 WebUI* WebContentsImpl::GetWebUI() const { 999 WebUI* WebContentsImpl::GetWebUI() const {
980 WebUI* commited_web_ui = GetCommittedWebUI(); 1000 WebUI* commited_web_ui = GetCommittedWebUI();
981 return commited_web_ui ? commited_web_ui 1001 return commited_web_ui ? commited_web_ui
982 : GetRenderManager()->GetNavigatingWebUI(); 1002 : GetRenderManager()->GetNavigatingWebUI();
(...skipping 4178 matching lines...) Expand 10 before | Expand all | Expand 10 after
5161 for (RenderViewHost* render_view_host : render_view_host_set) 5181 for (RenderViewHost* render_view_host : render_view_host_set)
5162 render_view_host->OnWebkitPreferencesChanged(); 5182 render_view_host->OnWebkitPreferencesChanged();
5163 } 5183 }
5164 5184
5165 void WebContentsImpl::SetJavaScriptDialogManagerForTesting( 5185 void WebContentsImpl::SetJavaScriptDialogManagerForTesting(
5166 JavaScriptDialogManager* dialog_manager) { 5186 JavaScriptDialogManager* dialog_manager) {
5167 dialog_manager_ = dialog_manager; 5187 dialog_manager_ = dialog_manager;
5168 } 5188 }
5169 5189
5170 } // namespace content 5190 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698