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

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

Issue 1804023002: Fix page zoom to be frame-centric for out-of-process frames. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments, exclude part of test since not supported on Android. Created 4 years, 8 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 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 efb92b12f9284cd5bd3c9938884c7443cfeac6f7..4467a7516ccfc461288d7f58302b91e4e56b8d4c 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -115,6 +115,7 @@
#include "content/public/common/web_preferences.h"
#include "mojo/common/url_type_converters.h"
#include "mojo/converters/geometry/geometry_type_converters.h"
+#include "net/base/url_util.h"
#include "net/http/http_cache.h"
#include "net/http/http_transaction_factory.h"
#include "net/url_request/url_request_context.h"
@@ -907,6 +908,39 @@ void WebContentsImpl::RequestAXTreeSnapshot(AXTreeSnapshotCallback callback) {
}
}
+void WebContentsImpl::SetTemporaryZoomLevel(double level,
+ bool temporary_zoom_enabled) {
+ SendPageMessage(new PageMsg_SetZoomLevel(
+ MSG_ROUTING_NONE,
+ temporary_zoom_enabled ? PageMsg_SetZoomLevel_Command::SET_TEMPORARY
+ : PageMsg_SetZoomLevel_Command::CLEAR_TEMPORARY,
+ level));
+}
+
+void WebContentsImpl::UpdateZoom(double level) {
+ // Individual frames may still ignore the new zoom level if their RenderView
+ // contains a plugin document or if it uses a temporary zoom level.
+ SendPageMessage(new PageMsg_SetZoomLevel(
+ MSG_ROUTING_NONE,
+ PageMsg_SetZoomLevel_Command::USE_CURRENT_TEMPORARY_MODE, level));
+}
+
+void WebContentsImpl::UpdateZoomIfNecessary(const std::string& scheme,
+ const std::string& host,
+ double level) {
+ NavigationEntry* entry = GetController().GetLastCommittedEntry();
+ if (!entry)
+ return;
+
+ GURL url = HostZoomMap::GetURLFromEntry(entry);
+ if (host != net::GetHostOrSpecFromURL(url) ||
+ (!scheme.empty() && !url.SchemeIs(scheme))) {
+ return;
+ }
+
+ UpdateZoom(level);
+}
+
WebUI* WebContentsImpl::CreateSubframeWebUI(const GURL& url,
const std::string& frame_name) {
DCHECK(!frame_name.empty());
@@ -4027,6 +4061,16 @@ WebContents* WebContentsImpl::GetAsWebContents() {
return this;
}
+double WebContentsImpl::GetPendingPageZoomLevel() {
+ NavigationEntry* pending_entry = GetController().GetPendingEntry();
+ if (!pending_entry)
+ return HostZoomMap::GetZoomLevel(this);
+
+ GURL url = pending_entry->GetURL();
alexmos 2016/04/27 23:39:51 What prompted adding this pending logic? Presumab
wjmaclean 2016/04/28 13:20:11 They did, but while debugging the Android test iss
alexmos 2016/04/28 17:32:12 I think this makes sense. Just to double-check on
wjmaclean 2016/04/29 13:40:41 I believe that render views lose their 'temporary'
+ return HostZoomMap::GetForWebContents(this)->GetZoomLevelForHostAndScheme(
+ url.scheme(), net::GetHostOrSpecFromURL(url));
+}
+
bool WebContentsImpl::IsNeverVisible() {
if (!delegate_)
return false;

Powered by Google App Engine
This is Rietveld 408576698