OLD | NEW |
---|---|
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 Loading... | |
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/gfx/display.h" | 128 #include "ui/gfx/display.h" |
(...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
900 // them into a single tree and call |callback| with that result, then | 901 // them into a single tree and call |callback| with that result, then |
901 // delete |combiner|. | 902 // delete |combiner|. |
902 AXTreeSnapshotCombiner* combiner = new AXTreeSnapshotCombiner(callback); | 903 AXTreeSnapshotCombiner* combiner = new AXTreeSnapshotCombiner(callback); |
903 for (FrameTreeNode* frame_tree_node : frame_tree_.Nodes()) { | 904 for (FrameTreeNode* frame_tree_node : frame_tree_.Nodes()) { |
904 bool is_root = frame_tree_node->parent() == nullptr; | 905 bool is_root = frame_tree_node->parent() == nullptr; |
905 frame_tree_node->current_frame_host()->RequestAXTreeSnapshot( | 906 frame_tree_node->current_frame_host()->RequestAXTreeSnapshot( |
906 combiner->AddFrame(is_root)); | 907 combiner->AddFrame(is_root)); |
907 } | 908 } |
908 } | 909 } |
909 | 910 |
911 void WebContentsImpl::SetTemporaryZoomLevel(double level, | |
912 bool temporary_zoom_enabled) { | |
913 SendPageMessage(new PageMsg_SetZoomLevel( | |
914 MSG_ROUTING_NONE, | |
915 temporary_zoom_enabled ? PageMsg_SetZoomLevel_Command::SET_TEMPORARY | |
916 : PageMsg_SetZoomLevel_Command::CLEAR_TEMPORARY, | |
917 level)); | |
918 } | |
919 | |
920 void WebContentsImpl::UpdateZoom(double level) { | |
921 // Individual frames may still ignore the new zoom level if their RenderView | |
922 // contains a plugin document or if it uses a temporary zoom level. | |
923 SendPageMessage(new PageMsg_SetZoomLevel( | |
924 MSG_ROUTING_NONE, | |
925 PageMsg_SetZoomLevel_Command::USE_CURRENT_TEMPORARY_MODE, level)); | |
926 } | |
927 | |
928 void WebContentsImpl::UpdateZoomIfNecessary(const std::string& scheme, | |
929 const std::string& host, | |
930 double level) { | |
931 NavigationEntry* entry = GetController().GetLastCommittedEntry(); | |
932 if (!entry) | |
933 return; | |
934 | |
935 GURL url = HostZoomMap::GetURLFromEntry(entry); | |
936 if (host != net::GetHostOrSpecFromURL(url) || | |
937 (!scheme.empty() && !url.SchemeIs(scheme))) { | |
938 return; | |
939 } | |
940 | |
941 UpdateZoom(level); | |
942 } | |
943 | |
910 WebUI* WebContentsImpl::CreateSubframeWebUI(const GURL& url, | 944 WebUI* WebContentsImpl::CreateSubframeWebUI(const GURL& url, |
911 const std::string& frame_name) { | 945 const std::string& frame_name) { |
912 DCHECK(!frame_name.empty()); | 946 DCHECK(!frame_name.empty()); |
913 return CreateWebUI(url, frame_name); | 947 return CreateWebUI(url, frame_name); |
914 } | 948 } |
915 | 949 |
916 WebUI* WebContentsImpl::GetWebUI() const { | 950 WebUI* WebContentsImpl::GetWebUI() const { |
917 WebUI* commited_web_ui = GetCommittedWebUI(); | 951 WebUI* commited_web_ui = GetCommittedWebUI(); |
918 return commited_web_ui ? commited_web_ui | 952 return commited_web_ui ? commited_web_ui |
919 : GetRenderManager()->GetNavigatingWebUI(); | 953 : GetRenderManager()->GetNavigatingWebUI(); |
(...skipping 3100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4020 base::Bind(&WebContentsImpl::OnDialogClosed, base::Unretained(this), | 4054 base::Bind(&WebContentsImpl::OnDialogClosed, base::Unretained(this), |
4021 render_frame_host->GetProcess()->GetID(), | 4055 render_frame_host->GetProcess()->GetID(), |
4022 render_frame_host->GetRoutingID(), reply_msg, | 4056 render_frame_host->GetRoutingID(), reply_msg, |
4023 false)); | 4057 false)); |
4024 } | 4058 } |
4025 | 4059 |
4026 WebContents* WebContentsImpl::GetAsWebContents() { | 4060 WebContents* WebContentsImpl::GetAsWebContents() { |
4027 return this; | 4061 return this; |
4028 } | 4062 } |
4029 | 4063 |
4064 double WebContentsImpl::GetPendingPageZoomLevel() { | |
4065 NavigationEntry* pending_entry = GetController().GetPendingEntry(); | |
4066 if (!pending_entry) | |
4067 return HostZoomMap::GetZoomLevel(this); | |
4068 | |
4069 GURL url = pending_entry->GetURL(); | |
alexmos
2016/04/27 23:39:51
What prompted adding this pending logic? Presumab
wjmaclean
2016/04/28 13:20:11
They did, but while debugging the Android test iss
alexmos
2016/04/28 17:32:12
I think this makes sense. Just to double-check on
wjmaclean
2016/04/29 13:40:41
I believe that render views lose their 'temporary'
| |
4070 return HostZoomMap::GetForWebContents(this)->GetZoomLevelForHostAndScheme( | |
4071 url.scheme(), net::GetHostOrSpecFromURL(url)); | |
4072 } | |
4073 | |
4030 bool WebContentsImpl::IsNeverVisible() { | 4074 bool WebContentsImpl::IsNeverVisible() { |
4031 if (!delegate_) | 4075 if (!delegate_) |
4032 return false; | 4076 return false; |
4033 return delegate_->IsNeverVisible(this); | 4077 return delegate_->IsNeverVisible(this); |
4034 } | 4078 } |
4035 | 4079 |
4036 RenderViewHostDelegateView* WebContentsImpl::GetDelegateView() { | 4080 RenderViewHostDelegateView* WebContentsImpl::GetDelegateView() { |
4037 return render_view_host_delegate_view_; | 4081 return render_view_host_delegate_view_; |
4038 } | 4082 } |
4039 | 4083 |
(...skipping 961 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5001 for (RenderViewHost* render_view_host : render_view_host_set) | 5045 for (RenderViewHost* render_view_host : render_view_host_set) |
5002 render_view_host->OnWebkitPreferencesChanged(); | 5046 render_view_host->OnWebkitPreferencesChanged(); |
5003 } | 5047 } |
5004 | 5048 |
5005 void WebContentsImpl::SetJavaScriptDialogManagerForTesting( | 5049 void WebContentsImpl::SetJavaScriptDialogManagerForTesting( |
5006 JavaScriptDialogManager* dialog_manager) { | 5050 JavaScriptDialogManager* dialog_manager) { |
5007 dialog_manager_ = dialog_manager; | 5051 dialog_manager_ = dialog_manager; |
5008 } | 5052 } |
5009 | 5053 |
5010 } // namespace content | 5054 } // namespace content |
OLD | NEW |