diff options
author | gbillock@chromium.org <gbillock@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-15 16:27:25 +0000 |
---|---|---|
committer | gbillock@chromium.org <gbillock@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-15 16:27:25 +0000 |
commit | f1445449441ec8a0bf436c08d3b91ad7a2fec52b (patch) | |
tree | 2c3691e5400357ccf8087174bfd23ffd237a2438 | |
parent | 44ab9f57ab772166c143c411901694b73f133252 (diff) | |
download | chromium_src-f1445449441ec8a0bf436c08d3b91ad7a2fec52b.zip chromium_src-f1445449441ec8a0bf436c08d3b91ad7a2fec52b.tar.gz chromium_src-f1445449441ec8a0bf436c08d3b91ad7a2fec52b.tar.bz2 |
[WebModal] Rename NativeWebContentsModalDialogManager to SingleWebContentsDialogManager.
This includes a couple of other method name updates as well.
R=wittman@chromium.org
Review URL: https://codereview.chromium.org/231173004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@263866 0039d316-1c4b-4281-b951-d872f2087c98
23 files changed, 110 insertions, 100 deletions
diff --git a/chrome/browser/chromeos/attestation/platform_verification_dialog.cc b/chrome/browser/chromeos/attestation/platform_verification_dialog.cc index 13da9d4..097b050 100644 --- a/chrome/browser/chromeos/attestation/platform_verification_dialog.cc +++ b/chrome/browser/chromeos/attestation/platform_verification_dialog.cc @@ -57,7 +57,8 @@ void PlatformVerificationDialog::ShowDialog( web_contents_modal_dialog_manager->delegate(); views::Widget* widget = views::Widget::CreateWindowAsFramelessChild( dialog, modal_delegate->GetWebContentsModalDialogHost()->GetHostView()); - web_contents_modal_dialog_manager->ShowDialog(widget->GetNativeView()); + web_contents_modal_dialog_manager->ShowModalDialog( + widget->GetNativeView()); widget->Show(); } diff --git a/chrome/browser/chromeos/login/captive_portal_window_proxy.cc b/chrome/browser/chromeos/login/captive_portal_window_proxy.cc index 0bf4e3d..8d5a8e9 100644 --- a/chrome/browser/chromeos/login/captive_portal_window_proxy.cc +++ b/chrome/browser/chromeos/login/captive_portal_window_proxy.cc @@ -67,7 +67,8 @@ void CaptivePortalWindowProxy::Show() { captive_portal_view->Init(); widget_->AddObserver(this); - web_contents_modal_dialog_manager->ShowDialog(widget_->GetNativeView()); + web_contents_modal_dialog_manager->ShowModalDialog( + widget_->GetNativeView()); DCHECK(GetState() == STATE_DISPLAYED); } diff --git a/chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.mm b/chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.mm index ed984a7..8ddade5 100644 --- a/chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.mm +++ b/chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.mm @@ -30,7 +30,7 @@ ConstrainedWindowMac::ConstrainedWindowMac( DCHECK(sheet_.get()); WebContentsModalDialogManager* web_contents_modal_dialog_manager = WebContentsModalDialogManager::FromWebContents(web_contents); - web_contents_modal_dialog_manager->ShowDialog(this); + web_contents_modal_dialog_manager->ShowModalDialog(this); } ConstrainedWindowMac::~ConstrainedWindowMac() { diff --git a/chrome/browser/ui/cocoa/web_contents_modal_dialog_manager_cocoa.mm b/chrome/browser/ui/cocoa/web_contents_modal_dialog_manager_cocoa.mm index 5d19bc6..0b6847f 100644 --- a/chrome/browser/ui/cocoa/web_contents_modal_dialog_manager_cocoa.mm +++ b/chrome/browser/ui/cocoa/web_contents_modal_dialog_manager_cocoa.mm @@ -5,14 +5,14 @@ #include "components/web_modal/web_contents_modal_dialog_manager.h" #include "chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.h" -#include "components/web_modal/native_web_contents_modal_dialog_manager.h" +#include "components/web_modal/single_web_contents_dialog_manager.h" using web_modal::NativeWebContentsModalDialog; namespace { class NativeWebContentsModalDialogManagerCocoa - : public web_modal::NativeWebContentsModalDialogManager { + : public web_modal::SingleWebContentsDialogManager { public: NativeWebContentsModalDialogManagerCocoa() { } @@ -20,7 +20,7 @@ class NativeWebContentsModalDialogManagerCocoa virtual ~NativeWebContentsModalDialogManagerCocoa() { } - // NativeWebContentsModalDialogManager overrides + // SingleWebContentsDialogManager overrides virtual void ManageDialog(NativeWebContentsModalDialog dialog) OVERRIDE { } @@ -60,9 +60,9 @@ class NativeWebContentsModalDialogManagerCocoa namespace web_modal { -NativeWebContentsModalDialogManager* - WebContentsModalDialogManager::CreateNativeManager( - NativeWebContentsModalDialogManagerDelegate* native_delegate) { +SingleWebContentsDialogManager* + WebContentsModalDialogManager::CreateNativeWebModalManager( + SingleWebContentsDialogManagerDelegate* native_delegate) { return new NativeWebContentsModalDialogManagerCocoa; } diff --git a/chrome/browser/ui/tabs/tab_strip_model_unittest.cc b/chrome/browser/ui/tabs/tab_strip_model_unittest.cc index c544308..76a66974 100644 --- a/chrome/browser/ui/tabs/tab_strip_model_unittest.cc +++ b/chrome/browser/ui/tabs/tab_strip_model_unittest.cc @@ -104,13 +104,13 @@ class TabStripModelTestIDUserData : public base::SupportsUserData::Data { int id_; }; -class DummyNativeWebContentsModalDialogManager - : public web_modal::NativeWebContentsModalDialogManager { +class DummySingleWebContentsDialogManager + : public web_modal::SingleWebContentsDialogManager { public: - explicit DummyNativeWebContentsModalDialogManager( - web_modal::NativeWebContentsModalDialogManagerDelegate* delegate) + explicit DummySingleWebContentsDialogManager( + web_modal::SingleWebContentsDialogManagerDelegate* delegate) : delegate_(delegate) {} - virtual ~DummyNativeWebContentsModalDialogManager() {} + virtual ~DummySingleWebContentsDialogManager() {} virtual void ManageDialog(NativeWebContentsModalDialog dialog) OVERRIDE {} virtual void ShowDialog(NativeWebContentsModalDialog dialog) OVERRIDE {} @@ -124,9 +124,9 @@ class DummyNativeWebContentsModalDialogManager web_modal::WebContentsModalDialogHost* new_host) OVERRIDE {} private: - web_modal::NativeWebContentsModalDialogManagerDelegate* delegate_; + web_modal::SingleWebContentsDialogManagerDelegate* delegate_; - DISALLOW_COPY_AND_ASSIGN(DummyNativeWebContentsModalDialogManager); + DISALLOW_COPY_AND_ASSIGN(DummySingleWebContentsDialogManager); }; // Test Browser-like class for TabStripModelTest.TabBlockedState. @@ -2557,20 +2557,20 @@ TEST_F(TabStripModelTest, TabBlockedState) { TabStripModel strip_dst(&dummy_tab_strip_delegate, profile()); TabBlockedStateTestBrowser browser_dst(&strip_dst); - // Setup a NativeWebContentsModalDialogManager for tab |contents2|. + // Setup a SingleWebContentsDialogManager for tab |contents2|. web_modal::WebContentsModalDialogManager* modal_dialog_manager = web_modal::WebContentsModalDialogManager::FromWebContents(contents2); web_modal::WebContentsModalDialogManager::TestApi test_api( modal_dialog_manager); // Show a dialog that blocks tab |contents2|. - // DummyNativeWebContentsModalDialogManager doesn't care about the + // DummySingleWebContentsDialogManager doesn't care about the // NativeWebContentsModalDialog value, so any dummy value works. - DummyNativeWebContentsModalDialogManager* native_manager = - new DummyNativeWebContentsModalDialogManager(modal_dialog_manager); + DummySingleWebContentsDialogManager* native_manager = + new DummySingleWebContentsDialogManager(modal_dialog_manager); modal_dialog_manager->ShowDialogWithManager( reinterpret_cast<NativeWebContentsModalDialog>(0), - scoped_ptr<web_modal::NativeWebContentsModalDialogManager>( + scoped_ptr<web_modal::SingleWebContentsDialogManager>( native_manager).Pass()); EXPECT_TRUE(strip_src.IsTabBlocked(1)); diff --git a/chrome/browser/ui/views/autofill/autofill_dialog_views.cc b/chrome/browser/ui/views/autofill/autofill_dialog_views.cc index bda65dc..64f94f5 100644 --- a/chrome/browser/ui/views/autofill/autofill_dialog_views.cc +++ b/chrome/browser/ui/views/autofill/autofill_dialog_views.cc @@ -1251,7 +1251,8 @@ void AutofillDialogViews::Show() { DCHECK(modal_delegate); window_ = views::Widget::CreateWindowAsFramelessChild( this, modal_delegate->GetWebContentsModalDialogHost()->GetHostView()); - web_contents_modal_dialog_manager->ShowDialog(window_->GetNativeView()); + web_contents_modal_dialog_manager->ShowModalDialog( + window_->GetNativeView()); focus_manager_ = window_->GetFocusManager(); focus_manager_->AddFocusChangeListener(this); diff --git a/chrome/browser/ui/views/collected_cookies_views.cc b/chrome/browser/ui/views/collected_cookies_views.cc index 99ddef9..465fa47 100644 --- a/chrome/browser/ui/views/collected_cookies_views.cc +++ b/chrome/browser/ui/views/collected_cookies_views.cc @@ -214,7 +214,8 @@ CollectedCookiesViews::CollectedCookiesViews(content::WebContents* web_contents) DCHECK(modal_delegate); window_ = views::Widget::CreateWindowAsFramelessChild( this, modal_delegate->GetWebContentsModalDialogHost()->GetHostView()); - web_contents_modal_dialog_manager->ShowDialog(window_->GetNativeView()); + web_contents_modal_dialog_manager->ShowModalDialog( + window_->GetNativeView()); } /////////////////////////////////////////////////////////////////////////////// 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 02126c4..c3042b0 100644 --- a/chrome/browser/ui/views/constrained_web_dialog_delegate_views.cc +++ b/chrome/browser/ui/views/constrained_web_dialog_delegate_views.cc @@ -213,7 +213,8 @@ ConstrainedWebDialogDelegate* CreateConstrainedWebDialog( views::Widget* window = views::Widget::CreateWindowAsFramelessChild( constrained_delegate, modal_delegate->GetWebContentsModalDialogHost()->GetHostView()); - web_contents_modal_dialog_manager->ShowDialog(window->GetNativeView()); + web_contents_modal_dialog_manager->ShowModalDialog( + window->GetNativeView()); constrained_delegate->SetWindow(window); return constrained_delegate; } diff --git a/chrome/browser/ui/views/constrained_window_views_browsertest.cc b/chrome/browser/ui/views/constrained_window_views_browsertest.cc index afc26a4..3f19cb0 100644 --- a/chrome/browser/ui/views/constrained_window_views_browsertest.cc +++ b/chrome/browser/ui/views/constrained_window_views_browsertest.cc @@ -158,7 +158,7 @@ IN_PROC_BROWSER_TEST_F(ConstrainedWindowViewTest, MAYBE_FocusTest) { views::Widget* window1 = views::Widget::CreateWindowAsFramelessChild( test_dialog1.get(), modal_delegate->GetWebContentsModalDialogHost()->GetHostView()); - web_contents_modal_dialog_manager->ShowDialog(window1->GetNativeView()); + web_contents_modal_dialog_manager->ShowModalDialog(window1->GetNativeView()); views::FocusManager* focus_manager = window1->GetFocusManager(); ASSERT_TRUE(focus_manager); @@ -174,7 +174,7 @@ IN_PROC_BROWSER_TEST_F(ConstrainedWindowViewTest, MAYBE_FocusTest) { views::Widget* window2 = views::Widget::CreateWindowAsFramelessChild( test_dialog2.get(), modal_delegate->GetWebContentsModalDialogHost()->GetHostView()); - web_contents_modal_dialog_manager->ShowDialog(window2->GetNativeView()); + web_contents_modal_dialog_manager->ShowModalDialog(window2->GetNativeView()); // Should be the same focus_manager. ASSERT_EQ(focus_manager, window2->GetFocusManager()); @@ -247,7 +247,7 @@ IN_PROC_BROWSER_TEST_F(ConstrainedWindowViewTest, MAYBE_TabCloseTest) { views::Widget* window = views::Widget::CreateWindowAsFramelessChild( test_dialog.get(), modal_delegate->GetWebContentsModalDialogHost()->GetHostView()); - web_contents_modal_dialog_manager->ShowDialog(window->GetNativeView()); + web_contents_modal_dialog_manager->ShowModalDialog(window->GetNativeView()); bool closed = browser()->tab_strip_model()->CloseWebContentsAt( @@ -282,7 +282,7 @@ IN_PROC_BROWSER_TEST_F(ConstrainedWindowViewTest, MAYBE_TabSwitchTest) { views::Widget* window = views::Widget::CreateWindowAsFramelessChild( test_dialog.get(), modal_delegate->GetWebContentsModalDialogHost()->GetHostView()); - web_contents_modal_dialog_manager->ShowDialog(window->GetNativeView()); + web_contents_modal_dialog_manager->ShowModalDialog(window->GetNativeView()); EXPECT_TRUE(window->IsVisible()); // Open a new tab. The constrained window should hide itself. @@ -332,7 +332,7 @@ IN_PROC_BROWSER_TEST_F(ConstrainedWindowViewTest, TabMoveTest) { views::Widget* window = views::Widget::CreateWindowAsFramelessChild( test_dialog.get(), modal_delegate->GetWebContentsModalDialogHost()->GetHostView()); - web_contents_modal_dialog_manager->ShowDialog(window->GetNativeView()); + web_contents_modal_dialog_manager->ShowModalDialog(window->GetNativeView()); EXPECT_TRUE(window->IsVisible()); // Detach the web contents from the second browser's tab strip. diff --git a/chrome/browser/ui/views/download/download_danger_prompt_views.cc b/chrome/browser/ui/views/download/download_danger_prompt_views.cc index 1fad5d7..70efbe2 100644 --- a/chrome/browser/ui/views/download/download_danger_prompt_views.cc +++ b/chrome/browser/ui/views/download/download_danger_prompt_views.cc @@ -357,7 +357,8 @@ DownloadDangerPrompt* DownloadDangerPrompt::Create( views::Widget* dialog = views::Widget::CreateWindowAsFramelessChild( download_danger_prompt, modal_delegate->GetWebContentsModalDialogHost()->GetHostView()); - web_contents_modal_dialog_manager->ShowDialog(dialog->GetNativeView()); + web_contents_modal_dialog_manager->ShowModalDialog( + dialog->GetNativeView()); return download_danger_prompt; } diff --git a/chrome/browser/ui/views/extensions/media_galleries_dialog_views.cc b/chrome/browser/ui/views/extensions/media_galleries_dialog_views.cc index f0b96f5..f0c00b4 100644 --- a/chrome/browser/ui/views/extensions/media_galleries_dialog_views.cc +++ b/chrome/browser/ui/views/extensions/media_galleries_dialog_views.cc @@ -87,7 +87,8 @@ MediaGalleriesDialogViews::MediaGalleriesDialogViews( DCHECK(modal_delegate); window_ = views::Widget::CreateWindowAsFramelessChild( this, modal_delegate->GetWebContentsModalDialogHost()->GetHostView()); - web_contents_modal_dialog_manager->ShowDialog(window_->GetNativeView()); + web_contents_modal_dialog_manager->ShowModalDialog( + window_->GetNativeView()); } } diff --git a/chrome/browser/ui/views/extensions/media_galleries_scan_result_dialog_views.cc b/chrome/browser/ui/views/extensions/media_galleries_scan_result_dialog_views.cc index 5dd295d..f1811c8 100644 --- a/chrome/browser/ui/views/extensions/media_galleries_scan_result_dialog_views.cc +++ b/chrome/browser/ui/views/extensions/media_galleries_scan_result_dialog_views.cc @@ -78,7 +78,8 @@ MediaGalleriesScanResultDialogViews::MediaGalleriesScanResultDialogViews( DCHECK(modal_delegate); window_ = views::Widget::CreateWindowAsFramelessChild( this, modal_delegate->GetWebContentsModalDialogHost()->GetHostView()); - web_contents_modal_dialog_manager->ShowDialog(window_->GetNativeView()); + web_contents_modal_dialog_manager->ShowModalDialog( + window_->GetNativeView()); } MediaGalleriesScanResultDialogViews::~MediaGalleriesScanResultDialogViews() {} diff --git a/chrome/browser/ui/views/login_prompt_views.cc b/chrome/browser/ui/views/login_prompt_views.cc index 0591b70..5ea8def 100644 --- a/chrome/browser/ui/views/login_prompt_views.cc +++ b/chrome/browser/ui/views/login_prompt_views.cc @@ -150,7 +150,8 @@ class LoginHandlerViews : public LoginHandler, CHECK(modal_delegate); dialog_ = views::Widget::CreateWindowAsFramelessChild( this, modal_delegate->GetWebContentsModalDialogHost()->GetHostView()); - web_contents_modal_dialog_manager->ShowDialog(dialog_->GetNativeView()); + web_contents_modal_dialog_manager->ShowModalDialog( + dialog_->GetNativeView()); NotifyAuthNeeded(); } diff --git a/chrome/browser/ui/views/pdf_password_dialog.cc b/chrome/browser/ui/views/pdf_password_dialog.cc index 0d5e656..b012d4f 100644 --- a/chrome/browser/ui/views/pdf_password_dialog.cc +++ b/chrome/browser/ui/views/pdf_password_dialog.cc @@ -74,7 +74,8 @@ PDFPasswordDialogViews::PDFPasswordDialogViews( DCHECK(modal_delegate); dialog_ = views::Widget::CreateWindowAsFramelessChild( this, modal_delegate->GetWebContentsModalDialogHost()->GetHostView()); - web_contents_modal_dialog_manager->ShowDialog(dialog_->GetNativeView()); + web_contents_modal_dialog_manager->ShowModalDialog( + dialog_->GetNativeView()); } PDFPasswordDialogViews::~PDFPasswordDialogViews() { diff --git a/chrome/browser/ui/views/signed_certificate_timestamps_views.cc b/chrome/browser/ui/views/signed_certificate_timestamps_views.cc index 18892bd..12c7708 100644 --- a/chrome/browser/ui/views/signed_certificate_timestamps_views.cc +++ b/chrome/browser/ui/views/signed_certificate_timestamps_views.cc @@ -111,7 +111,8 @@ SignedCertificateTimestampsViews::SignedCertificateTimestampsViews( DCHECK(modal_delegate); views::Widget* window = views::Widget::CreateWindowAsFramelessChild( this, modal_delegate->GetWebContentsModalDialogHost()->GetHostView()); - web_contents_modal_dialog_manager->ShowDialog(window->GetNativeView()); + web_contents_modal_dialog_manager->ShowModalDialog( + window->GetNativeView()); } SignedCertificateTimestampsViews::~SignedCertificateTimestampsViews() {} diff --git a/chrome/browser/ui/views/ssl_client_certificate_selector.cc b/chrome/browser/ui/views/ssl_client_certificate_selector.cc index 7dfcc4a..9175e8f 100644 --- a/chrome/browser/ui/views/ssl_client_certificate_selector.cc +++ b/chrome/browser/ui/views/ssl_client_certificate_selector.cc @@ -155,7 +155,8 @@ void SSLClientCertificateSelector::Init() { DCHECK(modal_delegate); window_ = views::Widget::CreateWindowAsFramelessChild( this, modal_delegate->GetWebContentsModalDialogHost()->GetHostView()); - web_contents_modal_dialog_manager->ShowDialog(window_->GetNativeView()); + web_contents_modal_dialog_manager->ShowModalDialog( + window_->GetNativeView()); // Select the first row automatically. This must be done after the dialog has // been created. diff --git a/chrome/browser/ui/views/tab_modal_confirm_dialog_views.cc b/chrome/browser/ui/views/tab_modal_confirm_dialog_views.cc index 907e74f..28e9b3b9 100644 --- a/chrome/browser/ui/views/tab_modal_confirm_dialog_views.cc +++ b/chrome/browser/ui/views/tab_modal_confirm_dialog_views.cc @@ -57,7 +57,8 @@ TabModalConfirmDialogViews::TabModalConfirmDialogViews( DCHECK(modal_delegate); dialog_ = views::Widget::CreateWindowAsFramelessChild( this, modal_delegate->GetWebContentsModalDialogHost()->GetHostView()); - web_contents_modal_dialog_manager->ShowDialog(dialog_->GetNativeView()); + web_contents_modal_dialog_manager->ShowModalDialog( + dialog_->GetNativeView()); delegate_->set_close_delegate(this); } diff --git a/chrome/browser/ui/views/web_contents_modal_dialog_manager_views.cc b/chrome/browser/ui/views/web_contents_modal_dialog_manager_views.cc index 911c510..12cec5f 100644 --- a/chrome/browser/ui/views/web_contents_modal_dialog_manager_views.cc +++ b/chrome/browser/ui/views/web_contents_modal_dialog_manager_views.cc @@ -7,7 +7,7 @@ #include "base/memory/scoped_ptr.h" #include "chrome/browser/platform_util.h" #include "chrome/browser/ui/views/constrained_window_views.h" -#include "components/web_modal/native_web_contents_modal_dialog_manager.h" +#include "components/web_modal/single_web_contents_dialog_manager.h" #include "components/web_modal/web_contents_modal_dialog_host.h" #include "components/web_modal/web_contents_modal_dialog_manager.h" #include "content/public/browser/web_contents_view.h" @@ -36,20 +36,20 @@ #endif using web_modal::NativeWebContentsModalDialog; -using web_modal::NativeWebContentsModalDialogManager; -using web_modal::NativeWebContentsModalDialogManagerDelegate; +using web_modal::SingleWebContentsDialogManager; +using web_modal::SingleWebContentsDialogManagerDelegate; using web_modal::WebContentsModalDialogHost; using web_modal::ModalDialogHostObserver; namespace { class NativeWebContentsModalDialogManagerViews - : public NativeWebContentsModalDialogManager, + : public SingleWebContentsDialogManager, public ModalDialogHostObserver, public views::WidgetObserver { public: NativeWebContentsModalDialogManagerViews( - NativeWebContentsModalDialogManagerDelegate* native_delegate) + SingleWebContentsDialogManagerDelegate* native_delegate) : native_delegate_(native_delegate), host_(NULL) { } @@ -65,7 +65,7 @@ class NativeWebContentsModalDialogManagerViews } } - // NativeWebContentsModalDialogManager overrides + // SingleWebContentsDialogManager overrides virtual void ManageDialog(NativeWebContentsModalDialog dialog) OVERRIDE { views::Widget* widget = GetWidget(dialog); widget->AddObserver(this); @@ -230,7 +230,7 @@ class NativeWebContentsModalDialogManagerViews native_delegate_->WillClose(widget->GetNativeView()); } - NativeWebContentsModalDialogManagerDelegate* native_delegate_; + SingleWebContentsDialogManagerDelegate* native_delegate_; WebContentsModalDialogHost* host_; std::set<views::Widget*> observed_widgets_; std::set<views::Widget*> shown_widgets_; @@ -242,9 +242,9 @@ class NativeWebContentsModalDialogManagerViews namespace web_modal { -NativeWebContentsModalDialogManager* WebContentsModalDialogManager:: -CreateNativeManager( - NativeWebContentsModalDialogManagerDelegate* native_delegate) { +SingleWebContentsDialogManager* WebContentsModalDialogManager:: +CreateNativeWebModalManager( + SingleWebContentsDialogManagerDelegate* native_delegate) { return new NativeWebContentsModalDialogManagerViews(native_delegate); } diff --git a/components/web_modal.gypi b/components/web_modal.gypi index 656d94d..356cb7e 100644 --- a/components/web_modal.gypi +++ b/components/web_modal.gypi @@ -22,7 +22,7 @@ 'web_modal/modal_dialog_host.cc', 'web_modal/modal_dialog_host.h', 'web_modal/native_web_contents_modal_dialog.h', - 'web_modal/native_web_contents_modal_dialog_manager.h', + 'web_modal/single_web_contents_dialog_manager.h', 'web_modal/web_contents_modal_dialog_host.cc', 'web_modal/web_contents_modal_dialog_host.h', 'web_modal/web_contents_modal_dialog_manager.cc', diff --git a/components/web_modal/native_web_contents_modal_dialog_manager.h b/components/web_modal/single_web_contents_dialog_manager.h index f97bd97..5df90e8 100644 --- a/components/web_modal/native_web_contents_modal_dialog_manager.h +++ b/components/web_modal/single_web_contents_dialog_manager.h @@ -1,9 +1,9 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef COMPONENTS_WEB_MODAL_NATIVE_WEB_CONTENTS_MODAL_DIALOG_MANAGER_H_ -#define COMPONENTS_WEB_MODAL_NATIVE_WEB_CONTENTS_MODAL_DIALOG_MANAGER_H_ +#ifndef COMPONENTS_WEB_MODAL_SINGLE_WEB_CONTENTS_DIALOG_MANAGER_H_ +#define COMPONENTS_WEB_MODAL_SINGLE_WEB_CONTENTS_DIALOG_MANAGER_H_ #include "components/web_modal/native_web_contents_modal_dialog.h" @@ -15,12 +15,12 @@ namespace web_modal { class WebContentsModalDialogHost; -// Interface from NativeWebContentsModalDialogManager to +// Interface from SingleWebContentsDialogManager to // WebContentsModalDialogManager. -class NativeWebContentsModalDialogManagerDelegate { +class SingleWebContentsDialogManagerDelegate { public: - NativeWebContentsModalDialogManagerDelegate() {} - virtual ~NativeWebContentsModalDialogManagerDelegate() {} + SingleWebContentsDialogManagerDelegate() {} + virtual ~SingleWebContentsDialogManagerDelegate() {} virtual content::WebContents* GetWebContents() const = 0; @@ -29,15 +29,14 @@ class NativeWebContentsModalDialogManagerDelegate { virtual void WillClose(NativeWebContentsModalDialog dialog) = 0; private: - DISALLOW_COPY_AND_ASSIGN(NativeWebContentsModalDialogManagerDelegate); + DISALLOW_COPY_AND_ASSIGN(SingleWebContentsDialogManagerDelegate); }; // Provides an interface for platform-specific UI implementation for the web // contents modal dialog. -// TODO(gbillock): perhaps rename to "SingleWebContentsDialogManager" -class NativeWebContentsModalDialogManager { +class SingleWebContentsDialogManager { public: - virtual ~NativeWebContentsModalDialogManager() {} + virtual ~SingleWebContentsDialogManager() {} // Starts management of the modal aspects of the dialog. This function should // also register to be notified when the dialog is closing, so that it can @@ -66,12 +65,12 @@ class NativeWebContentsModalDialogManager { virtual void HostChanged(WebContentsModalDialogHost* new_host) = 0; protected: - NativeWebContentsModalDialogManager() {} + SingleWebContentsDialogManager() {} private: - DISALLOW_COPY_AND_ASSIGN(NativeWebContentsModalDialogManager); + DISALLOW_COPY_AND_ASSIGN(SingleWebContentsDialogManager); }; } // namespace web_modal -#endif // COMPONENTS_WEB_MODAL_NATIVE_WEB_CONTENTS_MODAL_DIALOG_MANAGER_H_ +#endif // COMPONENTS_WEB_MODAL_SINGLE_WEB_CONTENTS_DIALOG_MANAGER_H_ diff --git a/components/web_modal/web_contents_modal_dialog_manager.cc b/components/web_modal/web_contents_modal_dialog_manager.cc index dfd7bad..99fd4e4 100644 --- a/components/web_modal/web_contents_modal_dialog_manager.cc +++ b/components/web_modal/web_contents_modal_dialog_manager.cc @@ -33,18 +33,17 @@ void WebContentsModalDialogManager::SetDelegate( } } -// TODO(gbillock): Rename to ShowWebModalDialog() -void WebContentsModalDialogManager::ShowDialog( +void WebContentsModalDialogManager::ShowModalDialog( NativeWebContentsModalDialog dialog) { - scoped_ptr<NativeWebContentsModalDialogManager> mgr( - CreateNativeManager(this)); + scoped_ptr<SingleWebContentsDialogManager> mgr( + CreateNativeWebModalManager(this)); ShowDialogWithManager(dialog, mgr.Pass()); } // TODO(gbillock): Maybe "ShowBubbleWithManager"? void WebContentsModalDialogManager::ShowDialogWithManager( NativeWebContentsModalDialog dialog, - scoped_ptr<NativeWebContentsModalDialogManager> manager) { + scoped_ptr<SingleWebContentsDialogManager> manager) { if (delegate_) manager->HostChanged(delegate_->GetWebContentsModalDialogHost()); child_dialogs_.push_back(new DialogState(dialog, manager.Pass())); @@ -108,7 +107,7 @@ WebContentsModalDialogManager::WebContentsModalDialogManager( WebContentsModalDialogManager::DialogState::DialogState( NativeWebContentsModalDialog dialog, - scoped_ptr<NativeWebContentsModalDialogManager> mgr) + scoped_ptr<SingleWebContentsDialogManager> mgr) : dialog(dialog), manager(mgr.release()), #if defined(USE_AURA) diff --git a/components/web_modal/web_contents_modal_dialog_manager.h b/components/web_modal/web_contents_modal_dialog_manager.h index a1d8c3c..72ae4bb 100644 --- a/components/web_modal/web_contents_modal_dialog_manager.h +++ b/components/web_modal/web_contents_modal_dialog_manager.h @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -8,7 +8,7 @@ #include <deque> #include "base/memory/scoped_ptr.h" -#include "components/web_modal/native_web_contents_modal_dialog_manager.h" +#include "components/web_modal/single_web_contents_dialog_manager.h" #include "content/public/browser/web_contents_observer.h" #include "content/public/browser/web_contents_user_data.h" #include "ui/gfx/native_widget_types.h" @@ -19,7 +19,7 @@ class WebContentsModalDialogManagerDelegate; // Per-WebContents class to manage WebContents-modal dialogs. class WebContentsModalDialogManager - : public NativeWebContentsModalDialogManagerDelegate, + : public SingleWebContentsDialogManagerDelegate, public content::WebContentsObserver, public content::WebContentsUserData<WebContentsModalDialogManager> { public: @@ -28,19 +28,18 @@ class WebContentsModalDialogManager WebContentsModalDialogManagerDelegate* delegate() const { return delegate_; } void SetDelegate(WebContentsModalDialogManagerDelegate* d); - // TODO(gbillock): Rename to CreateNativeWebModalManager(). - static NativeWebContentsModalDialogManager* CreateNativeManager( - NativeWebContentsModalDialogManagerDelegate* native_delegate); + static SingleWebContentsDialogManager* CreateNativeWebModalManager( + SingleWebContentsDialogManagerDelegate* native_delegate); // Shows the dialog as a web contents modal dialog. The dialog will notify via // WillClose() when it is being destroyed. - void ShowDialog(NativeWebContentsModalDialog dialog); + void ShowModalDialog(NativeWebContentsModalDialog dialog); // Allow clients to supply their own native dialog manager. Suitable for // bubble clients. void ShowDialogWithManager( NativeWebContentsModalDialog dialog, - scoped_ptr<NativeWebContentsModalDialogManager> manager); + scoped_ptr<SingleWebContentsDialogManager> manager); // Returns true if any dialogs are active and not closed. bool IsDialogActive() const; @@ -53,7 +52,7 @@ class WebContentsModalDialogManager void SetCloseOnInterstitialPage(NativeWebContentsModalDialog dialog, bool close); - // Overriden from NativeWebContentsModalDialogManagerDelegate: + // Overriden from SingleWebContentsDialogManagerDelegate: virtual content::WebContents* GetWebContents() const OVERRIDE; // Called when a WebContentsModalDialogs we own is about to be closed. virtual void WillClose(NativeWebContentsModalDialog dialog) OVERRIDE; @@ -81,11 +80,11 @@ class WebContentsModalDialogManager struct DialogState { DialogState(NativeWebContentsModalDialog dialog, - scoped_ptr<NativeWebContentsModalDialogManager> manager); + scoped_ptr<SingleWebContentsDialogManager> manager); ~DialogState(); NativeWebContentsModalDialog dialog; - scoped_ptr<NativeWebContentsModalDialogManager> manager; + scoped_ptr<SingleWebContentsDialogManager> manager; bool close_on_interstitial_webui; }; diff --git a/components/web_modal/web_contents_modal_dialog_manager_unittest.cc b/components/web_modal/web_contents_modal_dialog_manager_unittest.cc index dc848eb..7497455 100644 --- a/components/web_modal/web_contents_modal_dialog_manager_unittest.cc +++ b/components/web_modal/web_contents_modal_dialog_manager_unittest.cc @@ -7,7 +7,7 @@ #include <map> #include "base/memory/scoped_ptr.h" -#include "components/web_modal/native_web_contents_modal_dialog_manager.h" +#include "components/web_modal/single_web_contents_dialog_manager.h" #include "components/web_modal/test_web_contents_modal_dialog_manager_delegate.h" #include "content/public/test/test_renderer_host.h" #include "testing/gtest/include/gtest/gtest.h" @@ -40,10 +40,10 @@ class NativeManagerTracker { NativeManagerTracker unused_tracker; class TestNativeWebContentsModalDialogManager - : public NativeWebContentsModalDialogManager { + : public SingleWebContentsDialogManager { public: TestNativeWebContentsModalDialogManager( - NativeWebContentsModalDialogManagerDelegate* delegate, + SingleWebContentsDialogManagerDelegate* delegate, NativeManagerTracker* tracker) : delegate_(delegate), tracker_(tracker) {} @@ -77,7 +77,7 @@ class TestNativeWebContentsModalDialogManager } private: - NativeWebContentsModalDialogManagerDelegate* delegate_; + SingleWebContentsDialogManagerDelegate* delegate_; NativeManagerTracker* tracker_; DISALLOW_COPY_AND_ASSIGN(TestNativeWebContentsModalDialogManager); @@ -122,9 +122,9 @@ class WebContentsModalDialogManagerTest DISALLOW_COPY_AND_ASSIGN(WebContentsModalDialogManagerTest); }; -NativeWebContentsModalDialogManager* -WebContentsModalDialogManager::CreateNativeManager( - NativeWebContentsModalDialogManagerDelegate* native_delegate) { +SingleWebContentsDialogManager* +WebContentsModalDialogManager::CreateNativeWebModalManager( + SingleWebContentsDialogManagerDelegate* native_delegate) { NOTREACHED(); return new TestNativeWebContentsModalDialogManager(native_delegate, &unused_tracker); @@ -140,7 +140,7 @@ TEST_F(WebContentsModalDialogManagerTest, WebContentsVisible) { TestNativeWebContentsModalDialogManager* native_manager = new TestNativeWebContentsModalDialogManager(manager, &tracker); manager->ShowDialogWithManager(dialog, - scoped_ptr<NativeWebContentsModalDialogManager>(native_manager).Pass()); + scoped_ptr<SingleWebContentsDialogManager>(native_manager).Pass()); EXPECT_EQ(NativeManagerTracker::SHOWN, tracker.state_); EXPECT_TRUE(manager->IsDialogActive()); @@ -162,7 +162,7 @@ TEST_F(WebContentsModalDialogManagerTest, WebContentsNotVisible) { TestNativeWebContentsModalDialogManager* native_manager = new TestNativeWebContentsModalDialogManager(manager, &tracker); manager->ShowDialogWithManager(dialog, - scoped_ptr<NativeWebContentsModalDialogManager>(native_manager).Pass()); + scoped_ptr<SingleWebContentsDialogManager>(native_manager).Pass()); EXPECT_EQ(NativeManagerTracker::NOT_SHOWN, tracker.state_); EXPECT_TRUE(manager->IsDialogActive()); @@ -188,11 +188,11 @@ TEST_F(WebContentsModalDialogManagerTest, ShowDialogs) { TestNativeWebContentsModalDialogManager* native_manager3 = new TestNativeWebContentsModalDialogManager(manager, &tracker3); manager->ShowDialogWithManager(dialog1, - scoped_ptr<NativeWebContentsModalDialogManager>(native_manager1).Pass()); + scoped_ptr<SingleWebContentsDialogManager>(native_manager1).Pass()); manager->ShowDialogWithManager(dialog2, - scoped_ptr<NativeWebContentsModalDialogManager>(native_manager2).Pass()); + scoped_ptr<SingleWebContentsDialogManager>(native_manager2).Pass()); manager->ShowDialogWithManager(dialog3, - scoped_ptr<NativeWebContentsModalDialogManager>(native_manager3).Pass()); + scoped_ptr<SingleWebContentsDialogManager>(native_manager3).Pass()); EXPECT_TRUE(delegate->web_contents_blocked()); EXPECT_EQ(NativeManagerTracker::SHOWN, tracker1.state_); @@ -212,7 +212,7 @@ TEST_F(WebContentsModalDialogManagerTest, VisibilityObservation) { TestNativeWebContentsModalDialogManager* native_manager = new TestNativeWebContentsModalDialogManager(manager, &tracker); manager->ShowDialogWithManager(dialog, - scoped_ptr<NativeWebContentsModalDialogManager>(native_manager).Pass()); + scoped_ptr<SingleWebContentsDialogManager>(native_manager).Pass()); EXPECT_TRUE(manager->IsDialogActive()); EXPECT_TRUE(delegate->web_contents_blocked()); @@ -249,11 +249,11 @@ TEST_F(WebContentsModalDialogManagerTest, InterstitialPage) { TestNativeWebContentsModalDialogManager* native_manager3 = new TestNativeWebContentsModalDialogManager(manager, &tracker3); manager->ShowDialogWithManager(dialog1, - scoped_ptr<NativeWebContentsModalDialogManager>(native_manager1).Pass()); + scoped_ptr<SingleWebContentsDialogManager>(native_manager1).Pass()); manager->ShowDialogWithManager(dialog2, - scoped_ptr<NativeWebContentsModalDialogManager>(native_manager2).Pass()); + scoped_ptr<SingleWebContentsDialogManager>(native_manager2).Pass()); manager->ShowDialogWithManager(dialog3, - scoped_ptr<NativeWebContentsModalDialogManager>(native_manager3).Pass()); + scoped_ptr<SingleWebContentsDialogManager>(native_manager3).Pass()); #if defined(OS_WIN) || defined(USE_AURA) manager->SetCloseOnInterstitialPage(dialog2, false); @@ -299,13 +299,13 @@ TEST_F(WebContentsModalDialogManagerTest, CloseDialogs) { TestNativeWebContentsModalDialogManager* native_manager4 = new TestNativeWebContentsModalDialogManager(manager, &tracker4); manager->ShowDialogWithManager(dialog1, - scoped_ptr<NativeWebContentsModalDialogManager>(native_manager1).Pass()); + scoped_ptr<SingleWebContentsDialogManager>(native_manager1).Pass()); manager->ShowDialogWithManager(dialog2, - scoped_ptr<NativeWebContentsModalDialogManager>(native_manager2).Pass()); + scoped_ptr<SingleWebContentsDialogManager>(native_manager2).Pass()); manager->ShowDialogWithManager(dialog3, - scoped_ptr<NativeWebContentsModalDialogManager>(native_manager3).Pass()); + scoped_ptr<SingleWebContentsDialogManager>(native_manager3).Pass()); manager->ShowDialogWithManager(dialog4, - scoped_ptr<NativeWebContentsModalDialogManager>(native_manager4).Pass()); + scoped_ptr<SingleWebContentsDialogManager>(native_manager4).Pass()); native_manager1->CloseDialog(dialog1); @@ -359,7 +359,7 @@ TEST_F(WebContentsModalDialogManagerTest, CloseAllDialogs) { native_managers[i] = new TestNativeWebContentsModalDialogManager(manager, &(trackers[i])); manager->ShowDialogWithManager(MakeFakeDialog(), - scoped_ptr<NativeWebContentsModalDialogManager>( + scoped_ptr<SingleWebContentsDialogManager>( native_managers[i]).Pass()); } |