diff options
author | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-01 19:18:49 +0000 |
---|---|---|
committer | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-01 19:18:49 +0000 |
commit | 24629bce839db043c89f372f29de9ab4c05dc69a (patch) | |
tree | c756f67624290880272f83baa4f7669a9f506ca3 | |
parent | f9e12ff5882a858e6eb0563e9e471fb884f27042 (diff) | |
download | chromium_src-24629bce839db043c89f372f29de9ab4c05dc69a.zip chromium_src-24629bce839db043c89f372f29de9ab4c05dc69a.tar.gz chromium_src-24629bce839db043c89f372f29de9ab4c05dc69a.tar.bz2 |
Move constrained web dialog code back to chrome/.
This partially reverts r139757.
BUG= 107201,125841
TEST=no visible change
Review URL: https://chromiumcodereview.appspot.com/11358027
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@165463 0039d316-1c4b-4281-b951-d872f2087c98
19 files changed, 77 insertions, 98 deletions
diff --git a/chrome/browser/printing/print_preview_tab_controller.cc b/chrome/browser/printing/print_preview_tab_controller.cc index 04f1bdb..63da491 100644 --- a/chrome/browser/printing/print_preview_tab_controller.cc +++ b/chrome/browser/printing/print_preview_tab_controller.cc @@ -25,6 +25,7 @@ #include "chrome/browser/ui/tab_contents/tab_contents.h" #include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/browser/ui/webui/chrome_web_contents_handler.h" +#include "chrome/browser/ui/webui/constrained_web_dialog_ui.h" #include "chrome/browser/ui/webui/print_preview/print_preview_ui.h" #include "chrome/common/chrome_content_client.h" #include "chrome/common/chrome_notification_types.h" @@ -40,7 +41,6 @@ #include "content/public/browser/render_view_host.h" #include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents_delegate.h" -#include "ui/web_dialogs/constrained_web_dialog_ui.h" #include "ui/web_dialogs/web_dialog_delegate.h" #include "ui/web_dialogs/web_dialog_web_contents_delegate.h" #include "webkit/plugins/webplugininfo.h" @@ -49,7 +49,6 @@ using content::NativeWebKeyboardEvent; using content::NavigationController; using content::WebContents; using content::WebUIMessageHandler; -using ui::ConstrainedWebDialogDelegate; using ui::WebDialogDelegate; using ui::WebDialogWebContentsDelegate; @@ -436,11 +435,10 @@ TabContents* PrintPreviewTabController::CreatePrintPreviewTab( PrintPreviewWebContentDelegate* pp_wcd = new PrintPreviewWebContentDelegate(profile, initiator_tab); ConstrainedWebDialogDelegate* constrained_delegate = - ui::CreateConstrainedWebDialog( - profile, - web_dialog_delegate, - pp_wcd, - initiator_tab); + CreateConstrainedWebDialog(profile, + web_dialog_delegate, + pp_wcd, + initiator_tab->web_contents()); TabContents* preview_tab = constrained_delegate->tab(); EnableInternalPDFPluginForTab(preview_tab); CoreTabHelper::FromWebContents(preview_tab->web_contents())-> diff --git a/chrome/browser/ui/cocoa/constrained_web_dialog_delegate_mac.mm b/chrome/browser/ui/cocoa/constrained_web_dialog_delegate_mac.mm index e6231f7..d1f900c9 100644 --- a/chrome/browser/ui/cocoa/constrained_web_dialog_delegate_mac.mm +++ b/chrome/browser/ui/cocoa/constrained_web_dialog_delegate_mac.mm @@ -16,7 +16,6 @@ #include "ui/web_dialogs/web_dialog_web_contents_delegate.h" using content::WebContents; -using ui::ConstrainedWebDialogDelegate; using ui::WebDialogDelegate; using ui::WebDialogWebContentsDelegate; @@ -117,19 +116,18 @@ ConstrainedWebDialogDelegateMac::ConstrainedWebDialogDelegateMac( @selector(sheetDidEnd:returnCode:contextInfo:)); } -ConstrainedWebDialogDelegate* ui::CreateConstrainedWebDialog( +ConstrainedWebDialogDelegate* CreateConstrainedWebDialog( Profile* profile, WebDialogDelegate* delegate, WebDialogWebContentsDelegate* tab_delegate, - TabContents* tab_contents) { + content::WebContents* web_contents) { // Deleted when ConstrainedWebDialogDelegateMac::DeleteDelegate() runs. ConstrainedWebDialogDelegateMac* constrained_delegate = new ConstrainedWebDialogDelegateMac(profile, delegate, tab_delegate); // Deleted when ConstrainedWebDialogDelegateMac::OnDialogCloseFromWebUI() // runs. ConstrainedWindow* constrained_window = - new ConstrainedWindowMac(tab_contents->web_contents(), - constrained_delegate); + new ConstrainedWindowMac(web_contents, constrained_delegate); constrained_delegate->set_window(constrained_window); return constrained_delegate; } diff --git a/chrome/browser/ui/gtk/constrained_web_dialog_delegate_gtk.cc b/chrome/browser/ui/gtk/constrained_web_dialog_delegate_gtk.cc index eea4329..5b44e39 100644 --- a/chrome/browser/ui/gtk/constrained_web_dialog_delegate_gtk.cc +++ b/chrome/browser/ui/gtk/constrained_web_dialog_delegate_gtk.cc @@ -16,8 +16,6 @@ #include "ui/web_dialogs/web_dialog_ui.h" using content::WebContents; -using ui::ConstrainedWebDialogDelegate; -using ui::ConstrainedWebDialogUI; using ui::WebDialogDelegate; using ui::WebDialogWebContentsDelegate; @@ -98,15 +96,15 @@ ConstrainedWebDialogDelegateGtk::ConstrainedWebDialogDelegateGtk( gtk_widget_show_all(GetWidgetRoot()); } -ConstrainedWebDialogDelegate* ui::CreateConstrainedWebDialog( +ConstrainedWebDialogDelegate* CreateConstrainedWebDialog( Profile* profile, WebDialogDelegate* delegate, WebDialogWebContentsDelegate* tab_delegate, - TabContents* overshadowed) { + content::WebContents* web_contents) { ConstrainedWebDialogDelegateGtk* constrained_delegate = new ConstrainedWebDialogDelegateGtk(profile, delegate, tab_delegate); - ConstrainedWindow* constrained_window = new ConstrainedWindowGtk( - overshadowed->web_contents(), constrained_delegate); + ConstrainedWindow* constrained_window = + new ConstrainedWindowGtk(web_contents, constrained_delegate); constrained_delegate->set_window(constrained_window); return constrained_delegate; } diff --git a/chrome/browser/ui/views/constrained_web_dialog_delegate_views.cc b/chrome/browser/ui/views/constrained_web_dialog_delegate_views.cc index 1af7f4c..8d89d80 100644 --- a/chrome/browser/ui/views/constrained_web_dialog_delegate_views.cc +++ b/chrome/browser/ui/views/constrained_web_dialog_delegate_views.cc @@ -19,8 +19,6 @@ #include "ui/web_dialogs/web_dialog_ui.h" using content::WebContents; -using ui::ConstrainedWebDialogDelegate; -using ui::ConstrainedWebDialogUI; using ui::WebDialogDelegate; using ui::WebDialogWebContentsDelegate; @@ -174,15 +172,16 @@ ConstrainedWebDialogDelegateViewViews::ConstrainedWebDialogDelegateViewViews( ConstrainedWebDialogDelegateViewViews::~ConstrainedWebDialogDelegateViewViews() { } -ConstrainedWebDialogDelegate* ui::CreateConstrainedWebDialog( +ConstrainedWebDialogDelegate* CreateConstrainedWebDialog( Profile* profile, WebDialogDelegate* delegate, WebDialogWebContentsDelegate* tab_delegate, - TabContents* container) { + content::WebContents* web_contents) { ConstrainedWebDialogDelegateViewViews* constrained_delegate = - new ConstrainedWebDialogDelegateViewViews(profile, delegate, tab_delegate); + new ConstrainedWebDialogDelegateViewViews( + profile, delegate, tab_delegate); ConstrainedWindow* constrained_window = - new ConstrainedWindowViews(container->web_contents(), + new ConstrainedWindowViews(web_contents, constrained_delegate, false, ConstrainedWindowViews::DEFAULT_INSETS); diff --git a/chrome/browser/ui/webui/certificate_viewer_ui.cc b/chrome/browser/ui/webui/certificate_viewer_ui.cc index ae73931..66fb580 100644 --- a/chrome/browser/ui/webui/certificate_viewer_ui.cc +++ b/chrome/browser/ui/webui/certificate_viewer_ui.cc @@ -14,8 +14,6 @@ #include "grit/browser_resources.h" #include "grit/generated_resources.h" -using ui::ConstrainedWebDialogUI; - CertificateViewerUI::CertificateViewerUI(content::WebUI* web_ui) : ConstrainedWebDialogUI(web_ui) { // Set up the chrome://view-cert source. diff --git a/chrome/browser/ui/webui/certificate_viewer_ui.h b/chrome/browser/ui/webui/certificate_viewer_ui.h index d340ba0..20318b6 100644 --- a/chrome/browser/ui/webui/certificate_viewer_ui.h +++ b/chrome/browser/ui/webui/certificate_viewer_ui.h @@ -5,10 +5,10 @@ #ifndef CHROME_BROWSER_UI_WEBUI_CERTIFICATE_VIEWER_UI_H_ #define CHROME_BROWSER_UI_WEBUI_CERTIFICATE_VIEWER_UI_H_ -#include "ui/web_dialogs/constrained_web_dialog_ui.h" +#include "chrome/browser/ui/webui/constrained_web_dialog_ui.h" // The WebUI for chrome://view-cert -class CertificateViewerUI : public ui::ConstrainedWebDialogUI { +class CertificateViewerUI : public ConstrainedWebDialogUI { public: explicit CertificateViewerUI(content::WebUI* web_ui); virtual ~CertificateViewerUI(); diff --git a/chrome/browser/ui/webui/certificate_viewer_webui.cc b/chrome/browser/ui/webui/certificate_viewer_webui.cc index f46b65a..0cebba5 100644 --- a/chrome/browser/ui/webui/certificate_viewer_webui.cc +++ b/chrome/browser/ui/webui/certificate_viewer_webui.cc @@ -11,17 +11,18 @@ #include "base/string_number_conversions.h" #include "base/utf_string_conversions.h" #include "chrome/browser/certificate_viewer.h" +#include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser_dialogs.h" #include "chrome/browser/ui/certificate_dialogs.h" #include "chrome/browser/ui/constrained_window.h" #include "chrome/browser/ui/tab_contents/tab_contents.h" +#include "chrome/browser/ui/webui/constrained_web_dialog_ui.h" #include "chrome/common/net/x509_certificate_model.h" #include "chrome/common/url_constants.h" #include "content/public/browser/web_contents.h" #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" #include "ui/gfx/size.h" -#include "ui/web_dialogs/constrained_web_dialog_ui.h" #include "ui/web_dialogs/web_dialog_observer.h" using content::WebContents; @@ -70,14 +71,15 @@ CertificateViewerDialog::~CertificateViewerDialog() { void CertificateViewerDialog::Show(WebContents* web_contents, gfx::NativeWindow parent) { - // TODO(bshe): UI tweaks needed for AURA html Dialog, such as add padding on - // title for AURA ConstrainedWebDialogUI. - TabContents* tab = TabContents::FromWebContents(web_contents); - window_ = ui::CreateConstrainedWebDialog( - tab->profile(), + // TODO(bshe): UI tweaks needed for Aura HTML Dialog, such as adding padding + // on the title for Aura ConstrainedWebDialogUI. + Profile* profile = + Profile::FromBrowserContext(web_contents->GetBrowserContext()); + window_ = CreateConstrainedWebDialog( + profile, this, NULL, - tab)->window()->GetNativeWindow(); + web_contents)->window()->GetNativeWindow(); } ui::ModalType CertificateViewerDialog::GetDialogModalType() const { diff --git a/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc b/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc index 9f6e158..b691831 100644 --- a/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc +++ b/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc @@ -16,6 +16,7 @@ #include "chrome/browser/ui/tab_contents/tab_contents.h" #include "chrome/browser/ui/webui/about_ui.h" #include "chrome/browser/ui/webui/bookmarks_ui.h" +#include "chrome/browser/ui/webui/constrained_web_dialog_ui.h" #include "chrome/browser/ui/webui/crashes_ui.h" #include "chrome/browser/ui/webui/devtools_ui.h" #include "chrome/browser/ui/webui/downloads_ui.h" @@ -61,7 +62,6 @@ #include "content/public/common/content_client.h" #include "googleurl/src/gurl.h" #include "ui/gfx/favicon_size.h" -#include "ui/web_dialogs/constrained_web_dialog_ui.h" #include "ui/web_dialogs/web_dialog_ui.h" #if defined(OS_ANDROID) @@ -105,7 +105,6 @@ using content::WebUI; using content::WebUIController; -using ui::ConstrainedWebDialogUI; using ui::ExternalWebDialogUI; using ui::WebDialogUI; diff --git a/chrome/browser/ui/webui/constrained_web_dialog_delegate_base.cc b/chrome/browser/ui/webui/constrained_web_dialog_delegate_base.cc index 4b03d5c..310167b 100644 --- a/chrome/browser/ui/webui/constrained_web_dialog_delegate_base.cc +++ b/chrome/browser/ui/webui/constrained_web_dialog_delegate_base.cc @@ -17,7 +17,6 @@ using content::NativeWebKeyboardEvent; using content::WebContents; -using ui::ConstrainedWebDialogUI; using ui::WebDialogDelegate; using ui::WebDialogWebContentsDelegate; diff --git a/chrome/browser/ui/webui/constrained_web_dialog_delegate_base.h b/chrome/browser/ui/webui/constrained_web_dialog_delegate_base.h index ba7ab12..42826b5 100644 --- a/chrome/browser/ui/webui/constrained_web_dialog_delegate_base.h +++ b/chrome/browser/ui/webui/constrained_web_dialog_delegate_base.h @@ -7,7 +7,7 @@ #include "base/memory/scoped_ptr.h" #include "chrome/browser/ui/tab_contents/tab_contents.h" -#include "ui/web_dialogs/constrained_web_dialog_ui.h" +#include "chrome/browser/ui/webui/constrained_web_dialog_ui.h" #include "ui/web_dialogs/web_dialog_ui.h" #include "ui/web_dialogs/web_dialog_web_contents_delegate.h" @@ -17,7 +17,7 @@ class WebDialogDelegate; // Platform-agnostic base implementation of ConstrainedWebDialogDelegate. class ConstrainedWebDialogDelegateBase - : public ui::ConstrainedWebDialogDelegate, + : public ConstrainedWebDialogDelegate, public ui::WebDialogWebContentsDelegate { public: ConstrainedWebDialogDelegateBase( @@ -29,7 +29,7 @@ class ConstrainedWebDialogDelegateBase void set_window(ConstrainedWindow* window); bool closed_via_webui() const; - // ui::ConstrainedWebDialogDelegate interface. + // ConstrainedWebDialogDelegate interface. virtual const ui::WebDialogDelegate* GetWebDialogDelegate() const OVERRIDE; virtual ui::WebDialogDelegate* GetWebDialogDelegate() OVERRIDE; diff --git a/ui/web_dialogs/constrained_web_dialog_ui.cc b/chrome/browser/ui/webui/constrained_web_dialog_ui.cc index b14b5ca..e9c39c8 100644 --- a/ui/web_dialogs/constrained_web_dialog_ui.cc +++ b/chrome/browser/ui/webui/constrained_web_dialog_ui.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "ui/web_dialogs/constrained_web_dialog_ui.h" +#include "chrome/browser/ui/webui/constrained_web_dialog_ui.h" #include <string> #include <vector> @@ -22,8 +22,6 @@ using content::RenderViewHost; using content::WebContents; using content::WebUIMessageHandler; -namespace ui { - namespace { const char kConstrainedWebDialogDelegateUserDataKey[] = @@ -59,7 +57,7 @@ void ConstrainedWebDialogUI::RenderViewCreated( if (!delegate) return; - WebDialogDelegate* dialog_delegate = delegate->GetWebDialogDelegate(); + ui::WebDialogDelegate* dialog_delegate = delegate->GetWebDialogDelegate(); std::vector<WebUIMessageHandler*> handlers; dialog_delegate->GetWebUIMessageHandlers(&handlers); render_view_host->SetWebUIProperty("dialogArguments", @@ -105,5 +103,3 @@ ConstrainedWebDialogDelegate* ConstrainedWebDialogUI::GetConstrainedDelegate() { return user_data ? user_data->delegate() : NULL; } - -} // namespace ui diff --git a/ui/web_dialogs/constrained_web_dialog_ui.h b/chrome/browser/ui/webui/constrained_web_dialog_ui.h index 04e9084..df21836 100644 --- a/ui/web_dialogs/constrained_web_dialog_ui.h +++ b/chrome/browser/ui/webui/constrained_web_dialog_ui.h @@ -2,12 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef UI_WEB_DIALOGS_CONSTRAINED_WEB_DIALOG_UI_H_ -#define UI_WEB_DIALOGS_CONSTRAINED_WEB_DIALOG_UI_H_ +#ifndef CHROME_BROWSER_UI_WEBUI_CONSTRAINED_WEB_DIALOG_UI_H_ +#define CHROME_BROWSER_UI_WEBUI_CONSTRAINED_WEB_DIALOG_UI_H_ #include "base/compiler_specific.h" #include "content/public/browser/web_ui_controller.h" -#include "ui/web_dialogs/web_dialogs_export.h" class ConstrainedWindow; class Profile; @@ -21,19 +20,20 @@ class WebContents; namespace ui { class WebDialogDelegate; class WebDialogWebContentsDelegate; +} -class WEB_DIALOGS_EXPORT ConstrainedWebDialogDelegate { +class ConstrainedWebDialogDelegate { public: - virtual const WebDialogDelegate* GetWebDialogDelegate() const = 0; - virtual WebDialogDelegate* GetWebDialogDelegate() = 0; + virtual const ui::WebDialogDelegate* GetWebDialogDelegate() const = 0; + virtual ui::WebDialogDelegate* GetWebDialogDelegate() = 0; // Called when the dialog is being closed in response to a "DialogClose" // message from WebUI. virtual void OnDialogCloseFromWebUI() = 0; - // If called, on dialog closure, the dialog will release its WebContents + // If called, on dialog closure, the dialog will release its TabContents // instead of destroying it. After which point, the caller will own the - // released WebContents. + // released TabContents. virtual void ReleaseTabContentsOnDialogClose() = 0; // Returns the ConstrainedWindow. @@ -54,9 +54,9 @@ class WEB_DIALOGS_EXPORT ConstrainedWebDialogDelegate { // // Since ConstrainedWindow requires platform-specific delegate // implementations, this class is just a factory stub. -// TODO(thestig) Refactor the platform-independent code out of the +// TODO(thestig): Refactor the platform-independent code out of the // platform-specific implementations. -class WEB_DIALOGS_EXPORT ConstrainedWebDialogUI +class ConstrainedWebDialogUI : public content::WebUIController { public: explicit ConstrainedWebDialogUI(content::WebUI* web_ui); @@ -94,10 +94,8 @@ class WEB_DIALOGS_EXPORT ConstrainedWebDialogUI // |overshadowed| is the tab being overshadowed by the dialog. ConstrainedWebDialogDelegate* CreateConstrainedWebDialog( Profile* profile, - WebDialogDelegate* delegate, - WebDialogWebContentsDelegate* tab_delegate, - TabContents* overshadowed); - -} // namespace ui + ui::WebDialogDelegate* delegate, + ui::WebDialogWebContentsDelegate* tab_delegate, + content::WebContents* overshadowed); -#endif // UI_WEB_DIALOGS_CONSTRAINED_WEB_DIALOG_UI_H_ +#endif // CHROME_BROWSER_UI_WEBUI_CONSTRAINED_WEB_DIALOG_UI_H_ diff --git a/chrome/browser/ui/webui/constrained_web_dialog_ui_browsertest.cc b/chrome/browser/ui/webui/constrained_web_dialog_ui_browsertest.cc index f7d9538..27a0ea5 100644 --- a/chrome/browser/ui/webui/constrained_web_dialog_ui_browsertest.cc +++ b/chrome/browser/ui/webui/constrained_web_dialog_ui_browsertest.cc @@ -9,16 +9,15 @@ #include "chrome/browser/ui/browser_tabstrip.h" #include "chrome/browser/ui/constrained_window_tab_helper.h" #include "chrome/browser/ui/tab_contents/tab_contents.h" +#include "chrome/browser/ui/webui/constrained_web_dialog_ui.h" #include "chrome/browser/ui/webui/test_web_dialog_delegate.h" #include "chrome/common/url_constants.h" #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/ui_test_utils.h" #include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents_observer.h" -#include "ui/web_dialogs/constrained_web_dialog_ui.h" using content::WebContents; -using ui::ConstrainedWebDialogDelegate; using ui::WebDialogDelegate; namespace { @@ -49,10 +48,9 @@ class ConstrainedWebDialogBrowserTest : public InProcessBrowserTest { ConstrainedWebDialogBrowserTest() {} protected: - size_t GetConstrainedWindowCount(TabContents* tab_contents) const { + size_t GetConstrainedWindowCount(WebContents* web_contents) const { ConstrainedWindowTabHelper* constrained_window_tab_helper = - ConstrainedWindowTabHelper::FromWebContents - (tab_contents->web_contents()); + ConstrainedWindowTabHelper::FromWebContents(web_contents); return constrained_window_tab_helper->constrained_window_count(); } }; @@ -62,17 +60,17 @@ IN_PROC_BROWSER_TEST_F(ConstrainedWebDialogBrowserTest, BasicTest) { // The delegate deletes itself. WebDialogDelegate* delegate = new test::TestWebDialogDelegate( GURL(chrome::kChromeUIConstrainedHTMLTestURL)); - TabContents* tab_contents = chrome::GetActiveTabContents(browser()); - ASSERT_TRUE(tab_contents); + WebContents* web_contents = chrome::GetActiveWebContents(browser()); + ASSERT_TRUE(web_contents); ConstrainedWebDialogDelegate* dialog_delegate = - ui::CreateConstrainedWebDialog(browser()->profile(), - delegate, - NULL, - tab_contents); + CreateConstrainedWebDialog(browser()->profile(), + delegate, + NULL, + web_contents); ASSERT_TRUE(dialog_delegate); EXPECT_TRUE(dialog_delegate->window()); - EXPECT_EQ(1U, GetConstrainedWindowCount(tab_contents)); + EXPECT_EQ(1U, GetConstrainedWindowCount(web_contents)); } // Tests that ReleaseTabContentsOnDialogClose() works. @@ -81,25 +79,25 @@ IN_PROC_BROWSER_TEST_F(ConstrainedWebDialogBrowserTest, // The delegate deletes itself. WebDialogDelegate* delegate = new test::TestWebDialogDelegate( GURL(chrome::kChromeUIConstrainedHTMLTestURL)); - TabContents* tab_contents = chrome::GetActiveTabContents(browser()); - ASSERT_TRUE(tab_contents); + WebContents* web_contents = chrome::GetActiveWebContents(browser()); + ASSERT_TRUE(web_contents); ConstrainedWebDialogDelegate* dialog_delegate = - ui::CreateConstrainedWebDialog(browser()->profile(), - delegate, - NULL, - tab_contents); + CreateConstrainedWebDialog(browser()->profile(), + delegate, + NULL, + web_contents); ASSERT_TRUE(dialog_delegate); scoped_ptr<TabContents> new_tab(dialog_delegate->tab()); ASSERT_TRUE(new_tab.get()); - ASSERT_EQ(1U, GetConstrainedWindowCount(tab_contents)); + ASSERT_EQ(1U, GetConstrainedWindowCount(web_contents)); ConstrainedWebDialogBrowserTestObserver observer(new_tab->web_contents()); dialog_delegate->ReleaseTabContentsOnDialogClose(); dialog_delegate->OnDialogCloseFromWebUI(); ASSERT_FALSE(observer.tab_destroyed()); - EXPECT_EQ(0U, GetConstrainedWindowCount(tab_contents)); + EXPECT_EQ(0U, GetConstrainedWindowCount(web_contents)); new_tab.reset(); EXPECT_TRUE(observer.tab_destroyed()); } diff --git a/chrome/browser/ui/webui/print_preview/print_preview_ui.cc b/chrome/browser/ui/webui/print_preview/print_preview_ui.cc index 8a10ece..c1346b5 100644 --- a/chrome/browser/ui/webui/print_preview/print_preview_ui.cc +++ b/chrome/browser/ui/webui/print_preview/print_preview_ui.cc @@ -33,8 +33,6 @@ using content::WebContents; using printing::PageSizeMargins; -using ui::ConstrainedWebDialogDelegate; -using ui::ConstrainedWebDialogUI; namespace { diff --git a/chrome/browser/ui/webui/print_preview/print_preview_ui.h b/chrome/browser/ui/webui/print_preview/print_preview_ui.h index 6ff2995..5402aff 100644 --- a/chrome/browser/ui/webui/print_preview/print_preview_ui.h +++ b/chrome/browser/ui/webui/print_preview/print_preview_ui.h @@ -10,7 +10,7 @@ #include "base/gtest_prod_util.h" #include "base/memory/ref_counted.h" #include "base/time.h" -#include "ui/web_dialogs/constrained_web_dialog_ui.h" +#include "chrome/browser/ui/webui/constrained_web_dialog_ui.h" class PrintPreviewDataService; class PrintPreviewHandler; @@ -28,7 +28,7 @@ namespace printing { struct PageSizeMargins; } -class PrintPreviewUI : public ui::ConstrainedWebDialogUI { +class PrintPreviewUI : public ConstrainedWebDialogUI { public: explicit PrintPreviewUI(content::WebUI* web_ui); virtual ~PrintPreviewUI(); diff --git a/chrome/browser/ui/webui/tab_modal_confirm_dialog_webui.cc b/chrome/browser/ui/webui/tab_modal_confirm_dialog_webui.cc index b684519..fe50560 100644 --- a/chrome/browser/ui/webui/tab_modal_confirm_dialog_webui.cc +++ b/chrome/browser/ui/webui/tab_modal_confirm_dialog_webui.cc @@ -19,6 +19,7 @@ #include "chrome/browser/ui/tab_modal_confirm_dialog_delegate.h" #include "chrome/browser/ui/webui/chrome_url_data_manager.h" #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h" +#include "chrome/browser/ui/webui/constrained_web_dialog_ui.h" #include "chrome/common/jstemplate_builder.h" #include "chrome/common/url_constants.h" #include "grit/browser_resources.h" @@ -26,7 +27,6 @@ #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" #include "ui/gfx/size.h" -#include "ui/web_dialogs/constrained_web_dialog_ui.h" using content::WebContents; using content::WebUIMessageHandler; @@ -52,10 +52,10 @@ TabModalConfirmDialogWebUI::TabModalConfirmDialogWebUI( ChromeURLDataManager::AddDataSource(profile, data_source); constrained_web_dialog_delegate_ = - ui::CreateConstrainedWebDialog(profile, - this, - NULL, - tab_contents); + CreateConstrainedWebDialog(profile, + this, + NULL, + tab_contents->web_contents()); delegate_->set_window(constrained_web_dialog_delegate_->window()); } diff --git a/chrome/browser/ui/webui/tab_modal_confirm_dialog_webui.h b/chrome/browser/ui/webui/tab_modal_confirm_dialog_webui.h index 5cbecd9..2f4a512 100644 --- a/chrome/browser/ui/webui/tab_modal_confirm_dialog_webui.h +++ b/chrome/browser/ui/webui/tab_modal_confirm_dialog_webui.h @@ -15,9 +15,7 @@ #include "chrome/browser/ui/tab_modal_confirm_dialog.h" #include "ui/web_dialogs/web_dialog_delegate.h" -namespace ui { class ConstrainedWebDialogDelegate; -} // Displays a tab-modal dialog, i.e. a dialog that will block the current page // but still allow the user to switch to a different page. @@ -44,7 +42,7 @@ class TabModalConfirmDialogWebUI : public TabModalConfirmDialog, bool* out_close_dialog) OVERRIDE; virtual bool ShouldShowDialogTitle() const OVERRIDE; - ui::ConstrainedWebDialogDelegate* constrained_web_dialog_delegate() { + ConstrainedWebDialogDelegate* constrained_web_dialog_delegate() { return constrained_web_dialog_delegate_; } @@ -58,7 +56,7 @@ class TabModalConfirmDialogWebUI : public TabModalConfirmDialog, scoped_ptr<TabModalConfirmDialogDelegate> delegate_; // Deletes itself. - ui::ConstrainedWebDialogDelegate* constrained_web_dialog_delegate_; + ConstrainedWebDialogDelegate* constrained_web_dialog_delegate_; DISALLOW_COPY_AND_ASSIGN(TabModalConfirmDialogWebUI); }; diff --git a/chrome/chrome_browser_ui.gypi b/chrome/chrome_browser_ui.gypi index eb48477..f8bcda9 100644 --- a/chrome/chrome_browser_ui.gypi +++ b/chrome/chrome_browser_ui.gypi @@ -1773,6 +1773,8 @@ 'browser/ui/webui/chromeos/system_info_ui.h', 'browser/ui/webui/chromeos/ui_account_tweaks.cc', 'browser/ui/webui/chromeos/ui_account_tweaks.h', + 'browser/ui/webui/constrained_web_dialog_ui.cc', + 'browser/ui/webui/constrained_web_dialog_ui.h', 'browser/ui/webui/constrained_web_dialog_delegate_base.cc', 'browser/ui/webui/constrained_web_dialog_delegate_base.h', 'browser/ui/webui/cookies_tree_model_util.cc', diff --git a/ui/web_dialogs/web_dialogs.gyp b/ui/web_dialogs/web_dialogs.gyp index 12be315..4ee400a 100644 --- a/ui/web_dialogs/web_dialogs.gyp +++ b/ui/web_dialogs/web_dialogs.gyp @@ -21,8 +21,6 @@ ], 'sources': [ # All .cc, .h under web_dialogs, except unittests. - 'constrained_web_dialog_ui.cc', - 'constrained_web_dialog_ui.h', 'web_dialog_delegate.cc', 'web_dialog_delegate.h', 'web_dialog_observer.h', |