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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 851 SetAccessibilityMode(RemoveAccessibilityModeFrom(accessibility_mode_, mode)); | 852 SetAccessibilityMode(RemoveAccessibilityModeFrom(accessibility_mode_, mode)); |
| 852 } | 853 } |
| 853 | 854 |
| 854 void WebContentsImpl::RequestAXTreeSnapshot(AXTreeSnapshotCallback callback) { | 855 void WebContentsImpl::RequestAXTreeSnapshot(AXTreeSnapshotCallback callback) { |
| 855 // TODO(dmazzoni): http://crbug.com/475608 This only returns the | 856 // TODO(dmazzoni): http://crbug.com/475608 This only returns the |
| 856 // accessibility tree from the main frame and everything in the | 857 // accessibility tree from the main frame and everything in the |
| 857 // same site instance. | 858 // same site instance. |
| 858 GetMainFrame()->RequestAXTreeSnapshot(callback); | 859 GetMainFrame()->RequestAXTreeSnapshot(callback); |
| 859 } | 860 } |
| 860 | 861 |
| 862 void WebContentsImpl::SetTemporaryZoomLevel(double level, bool is_temporary) { | |
| 863 SendToAllFrames(new FrameMsg_SetTemporaryZoomLevel(MSG_ROUTING_NONE, level, | |
| 864 is_temporary)); | |
| 865 } | |
| 866 | |
| 867 void WebContentsImpl::UpdateZoom(double level) { | |
| 868 // Individual frames may still ignore the new zoom level if their RenderView | |
| 869 // contains a plugin document or if it uses a temporary zoom level. | |
| 870 SendToAllFrames( | |
| 871 new FrameMsg_SetZoomLevelFromWebContents(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) | |
|
alexmos
2016/04/05 18:00:53
So this means that we ignore zoom changes when the
| |
| 879 return; | |
| 880 | |
| 881 GURL url = HostZoomMap::GetURLFromEntry(entry); | |
| 882 if (host != net::GetHostOrSpecFromURL(url) || | |
| 883 (!scheme.empty() && scheme != url.scheme())) { | |
| 884 // TODO(wjmaclean): verify the logic here is solid. | |
| 885 return; | |
| 886 } | |
| 887 | |
| 888 UpdateZoom(level); | |
| 889 } | |
| 890 | |
| 861 WebUI* WebContentsImpl::CreateSubframeWebUI(const GURL& url, | 891 WebUI* WebContentsImpl::CreateSubframeWebUI(const GURL& url, |
| 862 const std::string& frame_name) { | 892 const std::string& frame_name) { |
| 863 DCHECK(!frame_name.empty()); | 893 DCHECK(!frame_name.empty()); |
| 864 return CreateWebUI(url, frame_name); | 894 return CreateWebUI(url, frame_name); |
| 865 } | 895 } |
| 866 | 896 |
| 867 WebUI* WebContentsImpl::GetWebUI() const { | 897 WebUI* WebContentsImpl::GetWebUI() const { |
| 868 WebUI* commited_web_ui = GetCommittedWebUI(); | 898 WebUI* commited_web_ui = GetCommittedWebUI(); |
| 869 return commited_web_ui ? commited_web_ui | 899 return commited_web_ui ? commited_web_ui |
| 870 : GetRenderManager()->GetNavigatingWebUI(); | 900 : GetRenderManager()->GetNavigatingWebUI(); |
| (...skipping 3954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4825 else | 4855 else |
| 4826 WasHidden(); | 4856 WasHidden(); |
| 4827 } | 4857 } |
| 4828 | 4858 |
| 4829 void WebContentsImpl::SetJavaScriptDialogManagerForTesting( | 4859 void WebContentsImpl::SetJavaScriptDialogManagerForTesting( |
| 4830 JavaScriptDialogManager* dialog_manager) { | 4860 JavaScriptDialogManager* dialog_manager) { |
| 4831 dialog_manager_ = dialog_manager; | 4861 dialog_manager_ = dialog_manager; |
| 4832 } | 4862 } |
| 4833 | 4863 |
| 4834 } // namespace content | 4864 } // namespace content |
| OLD | NEW |