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

Unified Diff: content/browser/tab_contents/tab_contents.cc

Issue 6713082: Move WebUIFactory to chrome/browser. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove WebUISource references Created 9 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/tab_contents/tab_contents.cc
diff --git a/content/browser/tab_contents/tab_contents.cc b/content/browser/tab_contents/tab_contents.cc
index 61bae0cda15cbf01438a213fa451efabce823c05..ba6e635e5ef7812ce302ec653fd79f4c59aec7b7 100644
--- a/content/browser/tab_contents/tab_contents.cc
+++ b/content/browser/tab_contents/tab_contents.cc
@@ -69,6 +69,7 @@
#include "chrome/common/render_messages_params.h"
#include "chrome/common/url_constants.h"
#include "content/browser/child_process_security_policy.h"
+#include "content/browser/content_browser_client.h"
#include "content/browser/host_zoom_map.h"
#include "content/browser/in_process_webkit/session_storage_namespace.h"
#include "content/browser/renderer_host/render_process_host.h"
@@ -82,7 +83,8 @@
#include "content/browser/tab_contents/tab_contents_delegate.h"
#include "content/browser/tab_contents/tab_contents_observer.h"
#include "content/browser/tab_contents/tab_contents_view.h"
-#include "content/browser/webui/web_ui.h"
+#include "content/browser/webui/web_ui_factory.h"
+#include "content/common/content_client.h"
#include "content/common/navigation_types.h"
#include "content/common/notification_service.h"
#include "content/common/view_messages.h"
@@ -253,7 +255,7 @@ TabContents::TabContents(Profile* profile,
#endif
suppress_javascript_messages_(false),
is_showing_before_unload_dialog_(false),
- opener_web_ui_type_(WebUIFactory::kNoWebUI),
+ opener_web_ui_type_(WebUI::kNoWebUI),
language_state_(&controller_),
closed_by_user_gesture_(false),
minimum_zoom_percent_(
@@ -554,8 +556,10 @@ bool TabContents::ShouldDisplayURL() {
}
// We always display the URL for non-WebUI URLs to prevent spoofing.
- if (entry && !WebUIFactory::HasWebUIScheme(entry->url()))
+ if (entry && !content::GetContentClient()->browser()->GetWebUIFactory()->
+ HasWebUIScheme(entry->url())) {
return true;
+ }
WebUI* web_ui = GetWebUIForCurrentState();
if (web_ui)
@@ -730,8 +734,9 @@ bool TabContents::NavigateToEntry(
// For security, we should never send non-Web-UI URLs to a Web UI renderer.
// Double check that here.
int enabled_bindings = dest_render_view_host->enabled_bindings();
- bool is_allowed_in_web_ui_renderer =
- WebUIFactory::IsURLAcceptableForWebUI(profile(), entry.url());
+ bool is_allowed_in_web_ui_renderer = content::GetContentClient()->
+ browser()->GetWebUIFactory()->IsURLAcceptableForWebUI(profile(),
+ entry.url());
CHECK(!BindingsPolicy::is_web_ui_enabled(enabled_bindings) ||
is_allowed_in_web_ui_renderer);
@@ -1607,23 +1612,28 @@ WebUI* TabContents::GetWebUIForCurrentState() {
return render_manager_.web_ui();
}
+WebUI::WebUITypeID TabContents::GetWebUITypeForCurrentState() {
+ return content::GetContentClient()->browser()->GetWebUIFactory()->
+ GetWebUIType(profile(), GetURL());
+}
+
void TabContents::DidNavigateMainFramePostCommit(
const NavigationController::LoadCommittedDetails& details,
const ViewHostMsg_FrameNavigate_Params& params) {
- if (opener_web_ui_type_ != WebUIFactory::kNoWebUI) {
+ if (opener_web_ui_type_ != WebUI::kNoWebUI) {
// If this is a window.open navigation, use the same WebUI as the renderer
// that opened the window, as long as both renderers have the same
// privileges.
- if (opener_web_ui_type_ ==
- WebUIFactory::GetWebUIType(profile(), GetURL())) {
- WebUI* web_ui = WebUIFactory::CreateWebUIForURL(this, GetURL());
+ if (delegate_ && opener_web_ui_type_ == GetWebUITypeForCurrentState()) {
+ WebUI* web_ui = content::GetContentClient()->browser()->
+ GetWebUIFactory()->CreateWebUIForURL(this, GetURL());
// web_ui might be NULL if the URL refers to a non-existent extension.
if (web_ui) {
render_manager_.SetWebUIPostCommit(web_ui);
web_ui->RenderViewCreated(render_view_host());
}
}
- opener_web_ui_type_ = WebUIFactory::kNoWebUI;
+ opener_web_ui_type_ = WebUI::kNoWebUI;
}
if (details.is_user_initiated_main_frame_load()) {
@@ -2003,9 +2013,8 @@ void TabContents::RenderViewCreated(RenderViewHost* render_view_host) {
// When we're creating views, we're still doing initial setup, so we always
// use the pending Web UI rather than any possibly existing committed one.
- if (render_manager_.pending_web_ui()) {
+ if (render_manager_.pending_web_ui())
render_manager_.pending_web_ui()->RenderViewCreated(render_view_host);
- }
if (entry->IsViewSourceMode()) {
// Put the renderer in view source mode.
@@ -2597,7 +2606,8 @@ NavigationController& TabContents::GetControllerForRenderManager() {
}
WebUI* TabContents::CreateWebUIForRenderManager(const GURL& url) {
- return WebUIFactory::CreateWebUIForURL(this, url);
+ return content::GetContentClient()->browser()->GetWebUIFactory()->
+ CreateWebUIForURL(this, url);
}
NavigationEntry*

Powered by Google App Engine
This is Rietveld 408576698