OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/tab_contents/tab_contents.h" | 5 #include "content/browser/tab_contents/tab_contents.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 #include "content/browser/renderer_host/render_view_host.h" | 25 #include "content/browser/renderer_host/render_view_host.h" |
26 #include "content/browser/renderer_host/render_widget_host_view.h" | 26 #include "content/browser/renderer_host/render_widget_host_view.h" |
27 #include "content/browser/renderer_host/resource_dispatcher_host.h" | 27 #include "content/browser/renderer_host/resource_dispatcher_host.h" |
28 #include "content/browser/renderer_host/resource_request_details.h" | 28 #include "content/browser/renderer_host/resource_request_details.h" |
29 #include "content/browser/site_instance.h" | 29 #include "content/browser/site_instance.h" |
30 #include "content/browser/tab_contents/interstitial_page.h" | 30 #include "content/browser/tab_contents/interstitial_page.h" |
31 #include "content/browser/tab_contents/navigation_entry_impl.h" | 31 #include "content/browser/tab_contents/navigation_entry_impl.h" |
32 #include "content/browser/tab_contents/provisional_load_details.h" | 32 #include "content/browser/tab_contents/provisional_load_details.h" |
33 #include "content/browser/tab_contents/tab_contents_view.h" | 33 #include "content/browser/tab_contents/tab_contents_view.h" |
34 #include "content/browser/tab_contents/title_updated_details.h" | 34 #include "content/browser/tab_contents/title_updated_details.h" |
35 #include "content/browser/webui/web_ui_factory.h" | |
36 #include "content/common/intents_messages.h" | 35 #include "content/common/intents_messages.h" |
37 #include "content/common/view_messages.h" | 36 #include "content/common/view_messages.h" |
38 #include "content/public/browser/browser_context.h" | 37 #include "content/public/browser/browser_context.h" |
39 #include "content/public/browser/content_browser_client.h" | 38 #include "content/public/browser/content_browser_client.h" |
40 #include "content/public/browser/devtools_agent_host_registry.h" | 39 #include "content/public/browser/devtools_agent_host_registry.h" |
41 #include "content/public/browser/download_manager.h" | 40 #include "content/public/browser/download_manager.h" |
42 #include "content/public/browser/invalidate_type.h" | 41 #include "content/public/browser/invalidate_type.h" |
43 #include "content/public/browser/navigation_details.h" | 42 #include "content/public/browser/navigation_details.h" |
44 #include "content/public/browser/notification_service.h" | 43 #include "content/public/browser/notification_service.h" |
45 #include "content/public/browser/user_metrics.h" | 44 #include "content/public/browser/user_metrics.h" |
46 #include "content/public/browser/web_contents_delegate.h" | 45 #include "content/public/browser/web_contents_delegate.h" |
47 #include "content/public/browser/web_contents_observer.h" | 46 #include "content/public/browser/web_contents_observer.h" |
| 47 #include "content/public/browser/web_ui_factory.h" |
48 #include "content/public/common/bindings_policy.h" | 48 #include "content/public/common/bindings_policy.h" |
49 #include "content/public/common/content_constants.h" | 49 #include "content/public/common/content_constants.h" |
50 #include "content/public/common/content_restriction.h" | 50 #include "content/public/common/content_restriction.h" |
51 #include "content/public/common/url_constants.h" | 51 #include "content/public/common/url_constants.h" |
52 #include "net/base/net_util.h" | 52 #include "net/base/net_util.h" |
53 #include "net/url_request/url_request_context_getter.h" | 53 #include "net/url_request/url_request_context_getter.h" |
54 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 54 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
55 #include "ui/gfx/codec/png_codec.h" | 55 #include "ui/gfx/codec/png_codec.h" |
56 #include "webkit/glue/web_intent_data.h" | 56 #include "webkit/glue/web_intent_data.h" |
57 #include "webkit/glue/webpreferences.h" | 57 #include "webkit/glue/webpreferences.h" |
(...skipping 995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1053 | 1053 |
1054 int TabContents::GetMaximumZoomPercent() const { | 1054 int TabContents::GetMaximumZoomPercent() const { |
1055 return maximum_zoom_percent_; | 1055 return maximum_zoom_percent_; |
1056 } | 1056 } |
1057 | 1057 |
1058 int TabContents::GetContentRestrictions() const { | 1058 int TabContents::GetContentRestrictions() const { |
1059 return content_restrictions_; | 1059 return content_restrictions_; |
1060 } | 1060 } |
1061 | 1061 |
1062 WebUI::TypeID TabContents::GetWebUITypeForCurrentState() { | 1062 WebUI::TypeID TabContents::GetWebUITypeForCurrentState() { |
1063 return content::WebUIFactory::Get()->GetWebUIType(GetBrowserContext(), | 1063 return content::GetContentClient()->browser()->GetWebUIFactory()-> |
1064 GetURL()); | 1064 GetWebUIType(GetBrowserContext(), GetURL()); |
1065 } | 1065 } |
1066 | 1066 |
1067 WebUI* TabContents::GetWebUIForCurrentState() { | 1067 WebUI* TabContents::GetWebUIForCurrentState() { |
1068 // When there is a pending navigation entry, we want to use the pending WebUI | 1068 // When there is a pending navigation entry, we want to use the pending WebUI |
1069 // that goes along with it to control the basic flags. For example, we want to | 1069 // that goes along with it to control the basic flags. For example, we want to |
1070 // show the pending URL in the URL bar, so we want the display_url flag to | 1070 // show the pending URL in the URL bar, so we want the display_url flag to |
1071 // be from the pending entry. | 1071 // be from the pending entry. |
1072 // | 1072 // |
1073 // The confusion comes because there are multiple possibilities for the | 1073 // The confusion comes because there are multiple possibilities for the |
1074 // initial load in a tab as a side effect of the way the RenderViewHostManager | 1074 // initial load in a tab as a side effect of the way the RenderViewHostManager |
(...skipping 1088 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2163 | 2163 |
2164 void TabContents::NotifySwappedFromRenderManager() { | 2164 void TabContents::NotifySwappedFromRenderManager() { |
2165 NotifySwapped(); | 2165 NotifySwapped(); |
2166 } | 2166 } |
2167 | 2167 |
2168 NavigationControllerImpl& TabContents::GetControllerForRenderManager() { | 2168 NavigationControllerImpl& TabContents::GetControllerForRenderManager() { |
2169 return GetControllerImpl(); | 2169 return GetControllerImpl(); |
2170 } | 2170 } |
2171 | 2171 |
2172 WebUI* TabContents::CreateWebUIForRenderManager(const GURL& url) { | 2172 WebUI* TabContents::CreateWebUIForRenderManager(const GURL& url) { |
2173 return content::WebUIFactory::Get()->CreateWebUIForURL(this, url); | 2173 return content::GetContentClient()->browser()->GetWebUIFactory()-> |
| 2174 CreateWebUIForURL(this, url); |
2174 } | 2175 } |
2175 | 2176 |
2176 NavigationEntry* | 2177 NavigationEntry* |
2177 TabContents::GetLastCommittedNavigationEntryForRenderManager() { | 2178 TabContents::GetLastCommittedNavigationEntryForRenderManager() { |
2178 return controller_.GetLastCommittedEntry(); | 2179 return controller_.GetLastCommittedEntry(); |
2179 } | 2180 } |
2180 | 2181 |
2181 bool TabContents::CreateRenderViewForRenderManager( | 2182 bool TabContents::CreateRenderViewForRenderManager( |
2182 RenderViewHost* render_view_host) { | 2183 RenderViewHost* render_view_host) { |
2183 // Can be NULL during tests. | 2184 // Can be NULL during tests. |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2233 encoding_ = content::GetContentClient()->browser()-> | 2234 encoding_ = content::GetContentClient()->browser()-> |
2234 GetCanonicalEncodingNameByAliasName(encoding); | 2235 GetCanonicalEncodingNameByAliasName(encoding); |
2235 } | 2236 } |
2236 | 2237 |
2237 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { | 2238 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { |
2238 RenderWidgetHostView* rwh_view = GetView()->CreateViewForWidget(rvh); | 2239 RenderWidgetHostView* rwh_view = GetView()->CreateViewForWidget(rvh); |
2239 // Can be NULL during tests. | 2240 // Can be NULL during tests. |
2240 if (rwh_view) | 2241 if (rwh_view) |
2241 rwh_view->SetSize(GetView()->GetContainerSize()); | 2242 rwh_view->SetSize(GetView()->GetContainerSize()); |
2242 } | 2243 } |
OLD | NEW |