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

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: Convert to use PageMsg instead of FrameMsg. 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) {
ncarter (slow) 2016/04/11 22:17:03 is_temporary -> temporary_zoom_enabled
wjmaclean 2016/04/13 18:47:46 Done.
864 SendPageMessage(new PageMsg_SetZoomLevel(
865 MSG_ROUTING_NONE,
866 is_temporary ? ZOOM_SET_TEMPORARY : ZOOM_CLEAR_TEMPORARY, level));
867 }
868
869 void WebContentsImpl::UpdateZoom(double level) {
870 // Individual frames may still ignore the new zoom level if their RenderView
871 // contains a plugin document or if it uses a temporary zoom level.
872 SendPageMessage(new PageMsg_SetZoomLevel(
873 MSG_ROUTING_NONE, ZOOM_USE_CURRENT_TEMPORARY_MODE, level));
874 }
875
876 void WebContentsImpl::UpdateZoomIfNecessary(const std::string& scheme,
877 const std::string& host,
878 double level) {
879 NavigationEntry* entry = GetController().GetLastCommittedEntry();
880 if (!entry)
881 return;
882
883 GURL url = HostZoomMap::GetURLFromEntry(entry);
884 if (host != net::GetHostOrSpecFromURL(url) ||
885 (!scheme.empty() && scheme != url.scheme())) {
886 return;
887 }
888
889 UpdateZoom(level);
890 }
891
862 WebUI* WebContentsImpl::CreateSubframeWebUI(const GURL& url, 892 WebUI* WebContentsImpl::CreateSubframeWebUI(const GURL& url,
863 const std::string& frame_name) { 893 const std::string& frame_name) {
864 DCHECK(!frame_name.empty()); 894 DCHECK(!frame_name.empty());
865 return CreateWebUI(url, frame_name); 895 return CreateWebUI(url, frame_name);
866 } 896 }
867 897
868 WebUI* WebContentsImpl::GetWebUI() const { 898 WebUI* WebContentsImpl::GetWebUI() const {
869 WebUI* commited_web_ui = GetCommittedWebUI(); 899 WebUI* commited_web_ui = GetCommittedWebUI();
870 return commited_web_ui ? commited_web_ui 900 return commited_web_ui ? commited_web_ui
871 : GetRenderManager()->GetNavigatingWebUI(); 901 : GetRenderManager()->GetNavigatingWebUI();
(...skipping 3705 matching lines...) Expand 10 before | Expand all | Expand 10 after
4577 CreateRenderWidgetHostViewForRenderManager(render_view_host); 4607 CreateRenderWidgetHostViewForRenderManager(render_view_host);
4578 4608
4579 // Make sure we use the correct starting page_id in the new RenderView. 4609 // Make sure we use the correct starting page_id in the new RenderView.
4580 UpdateMaxPageIDIfNecessary(render_view_host); 4610 UpdateMaxPageIDIfNecessary(render_view_host);
4581 int32_t max_page_id = 4611 int32_t max_page_id =
4582 GetMaxPageIDForSiteInstance(render_view_host->GetSiteInstance()); 4612 GetMaxPageIDForSiteInstance(render_view_host->GetSiteInstance());
4583 4613
4584 if (!static_cast<RenderViewHostImpl*>(render_view_host) 4614 if (!static_cast<RenderViewHostImpl*>(render_view_host)
4585 ->CreateRenderView(opener_frame_routing_id, proxy_routing_id, 4615 ->CreateRenderView(opener_frame_routing_id, proxy_routing_id,
4586 max_page_id, replicated_frame_state, 4616 max_page_id, replicated_frame_state,
4587 created_with_opener_)) { 4617 created_with_opener_,
4618 HostZoomMap::GetZoomLevel(this))) {
4588 return false; 4619 return false;
4589 } 4620 }
4590 4621
4591 SetHistoryOffsetAndLengthForView(render_view_host, 4622 SetHistoryOffsetAndLengthForView(render_view_host,
4592 controller_.GetLastCommittedEntryIndex(), 4623 controller_.GetLastCommittedEntryIndex(),
4593 controller_.GetEntryCount()); 4624 controller_.GetEntryCount());
4594 4625
4595 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) 4626 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID)
4596 // Force a ViewMsg_Resize to be sent, needed to make plugins show up on 4627 // Force a ViewMsg_Resize to be sent, needed to make plugins show up on
4597 // linux. See crbug.com/83941. 4628 // linux. See crbug.com/83941.
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
4836 else 4867 else
4837 WasHidden(); 4868 WasHidden();
4838 } 4869 }
4839 4870
4840 void WebContentsImpl::SetJavaScriptDialogManagerForTesting( 4871 void WebContentsImpl::SetJavaScriptDialogManagerForTesting(
4841 JavaScriptDialogManager* dialog_manager) { 4872 JavaScriptDialogManager* dialog_manager) {
4842 dialog_manager_ = dialog_manager; 4873 dialog_manager_ = dialog_manager;
4843 } 4874 }
4844 4875
4845 } // namespace content 4876 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698