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 a95aa74113412006f4a541f9b2f970eec63bf469..30c7cf80602d62b603c650458b1ea1bb31e63e48 100644 |
| --- a/content/browser/web_contents/web_contents_impl.cc |
| +++ b/content/browser/web_contents/web_contents_impl.cc |
| @@ -113,6 +113,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" |
| @@ -861,6 +862,38 @@ void WebContentsImpl::RequestAXTreeSnapshot(AXTreeSnapshotCallback callback) { |
| GetMainFrame()->RequestAXTreeSnapshot(callback); |
| } |
| +void WebContentsImpl::SetTemporaryZoomLevel(double level, bool is_temporary) { |
| + SendPageMessage(new PageMsg_SetZoomLevel( |
| + MSG_ROUTING_NONE, |
| + is_temporary ? PageMsg_SetZoomLevel_Command::ZOOM_SET_TEMPORARY |
| + : PageMsg_SetZoomLevel_Command::ZOOM_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::ZOOM_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() && scheme != url.scheme())) { |
|
ncarter (slow)
2016/04/11 22:17:03
(!scheme.empty() && !url.SchemeIs(scheme))
wjmaclean
2016/04/13 18:47:47
Done.
|
| + return; |
| + } |
| + |
| + UpdateZoom(level); |
| +} |
| + |
| WebUI* WebContentsImpl::CreateSubframeWebUI(const GURL& url, |
| const std::string& frame_name) { |
| DCHECK(!frame_name.empty()); |
| @@ -3971,6 +4004,10 @@ WebContents* WebContentsImpl::GetAsWebContents() { |
| return this; |
| } |
| +double WebContentsImpl::PageZoomLevel() { |
| + return HostZoomMap::GetZoomLevel(this); |
| +} |
| + |
| bool WebContentsImpl::IsNeverVisible() { |
| if (!delegate_) |
| return false; |