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

Side by Side 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 alexmos@ comments, run two experiments. 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 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 #include "content/public/common/content_constants.h" 105 #include "content/public/common/content_constants.h"
106 #include "content/public/common/content_switches.h" 106 #include "content/public/common/content_switches.h"
107 #include "content/public/common/page_zoom.h" 107 #include "content/public/common/page_zoom.h"
108 #include "content/public/common/result_codes.h" 108 #include "content/public/common/result_codes.h"
109 #include "content/public/common/security_style.h" 109 #include "content/public/common/security_style.h"
110 #include "content/public/common/url_constants.h" 110 #include "content/public/common/url_constants.h"
111 #include "content/public/common/url_utils.h" 111 #include "content/public/common/url_utils.h"
112 #include "content/public/common/web_preferences.h" 112 #include "content/public/common/web_preferences.h"
113 #include "mojo/common/url_type_converters.h" 113 #include "mojo/common/url_type_converters.h"
114 #include "mojo/converters/geometry/geometry_type_converters.h" 114 #include "mojo/converters/geometry/geometry_type_converters.h"
115 #include "net/base/url_util.h"
115 #include "net/http/http_cache.h" 116 #include "net/http/http_cache.h"
116 #include "net/http/http_transaction_factory.h" 117 #include "net/http/http_transaction_factory.h"
117 #include "net/url_request/url_request_context.h" 118 #include "net/url_request/url_request_context.h"
118 #include "net/url_request/url_request_context_getter.h" 119 #include "net/url_request/url_request_context_getter.h"
119 #include "skia/public/type_converters.h" 120 #include "skia/public/type_converters.h"
120 #include "third_party/WebKit/public/web/WebSandboxFlags.h" 121 #include "third_party/WebKit/public/web/WebSandboxFlags.h"
121 #include "third_party/skia/include/core/SkBitmap.h" 122 #include "third_party/skia/include/core/SkBitmap.h"
122 #include "ui/base/layout.h" 123 #include "ui/base/layout.h"
123 #include "ui/gfx/display.h" 124 #include "ui/gfx/display.h"
124 #include "ui/gfx/screen.h" 125 #include "ui/gfx/screen.h"
(...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after
852 SetAccessibilityMode(RemoveAccessibilityModeFrom(accessibility_mode_, mode)); 853 SetAccessibilityMode(RemoveAccessibilityModeFrom(accessibility_mode_, mode));
853 } 854 }
854 855
855 void WebContentsImpl::RequestAXTreeSnapshot(AXTreeSnapshotCallback callback) { 856 void WebContentsImpl::RequestAXTreeSnapshot(AXTreeSnapshotCallback callback) {
856 // TODO(dmazzoni): http://crbug.com/475608 This only returns the 857 // TODO(dmazzoni): http://crbug.com/475608 This only returns the
857 // accessibility tree from the main frame and everything in the 858 // accessibility tree from the main frame and everything in the
858 // same site instance. 859 // same site instance.
859 GetMainFrame()->RequestAXTreeSnapshot(callback); 860 GetMainFrame()->RequestAXTreeSnapshot(callback);
860 } 861 }
861 862
863 void WebContentsImpl::SetTemporaryZoomLevel(double level, bool is_temporary) {
864 SendToAllFrames(new FrameMsg_SetTemporaryZoomLevel(MSG_ROUTING_NONE, level,
865 is_temporary));
866 }
867
868 void WebContentsImpl::UpdateZoom(double level) {
869 // Individual frames may still ignore the new zoom level if their RenderView
870 // contains a plugin document or if it uses a temporary zoom level.
871 SendToAllFrames(new FrameMsg_SetPageZoomLevel(MSG_ROUTING_NONE, level));
872 }
873
874 void WebContentsImpl::UpdateZoomIfNecessary(const std::string& scheme,
875 const std::string& host,
876 double level) {
877 NavigationEntry* entry = GetController().GetLastCommittedEntry();
878 if (!entry)
879 return;
880
881 GURL url = HostZoomMap::GetURLFromEntry(entry);
882 if (host != net::GetHostOrSpecFromURL(url) ||
883 (!scheme.empty() && scheme != url.scheme())) {
884 return;
885 }
886
887 UpdateZoom(level);
888 }
889
862 WebUI* WebContentsImpl::CreateSubframeWebUI(const GURL& url, 890 WebUI* WebContentsImpl::CreateSubframeWebUI(const GURL& url,
863 const std::string& frame_name) { 891 const std::string& frame_name) {
864 DCHECK(!frame_name.empty()); 892 DCHECK(!frame_name.empty());
865 return CreateWebUI(url, frame_name); 893 return CreateWebUI(url, frame_name);
866 } 894 }
867 895
868 WebUI* WebContentsImpl::GetWebUI() const { 896 WebUI* WebContentsImpl::GetWebUI() const {
869 WebUI* commited_web_ui = GetCommittedWebUI(); 897 WebUI* commited_web_ui = GetCommittedWebUI();
870 return commited_web_ui ? commited_web_ui 898 return commited_web_ui ? commited_web_ui
871 : GetRenderManager()->GetNavigatingWebUI(); 899 : GetRenderManager()->GetNavigatingWebUI();
(...skipping 3964 matching lines...) Expand 10 before | Expand all | Expand 10 after
4836 else 4864 else
4837 WasHidden(); 4865 WasHidden();
4838 } 4866 }
4839 4867
4840 void WebContentsImpl::SetJavaScriptDialogManagerForTesting( 4868 void WebContentsImpl::SetJavaScriptDialogManagerForTesting(
4841 JavaScriptDialogManager* dialog_manager) { 4869 JavaScriptDialogManager* dialog_manager) {
4842 dialog_manager_ = dialog_manager; 4870 dialog_manager_ = dialog_manager;
4843 } 4871 }
4844 4872
4845 } // namespace content 4873 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698