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

Side by Side Diff: content/browser/tab_contents/tab_contents.cc

Issue 9288074: Rename WebUIFactory to WebUIControllerFactory since that's what it creates now. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: blah Created 8 years, 11 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 | Annotate | Revision Log
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/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 28 matching lines...) Expand all
39 #include "content/public/browser/content_browser_client.h" 39 #include "content/public/browser/content_browser_client.h"
40 #include "content/public/browser/devtools_agent_host_registry.h" 40 #include "content/public/browser/devtools_agent_host_registry.h"
41 #include "content/public/browser/download_manager.h" 41 #include "content/public/browser/download_manager.h"
42 #include "content/public/browser/invalidate_type.h" 42 #include "content/public/browser/invalidate_type.h"
43 #include "content/public/browser/navigation_details.h" 43 #include "content/public/browser/navigation_details.h"
44 #include "content/public/browser/notification_service.h" 44 #include "content/public/browser/notification_service.h"
45 #include "content/public/browser/user_metrics.h" 45 #include "content/public/browser/user_metrics.h"
46 #include "content/public/browser/web_contents_delegate.h" 46 #include "content/public/browser/web_contents_delegate.h"
47 #include "content/public/browser/web_contents_observer.h" 47 #include "content/public/browser/web_contents_observer.h"
48 #include "content/public/browser/web_contents_view.h" 48 #include "content/public/browser/web_contents_view.h"
49 #include "content/public/browser/web_ui_factory.h" 49 #include "content/public/browser/web_ui_controller_factory.h"
50 #include "content/public/common/bindings_policy.h" 50 #include "content/public/common/bindings_policy.h"
51 #include "content/public/common/content_constants.h" 51 #include "content/public/common/content_constants.h"
52 #include "content/public/common/content_restriction.h" 52 #include "content/public/common/content_restriction.h"
53 #include "content/public/common/url_constants.h" 53 #include "content/public/common/url_constants.h"
54 #include "net/base/mime_util.h" 54 #include "net/base/mime_util.h"
55 #include "net/base/net_util.h" 55 #include "net/base/net_util.h"
56 #include "net/url_request/url_request_context_getter.h" 56 #include "net/url_request/url_request_context_getter.h"
57 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" 57 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
58 #include "ui/gfx/codec/png_codec.h" 58 #include "ui/gfx/codec/png_codec.h"
59 #include "webkit/glue/web_intent_data.h" 59 #include "webkit/glue/web_intent_data.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 using content::NavigationEntryImpl; 121 using content::NavigationEntryImpl;
122 using content::OpenURLParams; 122 using content::OpenURLParams;
123 using content::RenderViewHostDelegate; 123 using content::RenderViewHostDelegate;
124 using content::SiteInstance; 124 using content::SiteInstance;
125 using content::SSLStatus; 125 using content::SSLStatus;
126 using content::UserMetricsAction; 126 using content::UserMetricsAction;
127 using content::WebContents; 127 using content::WebContents;
128 using content::WebContentsObserver; 128 using content::WebContentsObserver;
129 using content::WebUI; 129 using content::WebUI;
130 using content::WebUIController; 130 using content::WebUIController;
131 using content::WebUIControllerFactory;
131 132
132 namespace { 133 namespace {
133 134
134 // Amount of time we wait between when a key event is received and the renderer 135 // Amount of time we wait between when a key event is received and the renderer
135 // is queried for its state and pushed to the NavigationEntry. 136 // is queried for its state and pushed to the NavigationEntry.
136 const int kQueryStateDelay = 5000; 137 const int kQueryStateDelay = 5000;
137 138
138 const int kSyncWaitDelay = 40; 139 const int kSyncWaitDelay = 40;
139 140
140 static const char kDotGoogleDotCom[] = ".google.com"; 141 static const char kDotGoogleDotCom[] = ".google.com";
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 435
435 RenderWidgetHostView* TabContents::GetRenderWidgetHostView() const { 436 RenderWidgetHostView* TabContents::GetRenderWidgetHostView() const {
436 return render_manager_.GetRenderWidgetHostView(); 437 return render_manager_.GetRenderWidgetHostView();
437 } 438 }
438 439
439 content::WebContentsView* TabContents::GetView() const { 440 content::WebContentsView* TabContents::GetView() const {
440 return view_.get(); 441 return view_.get();
441 } 442 }
442 443
443 content::WebUI* TabContents::CreateWebUI(const GURL& url) { 444 content::WebUI* TabContents::CreateWebUI(const GURL& url) {
445 WebUIControllerFactory* factory =
446 content::GetContentClient()->browser()->GetWebUIControllerFactory();
447 if (!factory)
448 return NULL;
444 WebUIImpl* web_ui = new WebUIImpl(this); 449 WebUIImpl* web_ui = new WebUIImpl(this);
445 WebUIController* controller = 450 WebUIController* controller =
446 content::GetContentClient()->browser()->GetWebUIFactory()-> 451 factory->CreateWebUIControllerForURL(web_ui, url);
447 CreateWebUIForURL(web_ui, url);
448 if (controller) { 452 if (controller) {
449 web_ui->SetController(controller); 453 web_ui->SetController(controller);
450 return web_ui; 454 return web_ui;
451 } 455 }
452 456
453 delete web_ui; 457 delete web_ui;
454 return NULL; 458 return NULL;
455 } 459 }
456 460
457 content::WebUI* TabContents::GetWebUI() const { 461 content::WebUI* TabContents::GetWebUI() const {
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
827 if (entry.GetURL().spec().size() > content::kMaxURLChars) 831 if (entry.GetURL().spec().size() > content::kMaxURLChars)
828 return false; 832 return false;
829 833
830 RenderViewHost* dest_render_view_host = render_manager_.Navigate(entry); 834 RenderViewHost* dest_render_view_host = render_manager_.Navigate(entry);
831 if (!dest_render_view_host) 835 if (!dest_render_view_host)
832 return false; // Unable to create the desired render view host. 836 return false; // Unable to create the desired render view host.
833 837
834 // For security, we should never send non-Web-UI URLs to a Web UI renderer. 838 // For security, we should never send non-Web-UI URLs to a Web UI renderer.
835 // Double check that here. 839 // Double check that here.
836 int enabled_bindings = dest_render_view_host->enabled_bindings(); 840 int enabled_bindings = dest_render_view_host->enabled_bindings();
837 bool is_allowed_in_web_ui_renderer = content::GetContentClient()-> 841 WebUIControllerFactory* factory =
838 browser()->GetWebUIFactory()->IsURLAcceptableForWebUI(GetBrowserContext(), 842 content::GetContentClient()->browser()->GetWebUIControllerFactory();
839 entry.GetURL()); 843 bool is_allowed_in_web_ui_renderer =
844 factory &&
845 factory->IsURLAcceptableForWebUI(GetBrowserContext(), entry.GetURL());
840 #if defined(OS_CHROMEOS) 846 #if defined(OS_CHROMEOS)
841 is_allowed_in_web_ui_renderer |= entry.GetURL().SchemeIs(chrome::kDataScheme); 847 is_allowed_in_web_ui_renderer |= entry.GetURL().SchemeIs(chrome::kDataScheme);
842 #endif 848 #endif
843 CHECK(!(enabled_bindings & content::BINDINGS_POLICY_WEB_UI) || 849 CHECK(!(enabled_bindings & content::BINDINGS_POLICY_WEB_UI) ||
844 is_allowed_in_web_ui_renderer); 850 is_allowed_in_web_ui_renderer);
845 851
846 // Tell DevTools agent that it is attached prior to the navigation. 852 // Tell DevTools agent that it is attached prior to the navigation.
847 DevToolsManagerImpl::GetInstance()->OnNavigatingToPendingEntry( 853 DevToolsManagerImpl::GetInstance()->OnNavigatingToPendingEntry(
848 GetRenderViewHost(), 854 GetRenderViewHost(),
849 dest_render_view_host, 855 dest_render_view_host,
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
1097 1103
1098 gfx::Size TabContents::GetPreferredSize() const { 1104 gfx::Size TabContents::GetPreferredSize() const {
1099 return preferred_size_; 1105 return preferred_size_;
1100 } 1106 }
1101 1107
1102 int TabContents::GetContentRestrictions() const { 1108 int TabContents::GetContentRestrictions() const {
1103 return content_restrictions_; 1109 return content_restrictions_;
1104 } 1110 }
1105 1111
1106 WebUI::TypeID TabContents::GetWebUITypeForCurrentState() { 1112 WebUI::TypeID TabContents::GetWebUITypeForCurrentState() {
1107 return content::GetContentClient()->browser()->GetWebUIFactory()-> 1113 WebUIControllerFactory* factory =
1108 GetWebUIType(GetBrowserContext(), GetURL()); 1114 content::GetContentClient()->browser()->GetWebUIControllerFactory();
1115 if (!factory)
1116 return WebUI::kNoWebUI;
1117 return factory->GetWebUIType(GetBrowserContext(), GetURL());
1109 } 1118 }
1110 1119
1111 content::WebUI* TabContents::GetWebUIForCurrentState() { 1120 content::WebUI* TabContents::GetWebUIForCurrentState() {
1112 // When there is a pending navigation entry, we want to use the pending WebUI 1121 // When there is a pending navigation entry, we want to use the pending WebUI
1113 // that goes along with it to control the basic flags. For example, we want to 1122 // that goes along with it to control the basic flags. For example, we want to
1114 // show the pending URL in the URL bar, so we want the display_url flag to 1123 // show the pending URL in the URL bar, so we want the display_url flag to
1115 // be from the pending entry. 1124 // be from the pending entry.
1116 // 1125 //
1117 // The confusion comes because there are multiple possibilities for the 1126 // The confusion comes because there are multiple possibilities for the
1118 // initial load in a tab as a side effect of the way the RenderViewHostManager 1127 // initial load in a tab as a side effect of the way the RenderViewHostManager
(...skipping 1159 matching lines...) Expand 10 before | Expand all | Expand 10 after
2278 encoding_ = content::GetContentClient()->browser()-> 2287 encoding_ = content::GetContentClient()->browser()->
2279 GetCanonicalEncodingNameByAliasName(encoding); 2288 GetCanonicalEncodingNameByAliasName(encoding);
2280 } 2289 }
2281 2290
2282 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { 2291 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) {
2283 RenderWidgetHostView* rwh_view = GetView()->CreateViewForWidget(rvh); 2292 RenderWidgetHostView* rwh_view = GetView()->CreateViewForWidget(rvh);
2284 // Can be NULL during tests. 2293 // Can be NULL during tests.
2285 if (rwh_view) 2294 if (rwh_view)
2286 rwh_view->SetSize(GetView()->GetContainerSize()); 2295 rwh_view->SetSize(GetView()->GetContainerSize());
2287 } 2296 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698