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 ba1d0cdbeb4fa6e373675f002c4a6736d0433c15..421ef30698c74f652554469a5cacc89f1b4926eb 100644 |
--- a/content/browser/web_contents/web_contents_impl.cc |
+++ b/content/browser/web_contents/web_contents_impl.cc |
@@ -112,6 +112,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" |
@@ -858,6 +859,35 @@ void WebContentsImpl::RequestAXTreeSnapshot(AXTreeSnapshotCallback callback) { |
GetMainFrame()->RequestAXTreeSnapshot(callback); |
} |
+void WebContentsImpl::SetTemporaryZoomLevel(double level, bool is_temporary) { |
+ SendToAllFrames(new FrameMsg_SetTemporaryZoomLevel(MSG_ROUTING_NONE, level, |
alexmos
2016/04/05 18:00:53
Not being familiar with zoom, can you please expla
wjmaclean
2016/04/05 20:22:00
Via the extensions API, a page can have a zoom lev
alexmos
2016/04/07 01:20:56
Acknowledged.
|
+ is_temporary)); |
+} |
+ |
+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. |
+ SendToAllFrames( |
alexmos
2016/04/05 18:00:54
I'm curious why we can't use SendPageMessage inste
wjmaclean
2016/04/05 20:22:00
The latter.
|
+ new FrameMsg_SetZoomLevelFromWebContents(MSG_ROUTING_NONE, 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() && scheme != url.scheme())) { |
+ // TODO(wjmaclean): verify the logic here is solid. |
+ return; |
+ } |
+ |
+ UpdateZoom(level); |
+} |
+ |
WebUI* WebContentsImpl::CreateSubframeWebUI(const GURL& url, |
const std::string& frame_name) { |
DCHECK(!frame_name.empty()); |