Chromium Code Reviews| 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 106 #include "content/public/common/content_constants.h" | 106 #include "content/public/common/content_constants.h" |
| 107 #include "content/public/common/content_switches.h" | 107 #include "content/public/common/content_switches.h" |
| 108 #include "content/public/common/page_zoom.h" | 108 #include "content/public/common/page_zoom.h" |
| 109 #include "content/public/common/result_codes.h" | 109 #include "content/public/common/result_codes.h" |
| 110 #include "content/public/common/security_style.h" | 110 #include "content/public/common/security_style.h" |
| 111 #include "content/public/common/url_constants.h" | 111 #include "content/public/common/url_constants.h" |
| 112 #include "content/public/common/url_utils.h" | 112 #include "content/public/common/url_utils.h" |
| 113 #include "content/public/common/web_preferences.h" | 113 #include "content/public/common/web_preferences.h" |
| 114 #include "mojo/common/url_type_converters.h" | 114 #include "mojo/common/url_type_converters.h" |
| 115 #include "mojo/converters/geometry/geometry_type_converters.h" | 115 #include "mojo/converters/geometry/geometry_type_converters.h" |
| 116 #include "net/base/url_util.h" | |
| 116 #include "net/http/http_cache.h" | 117 #include "net/http/http_cache.h" |
| 117 #include "net/http/http_transaction_factory.h" | 118 #include "net/http/http_transaction_factory.h" |
| 118 #include "net/url_request/url_request_context.h" | 119 #include "net/url_request/url_request_context.h" |
| 119 #include "net/url_request/url_request_context_getter.h" | 120 #include "net/url_request/url_request_context_getter.h" |
| 120 #include "skia/public/type_converters.h" | 121 #include "skia/public/type_converters.h" |
| 121 #include "third_party/WebKit/public/web/WebSandboxFlags.h" | 122 #include "third_party/WebKit/public/web/WebSandboxFlags.h" |
| 122 #include "third_party/skia/include/core/SkBitmap.h" | 123 #include "third_party/skia/include/core/SkBitmap.h" |
| 123 #include "ui/base/layout.h" | 124 #include "ui/base/layout.h" |
| 124 #include "ui/gfx/display.h" | 125 #include "ui/gfx/display.h" |
| 125 #include "ui/gfx/screen.h" | 126 #include "ui/gfx/screen.h" |
| (...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 854 SetAccessibilityMode(RemoveAccessibilityModeFrom(accessibility_mode_, mode)); | 855 SetAccessibilityMode(RemoveAccessibilityModeFrom(accessibility_mode_, mode)); |
| 855 } | 856 } |
| 856 | 857 |
| 857 void WebContentsImpl::RequestAXTreeSnapshot(AXTreeSnapshotCallback callback) { | 858 void WebContentsImpl::RequestAXTreeSnapshot(AXTreeSnapshotCallback callback) { |
| 858 // TODO(dmazzoni): http://crbug.com/475608 This only returns the | 859 // TODO(dmazzoni): http://crbug.com/475608 This only returns the |
| 859 // accessibility tree from the main frame and everything in the | 860 // accessibility tree from the main frame and everything in the |
| 860 // same site instance. | 861 // same site instance. |
| 861 GetMainFrame()->RequestAXTreeSnapshot(callback); | 862 GetMainFrame()->RequestAXTreeSnapshot(callback); |
| 862 } | 863 } |
| 863 | 864 |
| 865 void WebContentsImpl::SetTemporaryZoomLevel(double level, bool is_temporary) { | |
| 866 SendPageMessage(new PageMsg_SetZoomLevel( | |
| 867 MSG_ROUTING_NONE, | |
| 868 is_temporary ? PageMsg_SetZoomLevel_Command::ZOOM_SET_TEMPORARY | |
| 869 : PageMsg_SetZoomLevel_Command::ZOOM_CLEAR_TEMPORARY, | |
| 870 level)); | |
| 871 } | |
| 872 | |
| 873 void WebContentsImpl::UpdateZoom(double level) { | |
| 874 // Individual frames may still ignore the new zoom level if their RenderView | |
| 875 // contains a plugin document or if it uses a temporary zoom level. | |
| 876 SendPageMessage(new PageMsg_SetZoomLevel( | |
| 877 MSG_ROUTING_NONE, | |
| 878 PageMsg_SetZoomLevel_Command::ZOOM_USE_CURRENT_TEMPORARY_MODE, level)); | |
| 879 } | |
| 880 | |
| 881 void WebContentsImpl::UpdateZoomIfNecessary(const std::string& scheme, | |
| 882 const std::string& host, | |
| 883 double level) { | |
| 884 NavigationEntry* entry = GetController().GetLastCommittedEntry(); | |
| 885 if (!entry) | |
| 886 return; | |
| 887 | |
| 888 GURL url = HostZoomMap::GetURLFromEntry(entry); | |
| 889 if (host != net::GetHostOrSpecFromURL(url) || | |
| 890 (!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.
| |
| 891 return; | |
| 892 } | |
| 893 | |
| 894 UpdateZoom(level); | |
| 895 } | |
| 896 | |
| 864 WebUI* WebContentsImpl::CreateSubframeWebUI(const GURL& url, | 897 WebUI* WebContentsImpl::CreateSubframeWebUI(const GURL& url, |
| 865 const std::string& frame_name) { | 898 const std::string& frame_name) { |
| 866 DCHECK(!frame_name.empty()); | 899 DCHECK(!frame_name.empty()); |
| 867 return CreateWebUI(url, frame_name); | 900 return CreateWebUI(url, frame_name); |
| 868 } | 901 } |
| 869 | 902 |
| 870 WebUI* WebContentsImpl::GetWebUI() const { | 903 WebUI* WebContentsImpl::GetWebUI() const { |
| 871 WebUI* commited_web_ui = GetCommittedWebUI(); | 904 WebUI* commited_web_ui = GetCommittedWebUI(); |
| 872 return commited_web_ui ? commited_web_ui | 905 return commited_web_ui ? commited_web_ui |
| 873 : GetRenderManager()->GetNavigatingWebUI(); | 906 : GetRenderManager()->GetNavigatingWebUI(); |
| (...skipping 3090 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3964 base::Bind(&WebContentsImpl::OnDialogClosed, base::Unretained(this), | 3997 base::Bind(&WebContentsImpl::OnDialogClosed, base::Unretained(this), |
| 3965 render_frame_host->GetProcess()->GetID(), | 3998 render_frame_host->GetProcess()->GetID(), |
| 3966 render_frame_host->GetRoutingID(), reply_msg, | 3999 render_frame_host->GetRoutingID(), reply_msg, |
| 3967 false)); | 4000 false)); |
| 3968 } | 4001 } |
| 3969 | 4002 |
| 3970 WebContents* WebContentsImpl::GetAsWebContents() { | 4003 WebContents* WebContentsImpl::GetAsWebContents() { |
| 3971 return this; | 4004 return this; |
| 3972 } | 4005 } |
| 3973 | 4006 |
| 4007 double WebContentsImpl::PageZoomLevel() { | |
| 4008 return HostZoomMap::GetZoomLevel(this); | |
| 4009 } | |
| 4010 | |
| 3974 bool WebContentsImpl::IsNeverVisible() { | 4011 bool WebContentsImpl::IsNeverVisible() { |
| 3975 if (!delegate_) | 4012 if (!delegate_) |
| 3976 return false; | 4013 return false; |
| 3977 return delegate_->IsNeverVisible(this); | 4014 return delegate_->IsNeverVisible(this); |
| 3978 } | 4015 } |
| 3979 | 4016 |
| 3980 RenderViewHostDelegateView* WebContentsImpl::GetDelegateView() { | 4017 RenderViewHostDelegateView* WebContentsImpl::GetDelegateView() { |
| 3981 return render_view_host_delegate_view_; | 4018 return render_view_host_delegate_view_; |
| 3982 } | 4019 } |
| 3983 | 4020 |
| (...skipping 905 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4889 else | 4926 else |
| 4890 WasHidden(); | 4927 WasHidden(); |
| 4891 } | 4928 } |
| 4892 | 4929 |
| 4893 void WebContentsImpl::SetJavaScriptDialogManagerForTesting( | 4930 void WebContentsImpl::SetJavaScriptDialogManagerForTesting( |
| 4894 JavaScriptDialogManager* dialog_manager) { | 4931 JavaScriptDialogManager* dialog_manager) { |
| 4895 dialog_manager_ = dialog_manager; | 4932 dialog_manager_ = dialog_manager; |
| 4896 } | 4933 } |
| 4897 | 4934 |
| 4898 } // namespace content | 4935 } // namespace content |
| OLD | NEW |