diff options
59 files changed, 121 insertions, 172 deletions
diff --git a/athena/main/athena_main.gyp b/athena/main/athena_main.gyp index a14df37..710c5b9 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 a44a1b3..430a79c 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<ConfirmInfoBarDelegate>( + infobar_service->CreateConfirmInfoBar(scoped_ptr<ConfirmInfoBarDelegate>( new AutofillCCInfoBarDelegate(save_card_callback)))); } diff --git a/chrome/browser/chrome_quota_permission_context.cc b/chrome/browser/chrome_quota_permission_context.cc index d853aff..69fef1f 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<ConfirmInfoBarDelegate>(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 6e06332..e25ba6b 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<infobars::InfoBar> infobar( - ConfirmInfoBarDelegate::CreateInfoBar(scoped_ptr<ConfirmInfoBarDelegate>( + infobar_service->CreateConfirmInfoBar(scoped_ptr<ConfirmInfoBarDelegate>( 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 3c06f94..94de948 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<ConfirmInfoBarDelegate>( + infobar_service->AddInfoBar( + infobar_service->CreateConfirmInfoBar(scoped_ptr<ConfirmInfoBarDelegate>( 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 85cf2e1..d2d7954 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<ConfirmInfoBarDelegate>( 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 6c475e4..2fa0086 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<ConfirmInfoBarDelegate>( 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 dfd2ff8..811d5dd 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<ConfirmInfoBarDelegate>( + return infobar_service->AddInfoBar( + infobar_service->CreateConfirmInfoBar(scoped_ptr<ConfirmInfoBarDelegate>( 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 177ba48..5c56a75 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<ConfirmInfoBarDelegate>( 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 2536f53..7731563 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<infobars::InfoBar> new_infobar( - ConfirmInfoBarDelegate::CreateInfoBar(scoped_ptr<ConfirmInfoBarDelegate>( - new ThemeInstalledInfoBarDelegate( + infobar_service->CreateConfirmInfoBar( + scoped_ptr<ConfirmInfoBarDelegate>(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 8de4df8..b69acf0 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<ConfirmInfoBarDelegate>(delegate)).release(); - return infobar_service->AddInfoBar(scoped_ptr<infobars::InfoBar>(infobar)); + return infobar_service->AddInfoBar(infobar_service->CreateConfirmInfoBar( + scoped_ptr<ConfirmInfoBarDelegate>(delegate))); } GeolocationInfoBarDelegate::GeolocationInfoBarDelegate( diff --git a/chrome/browser/gpu/three_d_api_observer.cc b/chrome/browser/gpu/three_d_api_observer.cc index d2f8d8e..7396f85 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<ConfirmInfoBarDelegate>( + infobar_service->AddInfoBar( + infobar_service->CreateConfirmInfoBar(scoped_ptr<ConfirmInfoBarDelegate>( new ThreeDAPIInfoBarDelegate(url, requester)))); } diff --git a/chrome/browser/infobars/infobar_service.cc b/chrome/browser/infobars/infobar_service.cc index 5037cc8..3e80ac9 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<InfoBar::RemovedDetails>(&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 985b7c0a..19d5ec2 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<infobars::InfoBar> CreateConfirmInfoBar( + scoped_ptr<ConfirmInfoBarDelegate> delegate) override; + private: friend class content::WebContentsUserData<InfoBarService>; diff --git a/chrome/browser/infobars/insecure_content_infobar_delegate.cc b/chrome/browser/infobars/insecure_content_infobar_delegate.cc index fa90ef461..f95bd13 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<infobars::InfoBar> new_infobar( - ConfirmInfoBarDelegate::CreateInfoBar(scoped_ptr<ConfirmInfoBarDelegate>( + infobar_service->CreateConfirmInfoBar(scoped_ptr<ConfirmInfoBarDelegate>( 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 fa15f36..02b71b0 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<ConfirmInfoBarDelegate>( + infobar_service->AddInfoBar( + infobar_service->CreateConfirmInfoBar(scoped_ptr<ConfirmInfoBarDelegate>( 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 860b2dc..7db4ea4 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<infobars::InfoBar> infobar( - ConfirmInfoBarDelegate::CreateInfoBar(scoped_ptr<ConfirmInfoBarDelegate>( + infobar_service->CreateConfirmInfoBar(scoped_ptr<ConfirmInfoBarDelegate>( 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 eb1019a..a90cdf6 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<ConfirmInfoBarDelegate>(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 b3b6db3..de5f743 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<ConfirmInfoBarDelegate>( + return infobar_service->AddInfoBar( + infobar_service->CreateConfirmInfoBar(scoped_ptr<ConfirmInfoBarDelegate>( 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 2836dd3..c7047e2 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<ConfirmInfoBarDelegate>(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 beae67f..86e0309 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<DataReductionProxyInfoBarDelegate>( new DataReductionProxyInfoBarDelegate(link_url)))); } @@ -27,8 +30,9 @@ void DataReductionProxyInfoBarDelegate::Create( // static scoped_ptr<infobars::InfoBar> DataReductionProxyInfoBarDelegate::CreateInfoBar( + infobars::InfoBarManager* infobar_manager, scoped_ptr<DataReductionProxyInfoBarDelegate> 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 85516b9..4a5698b 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<infobars::InfoBar> CreateInfoBar( + infobars::InfoBarManager* infobar_manager, scoped_ptr<DataReductionProxyInfoBarDelegate> delegate); // ConfirmInfoBarDelegate diff --git a/chrome/browser/notifications/desktop_notification_infobar_delegate.cc b/chrome/browser/notifications/desktop_notification_infobar_delegate.cc index c68fe28..eb34214 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<ConfirmInfoBarDelegate>(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 93d79a9..09f925d 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<ConfirmInfoBarDelegate>( - new SavePasswordInfoBarDelegate(form_to_save.Pass(), - uma_histogram_suffix)))); + InfoBarService* infobar_service = + InfoBarService::FromWebContents(web_contents); + infobar_service->AddInfoBar(infobar_service->CreateConfirmInfoBar( + scoped_ptr<ConfirmInfoBarDelegate>(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 4a77180..ca7a597 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<ConfirmInfoBarDelegate>(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 789b278..ead6040 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<ConfirmInfoBarDelegate>(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<ConfirmInfoBarDelegate>(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<ConfirmInfoBarDelegate>( - new PluginInstallerInfoBarDelegate( + infobar->owner()->ReplaceInfoBar( + infobar, + infobar->owner()->CreateConfirmInfoBar( + scoped_ptr<ConfirmInfoBarDelegate>(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<ConfirmInfoBarDelegate>( + infobar_service->AddInfoBar( + infobar_service->CreateConfirmInfoBar(scoped_ptr<ConfirmInfoBarDelegate>( new PluginMetroModeInfoBarDelegate(mode, name)))); } diff --git a/chrome/browser/plugins/plugin_observer.cc b/chrome/browser/plugins/plugin_observer.cc index 69c5a46..fd6a8f5 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<ConfirmInfoBarDelegate>( + infobar_service->CreateConfirmInfoBar(scoped_ptr<ConfirmInfoBarDelegate>( new ReloadPluginInfoBarDelegate(controller, message)))); } diff --git a/chrome/browser/ssl/ssl_add_certificate.cc b/chrome/browser/ssl/ssl_add_certificate.cc index bac7ee5..404416d 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<ConfirmInfoBarDelegate>( 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 5287940..163081e 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<ConfirmInfoBarDelegate>( + return infobar_service->AddInfoBar( + infobar_service->CreateConfirmInfoBar(scoped_ptr<ConfirmInfoBarDelegate>( 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 ad395ce..e3686d7 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<infobars::InfoBar> infobar(ConfirmInfoBarDelegate::CreateInfoBar( + InfoBarService* infobar_service = + InfoBarService::FromWebContents(web_contents); + scoped_ptr<infobars::InfoBar> infobar(infobar_service->CreateConfirmInfoBar( scoped_ptr<ConfirmInfoBarDelegate>(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 5db7823..8c7b3bc 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<infobars::InfoBar> ConfirmInfoBarDelegate::CreateInfoBar( +scoped_ptr<infobars::InfoBar> InfoBarService::CreateConfirmInfoBar( scoped_ptr<ConfirmInfoBarDelegate> 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 4389c92..57e295e 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<infobars::InfoBar> DataReductionProxyInfoBarDelegate::CreateInfoBar( + infobars::InfoBarManager* infobar_manager, scoped_ptr<DataReductionProxyInfoBarDelegate> delegate) { return scoped_ptr<infobars::InfoBar>( 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 15e12c8..c4e20c0 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<ConfirmInfoBarDelegate>(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 b541175..6affa4e 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 @@ @end -// static -scoped_ptr<infobars::InfoBar> ConfirmInfoBarDelegate::CreateInfoBar( +scoped_ptr<infobars::InfoBar> InfoBarService::CreateConfirmInfoBar( scoped_ptr<ConfirmInfoBarDelegate> delegate) { scoped_ptr<InfoBarCocoa> infobar(new InfoBarCocoa(delegate.Pass())); base::scoped_nsobject<ConfirmInfoBarController> controller( diff --git a/chrome/browser/ui/cocoa/keystone_infobar_delegate.mm b/chrome/browser/ui/cocoa/keystone_infobar_delegate.mm index afe3143..93864c0 100644 --- a/chrome/browser/ui/cocoa/keystone_infobar_delegate.mm +++ b/chrome/browser/ui/cocoa/keystone_infobar_delegate.mm @@ -81,7 +81,7 @@ void KeystonePromotionInfoBarDelegate::Create() { return; InfoBarService* infobar_service = InfoBarService::FromWebContents(webContents); - infobar_service->AddInfoBar(ConfirmInfoBarDelegate::CreateInfoBar( + infobar_service->AddInfoBar(infobar_service->CreateConfirmInfoBar( scoped_ptr<ConfirmInfoBarDelegate>(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 d1c8174..6aed4d5 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<ConfirmInfoBarDelegate>( + infobar_service->AddInfoBar( + infobar_service->CreateConfirmInfoBar(scoped_ptr<ConfirmInfoBarDelegate>( 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 fca3f02..febe8c0 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<ConfirmInfoBarDelegate>(new ErrorInfoBarDelegate(error)))); } diff --git a/chrome/browser/ui/hung_plugin_tab_helper.cc b/chrome/browser/ui/hung_plugin_tab_helper.cc index 1b6d092..bb9a21c 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<ConfirmInfoBarDelegate>(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 dc73b29..01e0401 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<ConfirmInfoBarDelegate>( + infobar_service->AddInfoBar( + infobar_service->CreateConfirmInfoBar(scoped_ptr<ConfirmInfoBarDelegate>( new AutolaunchInfoBarDelegate(profile)))); } diff --git a/chrome/browser/ui/startup/default_browser_prompt.cc b/chrome/browser/ui/startup/default_browser_prompt.cc index 139ab9f..fcd0798 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<ConfirmInfoBarDelegate>(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 edea11a..58bc710 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<ConfirmInfoBarDelegate>(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 d10f849..5b762fc 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<ConfirmInfoBarDelegate>(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 4f074a8..b68ba8e 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<ConfirmInfoBarDelegate>( + InfoBarService* infobar_service = + InfoBarService::FromWebContents(web_contents); + infobar_service->AddInfoBar( + infobar_service->CreateConfirmInfoBar(scoped_ptr<ConfirmInfoBarDelegate>( new SessionCrashedInfoBarDelegate(profile)))); } diff --git a/chrome/browser/ui/views/infobars/confirm_infobar.cc b/chrome/browser/ui/views/infobars/confirm_infobar.cc index 6e78968..b177035 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<infobars::InfoBar> ConfirmInfoBarDelegate::CreateInfoBar( +scoped_ptr<infobars::InfoBar> InfoBarService::CreateConfirmInfoBar( scoped_ptr<ConfirmInfoBarDelegate> 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 8afa928..76c60a4 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<ConfirmInfoBarDelegate>( + infobar_service->AddInfoBar( + infobar_service->CreateConfirmInfoBar(scoped_ptr<ConfirmInfoBarDelegate>( new WebsiteSettingsInfoBarDelegate()))); } diff --git a/components/BUILD.gn b/components/BUILD.gn index 5e0a01c..3933e39 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 29a0665..9392238 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 dcb6c60..3935fdb 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 91670bd..4059989 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 c370002..be8f4b1 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<ConfirmInfoBarDelegate>(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 675fc3d..184468a 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<infobars::InfoBar> CreateConfirmInfoBar( + scoped_ptr<ConfirmInfoBarDelegate> delegate) override; + int unique_id_; DISALLOW_COPY_AND_ASSIGN(TestInfoBarManager); }; @@ -200,6 +205,11 @@ int TestInfoBarManager::GetActiveEntryID() { return unique_id_; } +scoped_ptr<infobars::InfoBar> TestInfoBarManager::CreateConfirmInfoBar( + scoped_ptr<ConfirmInfoBarDelegate> delegate) { + return make_scoped_ptr(new infobars::InfoBar(delegate.Pass())); +} + } // namespace // GoogleURLTrackerTest ------------------------------------------------------- diff --git a/components/infobars.gypi b/components/infobars.gypi index ad13b70..e2066e1 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 0c2e59e..9c00449a5 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 1e1930d..0f35f8c 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<infobars::InfoBar> CreateInfoBar( - scoped_ptr<ConfirmInfoBarDelegate> 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 532566e..5685a03 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<infobars::InfoBar> CreateConfirmInfoBar( + scoped_ptr<ConfirmInfoBarDelegate> 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 637738f..0000000 --- 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 1fef50f..0000000 --- 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<infobars::InfoBar> ConfirmInfoBarDelegate::CreateInfoBar( - scoped_ptr<ConfirmInfoBarDelegate> delegate) { - return scoped_ptr<infobars::InfoBar>(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 47493a0..0000000 --- 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<infobars::InfoBar> ConfirmInfoBarDelegate::CreateInfoBar( - scoped_ptr<ConfirmInfoBarDelegate> delegate) { - scoped_ptr<InfoBarIOS> infobar(new InfoBarIOS(delegate.Pass())); - base::scoped_nsobject<ConfirmInfoBarController> 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 04c3c2a..fbdfc03 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', |