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

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: Remove 'anonymous'. Created 4 years, 7 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 #include "content/public/common/content_constants.h" 108 #include "content/public/common/content_constants.h"
109 #include "content/public/common/content_switches.h" 109 #include "content/public/common/content_switches.h"
110 #include "content/public/common/page_zoom.h" 110 #include "content/public/common/page_zoom.h"
111 #include "content/public/common/result_codes.h" 111 #include "content/public/common/result_codes.h"
112 #include "content/public/common/security_style.h" 112 #include "content/public/common/security_style.h"
113 #include "content/public/common/url_constants.h" 113 #include "content/public/common/url_constants.h"
114 #include "content/public/common/url_utils.h" 114 #include "content/public/common/url_utils.h"
115 #include "content/public/common/web_preferences.h" 115 #include "content/public/common/web_preferences.h"
116 #include "mojo/common/url_type_converters.h" 116 #include "mojo/common/url_type_converters.h"
117 #include "mojo/converters/geometry/geometry_type_converters.h" 117 #include "mojo/converters/geometry/geometry_type_converters.h"
118 #include "net/base/url_util.h"
118 #include "net/http/http_cache.h" 119 #include "net/http/http_cache.h"
119 #include "net/http/http_transaction_factory.h" 120 #include "net/http/http_transaction_factory.h"
120 #include "net/url_request/url_request_context.h" 121 #include "net/url_request/url_request_context.h"
121 #include "net/url_request/url_request_context_getter.h" 122 #include "net/url_request/url_request_context_getter.h"
122 #include "skia/public/type_converters.h" 123 #include "skia/public/type_converters.h"
123 #include "third_party/WebKit/public/web/WebSandboxFlags.h" 124 #include "third_party/WebKit/public/web/WebSandboxFlags.h"
124 #include "third_party/skia/include/core/SkBitmap.h" 125 #include "third_party/skia/include/core/SkBitmap.h"
125 #include "ui/accessibility/ax_tree_combiner.h" 126 #include "ui/accessibility/ax_tree_combiner.h"
126 #include "ui/base/layout.h" 127 #include "ui/base/layout.h"
127 #include "ui/gl/gl_switches.h" 128 #include "ui/gl/gl_switches.h"
(...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after
903 // them into a single tree and call |callback| with that result, then 904 // them into a single tree and call |callback| with that result, then
904 // delete |combiner|. 905 // delete |combiner|.
905 AXTreeSnapshotCombiner* combiner = new AXTreeSnapshotCombiner(callback); 906 AXTreeSnapshotCombiner* combiner = new AXTreeSnapshotCombiner(callback);
906 for (FrameTreeNode* frame_tree_node : frame_tree_.Nodes()) { 907 for (FrameTreeNode* frame_tree_node : frame_tree_.Nodes()) {
907 bool is_root = frame_tree_node->parent() == nullptr; 908 bool is_root = frame_tree_node->parent() == nullptr;
908 frame_tree_node->current_frame_host()->RequestAXTreeSnapshot( 909 frame_tree_node->current_frame_host()->RequestAXTreeSnapshot(
909 combiner->AddFrame(is_root)); 910 combiner->AddFrame(is_root));
910 } 911 }
911 } 912 }
912 913
914 void WebContentsImpl::SetTemporaryZoomLevel(double level,
915 bool temporary_zoom_enabled) {
916 SendPageMessage(new PageMsg_SetZoomLevel(
917 MSG_ROUTING_NONE,
918 temporary_zoom_enabled ? PageMsg_SetZoomLevel_Command::SET_TEMPORARY
919 : PageMsg_SetZoomLevel_Command::CLEAR_TEMPORARY,
920 level));
921 }
922
923 void WebContentsImpl::UpdateZoom(double level) {
924 // Individual frames may still ignore the new zoom level if their RenderView
925 // contains a plugin document or if it uses a temporary zoom level.
926 SendPageMessage(new PageMsg_SetZoomLevel(
927 MSG_ROUTING_NONE,
928 PageMsg_SetZoomLevel_Command::USE_CURRENT_TEMPORARY_MODE, level));
929 }
930
931 void WebContentsImpl::UpdateZoomIfNecessary(const std::string& scheme,
932 const std::string& host,
933 double level) {
934 NavigationEntry* entry = GetController().GetLastCommittedEntry();
935 if (!entry)
936 return;
937
938 GURL url = HostZoomMap::GetURLFromEntry(entry);
939 if (host != net::GetHostOrSpecFromURL(url) ||
940 (!scheme.empty() && !url.SchemeIs(scheme))) {
941 return;
942 }
943
944 UpdateZoom(level);
945 }
946
913 WebUI* WebContentsImpl::CreateSubframeWebUI(const GURL& url, 947 WebUI* WebContentsImpl::CreateSubframeWebUI(const GURL& url,
914 const std::string& frame_name) { 948 const std::string& frame_name) {
915 DCHECK(!frame_name.empty()); 949 DCHECK(!frame_name.empty());
916 return CreateWebUI(url, frame_name); 950 return CreateWebUI(url, frame_name);
917 } 951 }
918 952
919 WebUI* WebContentsImpl::GetWebUI() const { 953 WebUI* WebContentsImpl::GetWebUI() const {
920 WebUI* commited_web_ui = GetCommittedWebUI(); 954 WebUI* commited_web_ui = GetCommittedWebUI();
921 return commited_web_ui ? commited_web_ui 955 return commited_web_ui ? commited_web_ui
922 : GetRenderManager()->GetNavigatingWebUI(); 956 : GetRenderManager()->GetNavigatingWebUI();
(...skipping 3069 matching lines...) Expand 10 before | Expand all | Expand 10 after
3992 base::Bind(&WebContentsImpl::OnDialogClosed, base::Unretained(this), 4026 base::Bind(&WebContentsImpl::OnDialogClosed, base::Unretained(this),
3993 render_frame_host->GetProcess()->GetID(), 4027 render_frame_host->GetProcess()->GetID(),
3994 render_frame_host->GetRoutingID(), reply_msg, 4028 render_frame_host->GetRoutingID(), reply_msg,
3995 false)); 4029 false));
3996 } 4030 }
3997 4031
3998 WebContents* WebContentsImpl::GetAsWebContents() { 4032 WebContents* WebContentsImpl::GetAsWebContents() {
3999 return this; 4033 return this;
4000 } 4034 }
4001 4035
4036 double WebContentsImpl::GetPendingPageZoomLevel() {
4037 NavigationEntry* pending_entry = GetController().GetPendingEntry();
4038 if (!pending_entry)
4039 return HostZoomMap::GetZoomLevel(this);
4040
4041 GURL url = pending_entry->GetURL();
4042 return HostZoomMap::GetForWebContents(this)->GetZoomLevelForHostAndScheme(
4043 url.scheme(), net::GetHostOrSpecFromURL(url));
4044 }
4045
4002 bool WebContentsImpl::IsNeverVisible() { 4046 bool WebContentsImpl::IsNeverVisible() {
4003 if (!delegate_) 4047 if (!delegate_)
4004 return false; 4048 return false;
4005 return delegate_->IsNeverVisible(this); 4049 return delegate_->IsNeverVisible(this);
4006 } 4050 }
4007 4051
4008 RenderViewHostDelegateView* WebContentsImpl::GetDelegateView() { 4052 RenderViewHostDelegateView* WebContentsImpl::GetDelegateView() {
4009 return render_view_host_delegate_view_; 4053 return render_view_host_delegate_view_;
4010 } 4054 }
4011 4055
(...skipping 951 matching lines...) Expand 10 before | Expand all | Expand 10 after
4963 for (RenderViewHost* render_view_host : render_view_host_set) 5007 for (RenderViewHost* render_view_host : render_view_host_set)
4964 render_view_host->OnWebkitPreferencesChanged(); 5008 render_view_host->OnWebkitPreferencesChanged();
4965 } 5009 }
4966 5010
4967 void WebContentsImpl::SetJavaScriptDialogManagerForTesting( 5011 void WebContentsImpl::SetJavaScriptDialogManagerForTesting(
4968 JavaScriptDialogManager* dialog_manager) { 5012 JavaScriptDialogManager* dialog_manager) {
4969 dialog_manager_ = dialog_manager; 5013 dialog_manager_ = dialog_manager;
4970 } 5014 }
4971 5015
4972 } // namespace content 5016 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698