diff --git a/athena/main/athena_main.gyp b/athena/main/athena_main.gyp index a14df3701f536f..710c5b9d5777f0 100644 --- a/athena/main/athena_main.gyp +++ b/athena/main/athena_main.gyp @@ -16,10 +16,6 @@ '../resources/athena_resources.gyp:athena_resources', '../../components/components.gyp:component_metrics_proto', '../../components/components.gyp:history_core_browser', - # infobars_test_support is required to declare some symbols used in the - # search_engines and its dependencies. See crbug.com/386171 - # TODO(mukai): declare those symbols for Athena. - '../../components/components.gyp:infobars_test_support', '../../components/components.gyp:omnibox', '../../components/components.gyp:pdf_renderer', '../../components/components.gyp:search_engines', diff --git a/chrome/browser/autofill/autofill_cc_infobar_delegate.cc b/chrome/browser/autofill/autofill_cc_infobar_delegate.cc index a44a1b3a51eefb..430a79c4ac5b93 100644 --- a/chrome/browser/autofill/autofill_cc_infobar_delegate.cc +++ b/chrome/browser/autofill/autofill_cc_infobar_delegate.cc @@ -26,7 +26,7 @@ void AutofillCCInfoBarDelegate::Create( InfoBarService* infobar_service, const base::Closure& save_card_callback) { infobar_service->AddInfoBar( - ConfirmInfoBarDelegate::CreateInfoBar(scoped_ptr( + infobar_service->CreateConfirmInfoBar(scoped_ptr( new AutofillCCInfoBarDelegate(save_card_callback)))); } diff --git a/chrome/browser/chrome_quota_permission_context.cc b/chrome/browser/chrome_quota_permission_context.cc index d853affbb25bf9..69fef1ff663439 100644 --- a/chrome/browser/chrome_quota_permission_context.cc +++ b/chrome/browser/chrome_quota_permission_context.cc @@ -188,7 +188,7 @@ void RequestQuotaInfoBarDelegate::Create( int64 requested_quota, const std::string& display_languages, const content::QuotaPermissionContext::PermissionCallback& callback) { - infobar_service->AddInfoBar(ConfirmInfoBarDelegate::CreateInfoBar( + infobar_service->AddInfoBar(infobar_service->CreateConfirmInfoBar( scoped_ptr(new RequestQuotaInfoBarDelegate( context, origin_url, requested_quota, display_languages, callback)))); } diff --git a/chrome/browser/custom_handlers/register_protocol_handler_infobar_delegate.cc b/chrome/browser/custom_handlers/register_protocol_handler_infobar_delegate.cc index 6e063325239494..e25ba6b8e5059e 100644 --- a/chrome/browser/custom_handlers/register_protocol_handler_infobar_delegate.cc +++ b/chrome/browser/custom_handlers/register_protocol_handler_infobar_delegate.cc @@ -24,7 +24,7 @@ void RegisterProtocolHandlerInfoBarDelegate::Create( base::UserMetricsAction("RegisterProtocolHandler.InfoBar_Shown")); scoped_ptr infobar( - ConfirmInfoBarDelegate::CreateInfoBar(scoped_ptr( + infobar_service->CreateConfirmInfoBar(scoped_ptr( new RegisterProtocolHandlerInfoBarDelegate(registry, handler)))); for (size_t i = 0; i < infobar_service->infobar_count(); ++i) { diff --git a/chrome/browser/devtools/devtools_ui_bindings.cc b/chrome/browser/devtools/devtools_ui_bindings.cc index 3c06f94976c1c2..94de94888870af 100644 --- a/chrome/browser/devtools/devtools_ui_bindings.cc +++ b/chrome/browser/devtools/devtools_ui_bindings.cc @@ -145,8 +145,8 @@ void DevToolsConfirmInfoBarDelegate::Create( return; } - infobar_service->AddInfoBar(ConfirmInfoBarDelegate::CreateInfoBar( - scoped_ptr( + infobar_service->AddInfoBar( + infobar_service->CreateConfirmInfoBar(scoped_ptr( new DevToolsConfirmInfoBarDelegate(callback, message)))); } diff --git a/chrome/browser/download/download_request_infobar_delegate.cc b/chrome/browser/download/download_request_infobar_delegate.cc index 85cf2e15396568..d2d79548c46ba2 100644 --- a/chrome/browser/download/download_request_infobar_delegate.cc +++ b/chrome/browser/download/download_request_infobar_delegate.cc @@ -36,7 +36,7 @@ void DownloadRequestInfoBarDelegate::Create( // "downloads" permission) to automatically download >1 files. host->Cancel(); } else { - infobar_service->AddInfoBar(ConfirmInfoBarDelegate::CreateInfoBar( + infobar_service->AddInfoBar(infobar_service->CreateConfirmInfoBar( scoped_ptr( new DownloadRequestInfoBarDelegate(host)))); } diff --git a/chrome/browser/extensions/api/cryptotoken_private/cryptotoken_private_api.cc b/chrome/browser/extensions/api/cryptotoken_private/cryptotoken_private_api.cc index 6c475e4cf828b5..2fa0086c1abd51 100644 --- a/chrome/browser/extensions/api/cryptotoken_private/cryptotoken_private_api.cc +++ b/chrome/browser/extensions/api/cryptotoken_private/cryptotoken_private_api.cc @@ -31,7 +31,7 @@ class CryptotokenPermissionInfoBarDelegate : public ConfirmInfoBarDelegate { static void Create(InfoBarService* infobar_service, const base::string16& message, const InfoBarCallback& callback) { - infobar_service->AddInfoBar(ConfirmInfoBarDelegate::CreateInfoBar( + infobar_service->AddInfoBar(infobar_service->CreateConfirmInfoBar( scoped_ptr( new CryptotokenPermissionInfoBarDelegate(message, callback)))); } diff --git a/chrome/browser/extensions/api/debugger/debugger_api.cc b/chrome/browser/extensions/api/debugger/debugger_api.cc index dfd2ff8b9cbb99..811d5ddbfb5879 100644 --- a/chrome/browser/extensions/api/debugger/debugger_api.cc +++ b/chrome/browser/extensions/api/debugger/debugger_api.cc @@ -195,8 +195,8 @@ infobars::InfoBar* ExtensionDevToolsInfoBarDelegate::Create( if (!infobar_service) return NULL; - return infobar_service->AddInfoBar(ConfirmInfoBarDelegate::CreateInfoBar( - scoped_ptr( + return infobar_service->AddInfoBar( + infobar_service->CreateConfirmInfoBar(scoped_ptr( new ExtensionDevToolsInfoBarDelegate(client_name)))); } diff --git a/chrome/browser/extensions/api/messaging/incognito_connectability.cc b/chrome/browser/extensions/api/messaging/incognito_connectability.cc index 177ba48c623e61..5c56a7567458aa 100644 --- a/chrome/browser/extensions/api/messaging/incognito_connectability.cc +++ b/chrome/browser/extensions/api/messaging/incognito_connectability.cc @@ -38,7 +38,7 @@ class IncognitoConnectabilityInfoBarDelegate : public ConfirmInfoBarDelegate { static InfoBar* Create(InfoBarManager* infobar_manager, const base::string16& message, const InfoBarCallback& callback) { - return infobar_manager->AddInfoBar(ConfirmInfoBarDelegate::CreateInfoBar( + return infobar_manager->AddInfoBar(infobar_manager->CreateConfirmInfoBar( scoped_ptr( new IncognitoConnectabilityInfoBarDelegate(message, callback)))); } diff --git a/chrome/browser/extensions/theme_installed_infobar_delegate.cc b/chrome/browser/extensions/theme_installed_infobar_delegate.cc index 2536f53034d39f..7731563438de64 100644 --- a/chrome/browser/extensions/theme_installed_infobar_delegate.cc +++ b/chrome/browser/extensions/theme_installed_infobar_delegate.cc @@ -50,11 +50,11 @@ void ThemeInstalledInfoBarDelegate::Create( InfoBarService::FromWebContents(web_contents); ThemeService* theme_service = ThemeServiceFactory::GetForProfile(profile); scoped_ptr new_infobar( - ConfirmInfoBarDelegate::CreateInfoBar(scoped_ptr( - new ThemeInstalledInfoBarDelegate( + infobar_service->CreateConfirmInfoBar( + scoped_ptr(new ThemeInstalledInfoBarDelegate( extensions::ExtensionSystem::Get(profile)->extension_service(), - theme_service, new_theme, - previous_theme_id, previous_using_system_theme)))); + theme_service, new_theme, previous_theme_id, + previous_using_system_theme)))); // If there's a previous theme infobar, just replace that instead of adding a // new one. diff --git a/chrome/browser/geolocation/geolocation_infobar_delegate.cc b/chrome/browser/geolocation/geolocation_infobar_delegate.cc index 8de4df8fc82312..b69acf0cab7d70 100644 --- a/chrome/browser/geolocation/geolocation_infobar_delegate.cc +++ b/chrome/browser/geolocation/geolocation_infobar_delegate.cc @@ -35,9 +35,8 @@ infobars::InfoBar* GeolocationInfoBarDelegate::Create( committed_entry ? committed_entry->GetUniqueID() : 0, display_languages); - infobars::InfoBar* infobar = ConfirmInfoBarDelegate::CreateInfoBar( - scoped_ptr(delegate)).release(); - return infobar_service->AddInfoBar(scoped_ptr(infobar)); + return infobar_service->AddInfoBar(infobar_service->CreateConfirmInfoBar( + scoped_ptr(delegate))); } GeolocationInfoBarDelegate::GeolocationInfoBarDelegate( diff --git a/chrome/browser/gpu/three_d_api_observer.cc b/chrome/browser/gpu/three_d_api_observer.cc index d2f8d8e61211ac..7396f8571bc5cd 100644 --- a/chrome/browser/gpu/three_d_api_observer.cc +++ b/chrome/browser/gpu/three_d_api_observer.cc @@ -63,8 +63,8 @@ void ThreeDAPIInfoBarDelegate::Create(InfoBarService* infobar_service, content::ThreeDAPIType requester) { if (!infobar_service) return; // NULL for apps. - infobar_service->AddInfoBar(ConfirmInfoBarDelegate::CreateInfoBar( - scoped_ptr( + infobar_service->AddInfoBar( + infobar_service->CreateConfirmInfoBar(scoped_ptr( new ThreeDAPIInfoBarDelegate(url, requester)))); } diff --git a/chrome/browser/infobars/infobar_service.cc b/chrome/browser/infobars/infobar_service.cc index 5037cc8fc008ef..3e80ac9317158c 100644 --- a/chrome/browser/infobars/infobar_service.cc +++ b/chrome/browser/infobars/infobar_service.cc @@ -95,6 +95,9 @@ void InfoBarService::NotifyInfoBarRemoved(InfoBar* infobar, bool animate) { content::Details(&removed_details)); } +// InfoBarService::CreateConfirmInfoBar() is implemented in platform-specific +// files. + void InfoBarService::RenderProcessGone(base::TerminationStatus status) { RemoveAllInfoBars(true); } diff --git a/chrome/browser/infobars/infobar_service.h b/chrome/browser/infobars/infobar_service.h index 985b7c0a4dbc1d..19d5ec2cd6b9b6 100644 --- a/chrome/browser/infobars/infobar_service.h +++ b/chrome/browser/infobars/infobar_service.h @@ -45,6 +45,12 @@ class InfoBarService : public infobars::InfoBarManager, // changes. void set_ignore_next_reload() { ignore_next_reload_ = true; } + // InfoBarManager: + // TODO(sdefresne): Change clients to invoke this on infobars::InfoBarManager + // and turn the method override private. + scoped_ptr CreateConfirmInfoBar( + scoped_ptr delegate) override; + private: friend class content::WebContentsUserData; diff --git a/chrome/browser/infobars/insecure_content_infobar_delegate.cc b/chrome/browser/infobars/insecure_content_infobar_delegate.cc index fa90ef46100e0f..f95bd136df18a3 100644 --- a/chrome/browser/infobars/insecure_content_infobar_delegate.cc +++ b/chrome/browser/infobars/insecure_content_infobar_delegate.cc @@ -22,7 +22,7 @@ void InsecureContentInfoBarDelegate::Create(InfoBarService* infobar_service, InfoBarType type) { scoped_ptr new_infobar( - ConfirmInfoBarDelegate::CreateInfoBar(scoped_ptr( + infobar_service->CreateConfirmInfoBar(scoped_ptr( new InsecureContentInfoBarDelegate(type)))); // Only supsersede an existing insecure content infobar if we are upgrading diff --git a/chrome/browser/infobars/simple_alert_infobar_delegate.cc b/chrome/browser/infobars/simple_alert_infobar_delegate.cc index fa15f3644ea6a5..02b71b0c49cfb6 100644 --- a/chrome/browser/infobars/simple_alert_infobar_delegate.cc +++ b/chrome/browser/infobars/simple_alert_infobar_delegate.cc @@ -13,8 +13,8 @@ void SimpleAlertInfoBarDelegate::Create(InfoBarService* infobar_service, int icon_id, const base::string16& message, bool auto_expire) { - infobar_service->AddInfoBar(ConfirmInfoBarDelegate::CreateInfoBar( - scoped_ptr( + infobar_service->AddInfoBar( + infobar_service->CreateConfirmInfoBar(scoped_ptr( new SimpleAlertInfoBarDelegate(icon_id, message, auto_expire)))); } diff --git a/chrome/browser/media/media_stream_infobar_delegate.cc b/chrome/browser/media/media_stream_infobar_delegate.cc index 860b2dcb21ba2b..7db4ea4bcca23f 100644 --- a/chrome/browser/media/media_stream_infobar_delegate.cc +++ b/chrome/browser/media/media_stream_infobar_delegate.cc @@ -53,7 +53,7 @@ bool MediaStreamInfoBarDelegate::Create( } scoped_ptr infobar( - ConfirmInfoBarDelegate::CreateInfoBar(scoped_ptr( + infobar_service->CreateConfirmInfoBar(scoped_ptr( new MediaStreamInfoBarDelegate(controller.Pass())))); for (size_t i = 0; i < infobar_service->infobar_count(); ++i) { infobars::InfoBar* old_infobar = infobar_service->infobar_at(i); diff --git a/chrome/browser/media/midi_permission_infobar_delegate.cc b/chrome/browser/media/midi_permission_infobar_delegate.cc index eb1019a60d6049..a90cdf6ffe82ca 100644 --- a/chrome/browser/media/midi_permission_infobar_delegate.cc +++ b/chrome/browser/media/midi_permission_infobar_delegate.cc @@ -26,7 +26,7 @@ infobars::InfoBar* MidiPermissionInfoBarDelegate::Create( ContentSettingsType type) { const content::NavigationEntry* committed_entry = infobar_service->web_contents()->GetController().GetLastCommittedEntry(); - return infobar_service->AddInfoBar(ConfirmInfoBarDelegate::CreateInfoBar( + return infobar_service->AddInfoBar(infobar_service->CreateConfirmInfoBar( scoped_ptr(new MidiPermissionInfoBarDelegate( controller, id, requesting_frame, committed_entry ? committed_entry->GetUniqueID() : 0, diff --git a/chrome/browser/media/protected_media_identifier_infobar_delegate.cc b/chrome/browser/media/protected_media_identifier_infobar_delegate.cc index b3b6db36d901d1..de5f74343855d5 100644 --- a/chrome/browser/media/protected_media_identifier_infobar_delegate.cc +++ b/chrome/browser/media/protected_media_identifier_infobar_delegate.cc @@ -26,8 +26,8 @@ infobars::InfoBar* ProtectedMediaIdentifierInfoBarDelegate::Create( const std::string& display_languages) { const content::NavigationEntry* committed_entry = infobar_service->web_contents()->GetController().GetLastCommittedEntry(); - return infobar_service->AddInfoBar(ConfirmInfoBarDelegate::CreateInfoBar( - scoped_ptr( + return infobar_service->AddInfoBar( + infobar_service->CreateConfirmInfoBar(scoped_ptr( new ProtectedMediaIdentifierInfoBarDelegate( controller, id, requesting_frame, committed_entry ? committed_entry->GetUniqueID() : 0, diff --git a/chrome/browser/nacl_host/nacl_infobar_delegate.cc b/chrome/browser/nacl_host/nacl_infobar_delegate.cc index 2836dd3ef62aa9..c7047e23c60205 100644 --- a/chrome/browser/nacl_host/nacl_infobar_delegate.cc +++ b/chrome/browser/nacl_host/nacl_infobar_delegate.cc @@ -27,7 +27,7 @@ void NaClInfoBarDelegate::Create(int render_process_id, int render_view_id) { InfoBarService* infobar_service = InfoBarService::FromWebContents(web_contents); if (infobar_service) { - infobar_service->AddInfoBar(ConfirmInfoBarDelegate::CreateInfoBar( + infobar_service->AddInfoBar(infobar_service->CreateConfirmInfoBar( scoped_ptr(new NaClInfoBarDelegate()))); } } diff --git a/chrome/browser/net/spdyproxy/data_reduction_proxy_infobar_delegate.cc b/chrome/browser/net/spdyproxy/data_reduction_proxy_infobar_delegate.cc index beae67f65e81b5..86e0309d8e196f 100644 --- a/chrome/browser/net/spdyproxy/data_reduction_proxy_infobar_delegate.cc +++ b/chrome/browser/net/spdyproxy/data_reduction_proxy_infobar_delegate.cc @@ -16,8 +16,11 @@ // static void DataReductionProxyInfoBarDelegate::Create( content::WebContents* web_contents, const std::string& link_url) { - InfoBarService::FromWebContents(web_contents)->AddInfoBar( + InfoBarService* infobar_service = + InfoBarService::FromWebContents(web_contents); + infobar_service->AddInfoBar( DataReductionProxyInfoBarDelegate::CreateInfoBar( + infobar_service, scoped_ptr( new DataReductionProxyInfoBarDelegate(link_url)))); } @@ -27,8 +30,9 @@ void DataReductionProxyInfoBarDelegate::Create( // static scoped_ptr DataReductionProxyInfoBarDelegate::CreateInfoBar( + infobars::InfoBarManager* infobar_manager, scoped_ptr delegate) { - return ConfirmInfoBarDelegate::CreateInfoBar(delegate.Pass()); + return infobar_manager->CreateConfirmInfoBar(delegate.Pass()); } #endif diff --git a/chrome/browser/net/spdyproxy/data_reduction_proxy_infobar_delegate.h b/chrome/browser/net/spdyproxy/data_reduction_proxy_infobar_delegate.h index 85516b9f75f1ad..4a5698be51e0b7 100644 --- a/chrome/browser/net/spdyproxy/data_reduction_proxy_infobar_delegate.h +++ b/chrome/browser/net/spdyproxy/data_reduction_proxy_infobar_delegate.h @@ -14,6 +14,10 @@ namespace content { class WebContents; } +namespace infobars { +class InfoBarManager; +} + // Configures an InfoBar with no buttons that stays visible until it is // explicitly dismissed. This InfoBar is suitable for displaying a message // and a link, and is used only by an Android field trial. @@ -30,6 +34,7 @@ class DataReductionProxyInfoBarDelegate : public ConfirmInfoBarDelegate { // Returns a Data Reduction Proxy infobar that owns |delegate|. static scoped_ptr CreateInfoBar( + infobars::InfoBarManager* infobar_manager, scoped_ptr delegate); // ConfirmInfoBarDelegate diff --git a/chrome/browser/notifications/desktop_notification_infobar_delegate.cc b/chrome/browser/notifications/desktop_notification_infobar_delegate.cc index c68fe286ed1b91..eb34214e61a1b2 100644 --- a/chrome/browser/notifications/desktop_notification_infobar_delegate.cc +++ b/chrome/browser/notifications/desktop_notification_infobar_delegate.cc @@ -26,7 +26,7 @@ infobars::InfoBar* DesktopNotificationInfoBarDelegate::Create( const std::string& display_languages) { const content::NavigationEntry* committed_entry = infobar_service->web_contents()->GetController().GetLastCommittedEntry(); - return infobar_service->AddInfoBar(ConfirmInfoBarDelegate::CreateInfoBar( + return infobar_service->AddInfoBar(infobar_service->CreateConfirmInfoBar( scoped_ptr(new DesktopNotificationInfoBarDelegate( controller, id, requesting_frame, committed_entry ? committed_entry->GetUniqueID() : 0, diff --git a/chrome/browser/password_manager/save_password_infobar_delegate.cc b/chrome/browser/password_manager/save_password_infobar_delegate.cc index 93d79a9e4748e2..09f925d6d12a00 100644 --- a/chrome/browser/password_manager/save_password_infobar_delegate.cc +++ b/chrome/browser/password_manager/save_password_infobar_delegate.cc @@ -46,10 +46,11 @@ void SavePasswordInfoBarDelegate::Create( return; #endif - InfoBarService::FromWebContents(web_contents)->AddInfoBar( - ConfirmInfoBarDelegate::CreateInfoBar(scoped_ptr( - new SavePasswordInfoBarDelegate(form_to_save.Pass(), - uma_histogram_suffix)))); + InfoBarService* infobar_service = + InfoBarService::FromWebContents(web_contents); + infobar_service->AddInfoBar(infobar_service->CreateConfirmInfoBar( + scoped_ptr(new SavePasswordInfoBarDelegate( + form_to_save.Pass(), uma_histogram_suffix)))); } SavePasswordInfoBarDelegate::~SavePasswordInfoBarDelegate() { diff --git a/chrome/browser/pepper_broker_infobar_delegate.cc b/chrome/browser/pepper_broker_infobar_delegate.cc index 4a77180c99ad21..ca7a597103cfff 100644 --- a/chrome/browser/pepper_broker_infobar_delegate.cc +++ b/chrome/browser/pepper_broker_infobar_delegate.cc @@ -55,7 +55,7 @@ void PepperBrokerInfoBarDelegate::Create( base::UserMetricsAction("PPAPI.BrokerInfobarDisplayed")); InfoBarService* infobar_service = InfoBarService::FromWebContents(web_contents); - infobar_service->AddInfoBar(ConfirmInfoBarDelegate::CreateInfoBar( + infobar_service->AddInfoBar(infobar_service->CreateConfirmInfoBar( scoped_ptr(new PepperBrokerInfoBarDelegate( url, plugin_path, profile->GetPrefs()->GetString(prefs::kAcceptLanguages), diff --git a/chrome/browser/plugins/plugin_infobar_delegates.cc b/chrome/browser/plugins/plugin_infobar_delegates.cc index 789b278c1cc323..ead6040bed8f8b 100644 --- a/chrome/browser/plugins/plugin_infobar_delegates.cc +++ b/chrome/browser/plugins/plugin_infobar_delegates.cc @@ -91,9 +91,10 @@ void OutdatedPluginInfoBarDelegate::Create( // Copy the name out of |plugin_metadata| now, since the Pass() call below // will make it impossible to get at. base::string16 name(plugin_metadata->name()); - infobar_service->AddInfoBar(ConfirmInfoBarDelegate::CreateInfoBar( + infobar_service->AddInfoBar(infobar_service->CreateConfirmInfoBar( scoped_ptr(new OutdatedPluginInfoBarDelegate( - installer, plugin_metadata.Pass(), l10n_util::GetStringFUTF16( + installer, plugin_metadata.Pass(), + l10n_util::GetStringFUTF16( (installer->state() == PluginInstaller::INSTALLER_STATE_IDLE) ? IDS_PLUGIN_OUTDATED_PROMPT : IDS_PLUGIN_DOWNLOADING, name))))); @@ -232,13 +233,13 @@ void PluginInstallerInfoBarDelegate::Create( return; } #endif - infobar_service->AddInfoBar(ConfirmInfoBarDelegate::CreateInfoBar( + infobar_service->AddInfoBar(infobar_service->CreateConfirmInfoBar( scoped_ptr(new PluginInstallerInfoBarDelegate( installer, plugin_metadata.Pass(), callback, true, l10n_util::GetStringFUTF16( - (installer->state() == PluginInstaller::INSTALLER_STATE_IDLE) ? - IDS_PLUGININSTALLER_INSTALLPLUGIN_PROMPT : - IDS_PLUGIN_DOWNLOADING, + (installer->state() == PluginInstaller::INSTALLER_STATE_IDLE) + ? IDS_PLUGININSTALLER_INSTALLPLUGIN_PROMPT + : IDS_PLUGIN_DOWNLOADING, name))))); } @@ -249,9 +250,10 @@ void PluginInstallerInfoBarDelegate::Replace( bool new_install, const base::string16& message) { DCHECK(infobar->owner()); - infobar->owner()->ReplaceInfoBar(infobar, - ConfirmInfoBarDelegate::CreateInfoBar(scoped_ptr( - new PluginInstallerInfoBarDelegate( + infobar->owner()->ReplaceInfoBar( + infobar, + infobar->owner()->CreateConfirmInfoBar( + scoped_ptr(new PluginInstallerInfoBarDelegate( installer, plugin_metadata.Pass(), PluginInstallerInfoBarDelegate::InstallCallback(), new_install, message)))); @@ -365,8 +367,8 @@ void PluginMetroModeInfoBarDelegate::Create( InfoBarService* infobar_service, PluginMetroModeInfoBarDelegate::Mode mode, const base::string16& name) { - infobar_service->AddInfoBar(ConfirmInfoBarDelegate::CreateInfoBar( - scoped_ptr( + infobar_service->AddInfoBar( + infobar_service->CreateConfirmInfoBar(scoped_ptr( new PluginMetroModeInfoBarDelegate(mode, name)))); } diff --git a/chrome/browser/plugins/plugin_observer.cc b/chrome/browser/plugins/plugin_observer.cc index 69c5a46e3d9cdb..fd6a8f5fcaa30c 100644 --- a/chrome/browser/plugins/plugin_observer.cc +++ b/chrome/browser/plugins/plugin_observer.cc @@ -150,7 +150,7 @@ void ReloadPluginInfoBarDelegate::Create( content::NavigationController* controller, const base::string16& message) { infobar_service->AddInfoBar( - ConfirmInfoBarDelegate::CreateInfoBar(scoped_ptr( + infobar_service->CreateConfirmInfoBar(scoped_ptr( new ReloadPluginInfoBarDelegate(controller, message)))); } diff --git a/chrome/browser/ssl/ssl_add_certificate.cc b/chrome/browser/ssl/ssl_add_certificate.cc index bac7ee566de6b3..404416d0ceac8f 100644 --- a/chrome/browser/ssl/ssl_add_certificate.cc +++ b/chrome/browser/ssl/ssl_add_certificate.cc @@ -35,7 +35,7 @@ class SSLAddCertificateInfoBarDelegate : public ConfirmInfoBarDelegate { // Creates an SSL certificate enrollment result infobar and delegate. static void Create(InfoBarService* infobar_service, net::X509Certificate* cert) { - infobar_service->AddInfoBar(ConfirmInfoBarDelegate::CreateInfoBar( + infobar_service->AddInfoBar(infobar_service->CreateConfirmInfoBar( scoped_ptr( new SSLAddCertificateInfoBarDelegate(cert)))); } diff --git a/chrome/browser/supervised_user/supervised_user_navigation_observer.cc b/chrome/browser/supervised_user/supervised_user_navigation_observer.cc index 5287940a0f73fe..163081e4204fcd 100644 --- a/chrome/browser/supervised_user/supervised_user_navigation_observer.cc +++ b/chrome/browser/supervised_user/supervised_user_navigation_observer.cc @@ -100,8 +100,8 @@ class SupervisedUserWarningInfoBarDelegate : public ConfirmInfoBarDelegate { // static infobars::InfoBar* SupervisedUserWarningInfoBarDelegate::Create( InfoBarService* infobar_service) { - return infobar_service->AddInfoBar(ConfirmInfoBarDelegate::CreateInfoBar( - scoped_ptr( + return infobar_service->AddInfoBar( + infobar_service->CreateConfirmInfoBar(scoped_ptr( new SupervisedUserWarningInfoBarDelegate()))); } diff --git a/chrome/browser/ui/android/content_settings/popup_blocked_infobar_delegate.cc b/chrome/browser/ui/android/content_settings/popup_blocked_infobar_delegate.cc index ad395cef32b824..e3686d7dc383bc 100644 --- a/chrome/browser/ui/android/content_settings/popup_blocked_infobar_delegate.cc +++ b/chrome/browser/ui/android/content_settings/popup_blocked_infobar_delegate.cc @@ -23,12 +23,12 @@ void PopupBlockedInfoBarDelegate::Create(content::WebContents* web_contents, const GURL& url = web_contents->GetURL(); Profile* profile = Profile::FromBrowserContext(web_contents->GetBrowserContext()); - scoped_ptr infobar(ConfirmInfoBarDelegate::CreateInfoBar( + InfoBarService* infobar_service = + InfoBarService::FromWebContents(web_contents); + scoped_ptr infobar(infobar_service->CreateConfirmInfoBar( scoped_ptr(new PopupBlockedInfoBarDelegate( num_popups, url, profile->GetHostContentSettingsMap())))); - InfoBarService* infobar_service = - InfoBarService::FromWebContents(web_contents); // See if there is an existing popup infobar already. // TODO(dfalcantara) When triggering more than one popup the infobar // will be shown once, then hide then be shown again. diff --git a/chrome/browser/ui/android/infobars/confirm_infobar.cc b/chrome/browser/ui/android/infobars/confirm_infobar.cc index 5db7823287c796..8c7b3bc8747e0c 100644 --- a/chrome/browser/ui/android/infobars/confirm_infobar.cc +++ b/chrome/browser/ui/android/infobars/confirm_infobar.cc @@ -8,14 +8,13 @@ #include "base/android/jni_string.h" #include "base/logging.h" #include "chrome/browser/android/resource_mapper.h" +#include "chrome/browser/infobars/infobar_service.h" #include "components/infobars/core/confirm_infobar_delegate.h" #include "jni/ConfirmInfoBarDelegate_jni.h" +// InfoBarService ------------------------------------------------------------- -// ConfirmInfoBarDelegate ----------------------------------------------------- - -// static -scoped_ptr ConfirmInfoBarDelegate::CreateInfoBar( +scoped_ptr InfoBarService::CreateConfirmInfoBar( scoped_ptr delegate) { return make_scoped_ptr(new ConfirmInfoBar(delegate.Pass())); } diff --git a/chrome/browser/ui/android/infobars/data_reduction_proxy_infobar.cc b/chrome/browser/ui/android/infobars/data_reduction_proxy_infobar.cc index 4389c92ddf851d..57e295e769813a 100644 --- a/chrome/browser/ui/android/infobars/data_reduction_proxy_infobar.cc +++ b/chrome/browser/ui/android/infobars/data_reduction_proxy_infobar.cc @@ -58,6 +58,7 @@ DataReductionProxyInfoBarDelegate* DataReductionProxyInfoBar::GetDelegate() { // static scoped_ptr DataReductionProxyInfoBarDelegate::CreateInfoBar( + infobars::InfoBarManager* infobar_manager, scoped_ptr delegate) { return scoped_ptr( new DataReductionProxyInfoBar(delegate.Pass())); diff --git a/chrome/browser/ui/auto_login_infobar_delegate.cc b/chrome/browser/ui/auto_login_infobar_delegate.cc index 15e12c8797b476..c4e20c0f1f8081 100644 --- a/chrome/browser/ui/auto_login_infobar_delegate.cc +++ b/chrome/browser/ui/auto_login_infobar_delegate.cc @@ -136,7 +136,7 @@ bool AutoLoginInfoBarDelegate::Create(content::WebContents* web_contents, Profile* profile = Profile::FromBrowserContext(web_contents->GetBrowserContext()); typedef AutoLoginInfoBarDelegate Delegate; - return !!infobar_service->AddInfoBar(ConfirmInfoBarDelegate::CreateInfoBar( + return !!infobar_service->AddInfoBar(infobar_service->CreateConfirmInfoBar( scoped_ptr(new Delegate(params, profile)))); } diff --git a/chrome/browser/ui/cocoa/infobars/confirm_infobar_controller.mm b/chrome/browser/ui/cocoa/infobars/confirm_infobar_controller.mm index b541175fe139d5..6affa4e9005b42 100644 --- a/chrome/browser/ui/cocoa/infobars/confirm_infobar_controller.mm +++ b/chrome/browser/ui/cocoa/infobars/confirm_infobar_controller.mm @@ -6,6 +6,7 @@ #include "base/logging.h" #include "base/strings/sys_string_conversions.h" +#include "chrome/browser/infobars/infobar_service.h" #include "chrome/browser/ui/cocoa/infobars/infobar_cocoa.h" #include "components/infobars/core/confirm_infobar_delegate.h" #include "third_party/google_toolbox_for_mac/src/AppKit/GTMUILocalizerAndLayoutTweaker.h" @@ -137,8 +138,7 @@ - (void)linkClicked { @end -// static -scoped_ptr ConfirmInfoBarDelegate::CreateInfoBar( +scoped_ptr InfoBarService::CreateConfirmInfoBar( scoped_ptr delegate) { scoped_ptr infobar(new InfoBarCocoa(delegate.Pass())); base::scoped_nsobject controller( diff --git a/chrome/browser/ui/cocoa/keystone_infobar_delegate.mm b/chrome/browser/ui/cocoa/keystone_infobar_delegate.mm index afe31435e8d0aa..93864c0e0734d2 100644 --- a/chrome/browser/ui/cocoa/keystone_infobar_delegate.mm +++ b/chrome/browser/ui/cocoa/keystone_infobar_delegate.mm @@ -81,7 +81,7 @@ return; InfoBarService* infobar_service = InfoBarService::FromWebContents(webContents); - infobar_service->AddInfoBar(ConfirmInfoBarDelegate::CreateInfoBar( + infobar_service->AddInfoBar(infobar_service->CreateConfirmInfoBar( scoped_ptr(new KeystonePromotionInfoBarDelegate( Profile::FromBrowserContext( webContents->GetBrowserContext())->GetPrefs())))); diff --git a/chrome/browser/ui/collected_cookies_infobar_delegate.cc b/chrome/browser/ui/collected_cookies_infobar_delegate.cc index d1c817434274de..6aed4d5396f79a 100644 --- a/chrome/browser/ui/collected_cookies_infobar_delegate.cc +++ b/chrome/browser/ui/collected_cookies_infobar_delegate.cc @@ -15,8 +15,8 @@ // static void CollectedCookiesInfoBarDelegate::Create(InfoBarService* infobar_service) { - infobar_service->AddInfoBar(ConfirmInfoBarDelegate::CreateInfoBar( - scoped_ptr( + infobar_service->AddInfoBar( + infobar_service->CreateConfirmInfoBar(scoped_ptr( new CollectedCookiesInfoBarDelegate()))); } diff --git a/chrome/browser/ui/extensions/extension_install_ui_default.cc b/chrome/browser/ui/extensions/extension_install_ui_default.cc index fca3f02c3530a2..febe8c0fd6cb3d 100644 --- a/chrome/browser/ui/extensions/extension_install_ui_default.cc +++ b/chrome/browser/ui/extensions/extension_install_ui_default.cc @@ -96,7 +96,7 @@ class ErrorInfoBarDelegate : public ConfirmInfoBarDelegate { // static void ErrorInfoBarDelegate::Create(InfoBarService* infobar_service, const extensions::CrxInstallerError& error) { - infobar_service->AddInfoBar(ConfirmInfoBarDelegate::CreateInfoBar( + infobar_service->AddInfoBar(infobar_service->CreateConfirmInfoBar( scoped_ptr(new ErrorInfoBarDelegate(error)))); } diff --git a/chrome/browser/ui/hung_plugin_tab_helper.cc b/chrome/browser/ui/hung_plugin_tab_helper.cc index 1b6d092ea1ee7b..bb9a21c55d3cfe 100644 --- a/chrome/browser/ui/hung_plugin_tab_helper.cc +++ b/chrome/browser/ui/hung_plugin_tab_helper.cc @@ -162,7 +162,7 @@ infobars::InfoBar* HungPluginInfoBarDelegate::Create( HungPluginTabHelper* helper, int plugin_child_id, const base::string16& plugin_name) { - return infobar_service->AddInfoBar(ConfirmInfoBarDelegate::CreateInfoBar( + return infobar_service->AddInfoBar(infobar_service->CreateConfirmInfoBar( scoped_ptr(new HungPluginInfoBarDelegate( helper, plugin_child_id, plugin_name)))); } diff --git a/chrome/browser/ui/startup/autolaunch_prompt_win.cc b/chrome/browser/ui/startup/autolaunch_prompt_win.cc index dc73b29ed2e82b..01e0401aca0468 100644 --- a/chrome/browser/ui/startup/autolaunch_prompt_win.cc +++ b/chrome/browser/ui/startup/autolaunch_prompt_win.cc @@ -70,8 +70,8 @@ class AutolaunchInfoBarDelegate : public ConfirmInfoBarDelegate { // static void AutolaunchInfoBarDelegate::Create(InfoBarService* infobar_service, Profile* profile) { - infobar_service->AddInfoBar(ConfirmInfoBarDelegate::CreateInfoBar( - scoped_ptr( + infobar_service->AddInfoBar( + infobar_service->CreateConfirmInfoBar(scoped_ptr( new AutolaunchInfoBarDelegate(profile)))); } diff --git a/chrome/browser/ui/startup/default_browser_prompt.cc b/chrome/browser/ui/startup/default_browser_prompt.cc index 139ab9fba1158b..fcd0798c6fa1c2 100644 --- a/chrome/browser/ui/startup/default_browser_prompt.cc +++ b/chrome/browser/ui/startup/default_browser_prompt.cc @@ -104,7 +104,7 @@ class DefaultBrowserInfoBarDelegate : public ConfirmInfoBarDelegate { void DefaultBrowserInfoBarDelegate::Create(InfoBarService* infobar_service, PrefService* prefs, bool interactive_flow_required) { - infobar_service->AddInfoBar(ConfirmInfoBarDelegate::CreateInfoBar( + infobar_service->AddInfoBar(infobar_service->CreateConfirmInfoBar( scoped_ptr(new DefaultBrowserInfoBarDelegate( prefs, interactive_flow_required)))); } diff --git a/chrome/browser/ui/startup/google_api_keys_infobar_delegate.cc b/chrome/browser/ui/startup/google_api_keys_infobar_delegate.cc index edea11a79cd9ee..58bc710c380399 100644 --- a/chrome/browser/ui/startup/google_api_keys_infobar_delegate.cc +++ b/chrome/browser/ui/startup/google_api_keys_infobar_delegate.cc @@ -18,7 +18,7 @@ void GoogleApiKeysInfoBarDelegate::Create(InfoBarService* infobar_service) { if (google_apis::HasKeysConfigured()) return; - infobar_service->AddInfoBar(ConfirmInfoBarDelegate::CreateInfoBar( + infobar_service->AddInfoBar(infobar_service->CreateConfirmInfoBar( scoped_ptr(new GoogleApiKeysInfoBarDelegate()))); } diff --git a/chrome/browser/ui/startup/obsolete_system_infobar_delegate.cc b/chrome/browser/ui/startup/obsolete_system_infobar_delegate.cc index d10f849f143cef..5b762fcc79f9b8 100644 --- a/chrome/browser/ui/startup/obsolete_system_infobar_delegate.cc +++ b/chrome/browser/ui/startup/obsolete_system_infobar_delegate.cc @@ -23,7 +23,7 @@ void ObsoleteSystemInfoBarDelegate::Create(InfoBarService* infobar_service) { !ObsoleteSystemMac::Has32BitOnlyCPU()) { return; } - infobar_service->AddInfoBar(ConfirmInfoBarDelegate::CreateInfoBar( + infobar_service->AddInfoBar(infobar_service->CreateConfirmInfoBar( scoped_ptr(new ObsoleteSystemInfoBarDelegate()))); #else // No other platforms currently show this infobar. diff --git a/chrome/browser/ui/startup/session_crashed_infobar_delegate.cc b/chrome/browser/ui/startup/session_crashed_infobar_delegate.cc index 4f074a8fe0e2d5..b68ba8efe9947a 100644 --- a/chrome/browser/ui/startup/session_crashed_infobar_delegate.cc +++ b/chrome/browser/ui/startup/session_crashed_infobar_delegate.cc @@ -33,8 +33,10 @@ void SessionCrashedInfoBarDelegate::Create(Browser* browser) { if (profile->IsOffTheRecord() || !web_contents) return; - InfoBarService::FromWebContents(web_contents)->AddInfoBar( - ConfirmInfoBarDelegate::CreateInfoBar(scoped_ptr( + InfoBarService* infobar_service = + InfoBarService::FromWebContents(web_contents); + infobar_service->AddInfoBar( + infobar_service->CreateConfirmInfoBar(scoped_ptr( new SessionCrashedInfoBarDelegate(profile)))); } diff --git a/chrome/browser/ui/views/infobars/confirm_infobar.cc b/chrome/browser/ui/views/infobars/confirm_infobar.cc index 6e78968936834a..b1770353c9d3c2 100644 --- a/chrome/browser/ui/views/infobars/confirm_infobar.cc +++ b/chrome/browser/ui/views/infobars/confirm_infobar.cc @@ -5,6 +5,7 @@ #include "chrome/browser/ui/views/infobars/confirm_infobar.h" #include "base/logging.h" +#include "chrome/browser/infobars/infobar_service.h" #include "chrome/browser/ui/views/elevation_icon_setter.h" #include "components/infobars/core/confirm_infobar_delegate.h" #include "ui/base/window_open_disposition.h" @@ -12,11 +13,9 @@ #include "ui/views/controls/label.h" #include "ui/views/controls/link.h" +// InfoBarService ------------------------------------------------------------- -// ConfirmInfoBarDelegate ----------------------------------------------------- - -// static -scoped_ptr ConfirmInfoBarDelegate::CreateInfoBar( +scoped_ptr InfoBarService::CreateConfirmInfoBar( scoped_ptr delegate) { return make_scoped_ptr(new ConfirmInfoBar(delegate.Pass())); } diff --git a/chrome/browser/ui/website_settings/website_settings_infobar_delegate.cc b/chrome/browser/ui/website_settings/website_settings_infobar_delegate.cc index 8afa92865a6a72..76c60a48796d5b 100644 --- a/chrome/browser/ui/website_settings/website_settings_infobar_delegate.cc +++ b/chrome/browser/ui/website_settings/website_settings_infobar_delegate.cc @@ -16,8 +16,8 @@ // static void WebsiteSettingsInfoBarDelegate::Create(InfoBarService* infobar_service) { - infobar_service->AddInfoBar(ConfirmInfoBarDelegate::CreateInfoBar( - scoped_ptr( + infobar_service->AddInfoBar( + infobar_service->CreateConfirmInfoBar(scoped_ptr( new WebsiteSettingsInfoBarDelegate()))); } diff --git a/components/BUILD.gn b/components/BUILD.gn index 5e0a01cefbdf78..3933e3993ff547 100644 --- a/components/BUILD.gn +++ b/components/BUILD.gn @@ -45,7 +45,6 @@ group("all_components") { "//components/history/core/common", "//components/history/core/test", "//components/infobars/core", - "//components/infobars/test:test_support", "//components/invalidation", "//components/json_schema", "//components/keyed_service/content", @@ -162,7 +161,6 @@ group("all_components") { "//components/history/core/common", # Should work, needs checking. "//components/history/core/test", # Should work, needs checking. "//components/infobars/core", # Should work, needs checking. - "//components/infobars/test:test_support", # Should work, needs checking. "//components/invalidation", # Should work, needs checking. "//components/json_schema", # Should work, needs checking. "//components/keyed_service/content", # Blocked on content. diff --git a/components/components_tests.gyp b/components/components_tests.gyp index 29a0665ed8019a..93922384a194be 100644 --- a/components/components_tests.gyp +++ b/components/components_tests.gyp @@ -383,9 +383,6 @@ 'components.gyp:history_core_browser', 'components.gyp:history_core_common', - # Dependencies of infobar - 'components.gyp:infobars_test_support', - # Dependencies of invalidation 'components.gyp:invalidation', 'components.gyp:invalidation_test_support', diff --git a/components/google/core/browser/BUILD.gn b/components/google/core/browser/BUILD.gn index dcb6c60b115e64..3935fdbfff235e 100644 --- a/components/google/core/browser/BUILD.gn +++ b/components/google/core/browser/BUILD.gn @@ -56,7 +56,6 @@ source_set("unit_tests") { "//base:prefs", "//base:prefs_test_support", "//components/infobars/core", - "//components/infobars/test:test_support", "//net:test_support", "//testing/gtest", ] diff --git a/components/google/core/browser/DEPS b/components/google/core/browser/DEPS index 91670bd90cd1c0..4059989e2bae7c 100644 --- a/components/google/core/browser/DEPS +++ b/components/google/core/browser/DEPS @@ -1,4 +1,5 @@ include_rules = [ "+components/infobars/core", + "+components/infobars/test", "+components/keyed_service/core", ] diff --git a/components/google/core/browser/google_url_tracker_infobar_delegate.cc b/components/google/core/browser/google_url_tracker_infobar_delegate.cc index c37000286a24c4..be8f4b1fa482c0 100644 --- a/components/google/core/browser/google_url_tracker_infobar_delegate.cc +++ b/components/google/core/browser/google_url_tracker_infobar_delegate.cc @@ -18,7 +18,7 @@ infobars::InfoBar* GoogleURLTrackerInfoBarDelegate::Create( infobars::InfoBarManager* infobar_manager, GoogleURLTracker* google_url_tracker, const GURL& search_url) { - return infobar_manager->AddInfoBar(ConfirmInfoBarDelegate::CreateInfoBar( + return infobar_manager->AddInfoBar(infobar_manager->CreateConfirmInfoBar( scoped_ptr(new GoogleURLTrackerInfoBarDelegate( google_url_tracker, search_url)))); } diff --git a/components/google/core/browser/google_url_tracker_unittest.cc b/components/google/core/browser/google_url_tracker_unittest.cc index 675fc3deaa6739..184468a7977ae1 100644 --- a/components/google/core/browser/google_url_tracker_unittest.cc +++ b/components/google/core/browser/google_url_tracker_unittest.cc @@ -16,6 +16,7 @@ #include "components/google/core/browser/google_url_tracker_client.h" #include "components/google/core/browser/google_url_tracker_infobar_delegate.h" #include "components/google/core/browser/google_url_tracker_navigation_helper.h" +#include "components/infobars/core/confirm_infobar_delegate.h" #include "components/infobars/core/infobar.h" #include "components/infobars/core/infobar_delegate.h" #include "net/url_request/test_url_fetcher_factory.h" @@ -185,6 +186,10 @@ class TestInfoBarManager : public infobars::InfoBarManager { int GetActiveEntryID() override; private: + // infobars::InfoBarManager: + scoped_ptr CreateConfirmInfoBar( + scoped_ptr delegate) override; + int unique_id_; DISALLOW_COPY_AND_ASSIGN(TestInfoBarManager); }; @@ -200,6 +205,11 @@ int TestInfoBarManager::GetActiveEntryID() { return unique_id_; } +scoped_ptr TestInfoBarManager::CreateConfirmInfoBar( + scoped_ptr delegate) { + return make_scoped_ptr(new infobars::InfoBar(delegate.Pass())); +} + } // namespace // GoogleURLTrackerTest ------------------------------------------------------- diff --git a/components/infobars.gypi b/components/infobars.gypi index ad13b70d5a6abb..e2066e1899ea05 100644 --- a/components/infobars.gypi +++ b/components/infobars.gypi @@ -37,21 +37,5 @@ 'infobars/core/infobars_switches.h', ], }, - { - # GN version: //components/infobars/test:test_support - 'target_name': 'infobars_test_support', - 'type': 'static_library', - 'include_dirs': [ - '..', - ], - 'dependencies': [ - '../base/base.gyp:base', - '../skia/skia.gyp:skia', - ], - 'sources': [ - # Note: sources list duplicated in GN build. - 'infobars/test/infobar_test.cc', - ], - }, ], } diff --git a/components/infobars/core/confirm_infobar_delegate.cc b/components/infobars/core/confirm_infobar_delegate.cc index 0c2e59e5ad239d..9c00449a5a22bc 100644 --- a/components/infobars/core/confirm_infobar_delegate.cc +++ b/components/infobars/core/confirm_infobar_delegate.cc @@ -4,6 +4,8 @@ #include "components/infobars/core/confirm_infobar_delegate.h" +#include "base/logging.h" +#include "components/infobars/core/infobar.h" #include "ui/base/l10n/l10n_util.h" #include "ui/strings/grit/ui_strings.h" @@ -57,9 +59,6 @@ bool ConfirmInfoBarDelegate::ShouldExpireInternal( InfoBarDelegate::ShouldExpireInternal(details); } -// ConfirmInfoBarDelegate::CreateInfoBar() is implemented in platform-specific -// files. - bool ConfirmInfoBarDelegate::EqualsDelegate(InfoBarDelegate* delegate) const { ConfirmInfoBarDelegate* confirm_delegate = delegate->AsConfirmInfoBarDelegate(); diff --git a/components/infobars/core/confirm_infobar_delegate.h b/components/infobars/core/confirm_infobar_delegate.h index 1e1930d19d1a74..0f35f8c7dd166d 100644 --- a/components/infobars/core/confirm_infobar_delegate.h +++ b/components/infobars/core/confirm_infobar_delegate.h @@ -8,9 +8,11 @@ #include "base/memory/scoped_ptr.h" #include "base/strings/string16.h" #include "components/infobars/core/infobar_delegate.h" +#include "components/infobars/core/infobar_manager.h" namespace infobars { class InfoBar; +class InfoBarManager; } // An interface derived from InfoBarDelegate implemented by objects wishing to @@ -66,10 +68,6 @@ class ConfirmInfoBarDelegate : public infobars::InfoBarDelegate { protected: ConfirmInfoBarDelegate(); - // Returns a confirm infobar that owns |delegate|. - static scoped_ptr CreateInfoBar( - scoped_ptr delegate); - bool ShouldExpireInternal(const NavigationDetails& details) const override; private: diff --git a/components/infobars/core/infobar_manager.h b/components/infobars/core/infobar_manager.h index 532566ef6621e3..5685a030316e17 100644 --- a/components/infobars/core/infobar_manager.h +++ b/components/infobars/core/infobar_manager.h @@ -11,6 +11,8 @@ #include "base/observer_list.h" #include "components/infobars/core/infobar_delegate.h" +class ConfirmInfoBarDelegate; + namespace content { class WebContents; } @@ -94,6 +96,10 @@ class InfoBarManager { // Returns the active entry ID. virtual int GetActiveEntryID() = 0; + // Returns a confirm infobar that owns |delegate|. + virtual scoped_ptr CreateConfirmInfoBar( + scoped_ptr delegate) = 0; + protected: // Notifies the observer in |observer_list_|. // TODO(droger): Absorb these methods back into their callers once virtual diff --git a/components/infobars/test/BUILD.gn b/components/infobars/test/BUILD.gn deleted file mode 100644 index 637738f9bc915d..00000000000000 --- a/components/infobars/test/BUILD.gn +++ /dev/null @@ -1,17 +0,0 @@ -# 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. - -source_set("test_support") { - testonly = true - - sources = [ - "infobar_test.cc", - ] - - deps = [ - "//base", - "//components/infobars/core", - "//skia", - ] -} diff --git a/components/infobars/test/infobar_test.cc b/components/infobars/test/infobar_test.cc deleted file mode 100644 index 1fef50f35cb62f..00000000000000 --- a/components/infobars/test/infobar_test.cc +++ /dev/null @@ -1,21 +0,0 @@ -// 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. - -#include "base/logging.h" -#include "base/memory/scoped_ptr.h" -#include "components/infobars/core/confirm_infobar_delegate.h" -#include "components/infobars/core/infobar.h" - -// Provides definitions of static variables and functions that are declared in -// the component but defined in the embedder. -// TODO(blundell): The component shouldn't be declaring statics that it's not -// defining; instead, this information should be obtained via a client, -// which can have a test implementation. crbug.com/386171 - -// Some components' unittests exercise code that requires that -// ConfirmInfoBarDelegate::CreateInfoBar() return a non-NULL infobar. -scoped_ptr ConfirmInfoBarDelegate::CreateInfoBar( - scoped_ptr delegate) { - return scoped_ptr(new infobars::InfoBar(delegate.Pass())); -} diff --git a/ios/chrome/browser/infobars/confirm_infobar_delegate.mm b/ios/chrome/browser/infobars/confirm_infobar_delegate.mm deleted file mode 100644 index 47493a06ed802e..00000000000000 --- a/ios/chrome/browser/infobars/confirm_infobar_delegate.mm +++ /dev/null @@ -1,21 +0,0 @@ -// 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. - -#include "components/infobars/core/confirm_infobar_delegate.h" - -#include "base/mac/scoped_nsobject.h" -#include "base/memory/scoped_ptr.h" -#include "ios/chrome/browser/infobars/confirm_infobar_controller.h" -#include "ios/chrome/browser/infobars/infobar.h" - -// This function is defined in the component, but implemented in the embedder. -// static -scoped_ptr ConfirmInfoBarDelegate::CreateInfoBar( - scoped_ptr delegate) { - scoped_ptr infobar(new InfoBarIOS(delegate.Pass())); - base::scoped_nsobject controller( - [[ConfirmInfoBarController alloc] initWithDelegate:infobar.get()]); - infobar->SetController(controller); - return infobar.Pass(); -} diff --git a/ios/chrome/ios_chrome.gyp b/ios/chrome/ios_chrome.gyp index 04c3c2a8b8c5b0..fbdfc03659fbdd 100644 --- a/ios/chrome/ios_chrome.gyp +++ b/ios/chrome/ios_chrome.gyp @@ -37,7 +37,6 @@ 'browser/browser_state/browser_state_otr_helper.h', 'browser/infobars/confirm_infobar_controller.h', 'browser/infobars/confirm_infobar_controller.mm', - 'browser/infobars/confirm_infobar_delegate.mm', 'browser/infobars/infobar.h', 'browser/infobars/infobar.mm', 'browser/infobars/infobar_container_ios.h',