| 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..906dbae1d0c2cc259e0de41bf419c9250d9db50a 100644
|
| --- a/content/browser/tab_contents/tab_contents.cc
|
| +++ b/content/browser/tab_contents/tab_contents.cc
|
| @@ -82,7 +82,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_register.h"
|
| +#include "content/browser/webui/web_ui_source.h"
|
| #include "content/common/navigation_types.h"
|
| #include "content/common/notification_service.h"
|
| #include "content/common/view_messages.h"
|
| @@ -253,7 +254,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,7 +555,7 @@ bool TabContents::ShouldDisplayURL() {
|
| }
|
|
|
| // We always display the URL for non-WebUI URLs to prevent spoofing.
|
| - if (entry && !WebUIFactory::HasWebUIScheme(entry->url()))
|
| + if (entry && !WebUIRegister::GetSource()->HasWebUIScheme(entry->url()))
|
| return true;
|
|
|
| WebUI* web_ui = GetWebUIForCurrentState();
|
| @@ -731,7 +732,8 @@ bool TabContents::NavigateToEntry(
|
| // 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());
|
| + WebUIRegister::GetSource()->IsURLAcceptableForWebUI(profile(),
|
| + entry.url());
|
| CHECK(!BindingsPolicy::is_web_ui_enabled(enabled_bindings) ||
|
| is_allowed_in_web_ui_renderer);
|
|
|
| @@ -1607,23 +1609,27 @@ WebUI* TabContents::GetWebUIForCurrentState() {
|
| return render_manager_.web_ui();
|
| }
|
|
|
| +WebUI::WebUITypeID TabContents::GetWebUITypeForCurrentState() {
|
| + return WebUIRegister::GetSource()->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 = WebUIRegister::GetSource()->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()) {
|
| @@ -2597,7 +2603,7 @@ NavigationController& TabContents::GetControllerForRenderManager() {
|
| }
|
|
|
| WebUI* TabContents::CreateWebUIForRenderManager(const GURL& url) {
|
| - return WebUIFactory::CreateWebUIForURL(this, url);
|
| + return WebUIRegister::GetSource()->CreateWebUIForURL(this, url);
|
| }
|
|
|
| NavigationEntry*
|
|
|