0

Componentize SimpleAlertInfoBarDelegate

Move SimpleAlertInfoBarDelegate into //components/infobar/core since it
only depends on //base and //components/infobar/core and we want to
share the code with iOS.

BUG=438238
TBR=bauerb@chromium.org
TBR=felt@chromium.org
TBR=dtseng@chromium.org

Review URL: https://codereview.chromium.org/824033002

Cr-Commit-Position: refs/heads/master@{#309734}
This commit is contained in:
sdefresne
2014-12-29 16:21:47 -08:00
committed by Commit bot
parent c9c0300cbb
commit b49f5514bd
12 changed files with 29 additions and 24 deletions

@@ -6,10 +6,10 @@
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "chrome/browser/extensions/extension_apitest.h" #include "chrome/browser/extensions/extension_apitest.h"
#include "chrome/browser/infobars/infobar_service.h" #include "chrome/browser/infobars/infobar_service.h"
#include "chrome/browser/infobars/simple_alert_infobar_delegate.h"
#include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/test/base/test_switches.h" #include "chrome/test/base/test_switches.h"
#include "components/infobars/core/simple_alert_infobar_delegate.h"
#include "extensions/common/switches.h" #include "extensions/common/switches.h"
// Times out on win syzyasan, http://crbug.com/166026 // Times out on win syzyasan, http://crbug.com/166026

@@ -12,7 +12,6 @@
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process.h"
#include "chrome/browser/infobars/infobar_service.h" #include "chrome/browser/infobars/infobar_service.h"
#include "chrome/browser/infobars/simple_alert_infobar_delegate.h"
#include "chrome/browser/lifetime/application_lifetime.h" #include "chrome/browser/lifetime/application_lifetime.h"
#include "chrome/browser/metrics/metrics_services_manager.h" #include "chrome/browser/metrics/metrics_services_manager.h"
#include "chrome/browser/plugins/plugin_finder.h" #include "chrome/browser/plugins/plugin_finder.h"
@@ -25,6 +24,7 @@
#include "components/content_settings/core/browser/host_content_settings_map.h" #include "components/content_settings/core/browser/host_content_settings_map.h"
#include "components/infobars/core/confirm_infobar_delegate.h" #include "components/infobars/core/confirm_infobar_delegate.h"
#include "components/infobars/core/infobar.h" #include "components/infobars/core/infobar.h"
#include "components/infobars/core/simple_alert_infobar_delegate.h"
#include "content/public/browser/plugin_service.h" #include "content/public/browser/plugin_service.h"
#include "content/public/browser/render_frame_host.h" #include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_view_host.h" #include "content/public/browser/render_view_host.h"

@@ -9,10 +9,10 @@
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "chrome/browser/certificate_viewer.h" #include "chrome/browser/certificate_viewer.h"
#include "chrome/browser/infobars/infobar_service.h" #include "chrome/browser/infobars/infobar_service.h"
#include "chrome/browser/infobars/simple_alert_infobar_delegate.h"
#include "chrome/grit/generated_resources.h" #include "chrome/grit/generated_resources.h"
#include "components/infobars/core/confirm_infobar_delegate.h" #include "components/infobars/core/confirm_infobar_delegate.h"
#include "components/infobars/core/infobar.h" #include "components/infobars/core/infobar.h"
#include "components/infobars/core/simple_alert_infobar_delegate.h"
#include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_thread.h"
#include "content/public/browser/render_frame_host.h" #include "content/public/browser/render_frame_host.h"
#include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents.h"

@@ -60,7 +60,6 @@
#include "chrome/browser/first_run/first_run.h" #include "chrome/browser/first_run/first_run.h"
#include "chrome/browser/history/top_sites.h" #include "chrome/browser/history/top_sites.h"
#include "chrome/browser/infobars/infobar_service.h" #include "chrome/browser/infobars/infobar_service.h"
#include "chrome/browser/infobars/simple_alert_infobar_delegate.h"
#include "chrome/browser/lifetime/application_lifetime.h" #include "chrome/browser/lifetime/application_lifetime.h"
#include "chrome/browser/notifications/notification_ui_manager.h" #include "chrome/browser/notifications/notification_ui_manager.h"
#include "chrome/browser/pepper_broker_infobar_delegate.h" #include "chrome/browser/pepper_broker_infobar_delegate.h"
@@ -154,6 +153,7 @@
#include "components/bookmarks/browser/bookmark_utils.h" #include "components/bookmarks/browser/bookmark_utils.h"
#include "components/content_settings/core/browser/host_content_settings_map.h" #include "components/content_settings/core/browser/host_content_settings_map.h"
#include "components/google/core/browser/google_url_tracker.h" #include "components/google/core/browser/google_url_tracker.h"
#include "components/infobars/core/simple_alert_infobar_delegate.h"
#include "components/search/search.h" #include "components/search/search.h"
#include "components/sessions/session_types.h" #include "components/sessions/session_types.h"
#include "components/startup_metric_utils/startup_metric_utils.h" #include "components/startup_metric_utils/startup_metric_utils.h"

@@ -10,9 +10,9 @@
#include "base/prefs/pref_service.h" #include "base/prefs/pref_service.h"
#include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process.h"
#include "chrome/browser/infobars/infobar_service.h" #include "chrome/browser/infobars/infobar_service.h"
#include "chrome/browser/infobars/simple_alert_infobar_delegate.h"
#include "chrome/common/pref_names.h" #include "chrome/common/pref_names.h"
#include "chrome/grit/generated_resources.h" #include "chrome/grit/generated_resources.h"
#include "components/infobars/core/simple_alert_infobar_delegate.h"
#include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util.h"
ChromeSelectFilePolicy::ChromeSelectFilePolicy( ChromeSelectFilePolicy::ChromeSelectFilePolicy(

@@ -12,7 +12,6 @@
#include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process.h"
#include "chrome/browser/devtools/devtools_window_testing.h" #include "chrome/browser/devtools/devtools_window_testing.h"
#include "chrome/browser/infobars/infobar_service.h" #include "chrome/browser/infobars/infobar_service.h"
#include "chrome/browser/infobars/simple_alert_infobar_delegate.h"
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/bookmarks/bookmark_utils.h" #include "chrome/browser/ui/bookmarks/bookmark_utils.h"
@@ -38,6 +37,7 @@
#include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/testing_profile.h" #include "chrome/test/base/testing_profile.h"
#include "components/infobars/core/simple_alert_infobar_delegate.h"
#include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents.h"
#include "content/public/test/test_utils.h" #include "content/public/test/test_utils.h"
#import "testing/gtest_mac.h" #import "testing/gtest_mac.h"

@@ -8,7 +8,6 @@
#include "base/files/file_path.h" #include "base/files/file_path.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "chrome/browser/infobars/infobar_service.h" #include "chrome/browser/infobars/infobar_service.h"
#include "chrome/browser/infobars/simple_alert_infobar_delegate.h"
#include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/simple_message_box.h" #include "chrome/browser/ui/simple_message_box.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/browser/ui/tabs/tab_strip_model.h"
@@ -17,6 +16,7 @@
#include "chrome/common/switch_utils.h" #include "chrome/common/switch_utils.h"
#include "chrome/grit/chromium_strings.h" #include "chrome/grit/chromium_strings.h"
#include "chrome/grit/generated_resources.h" #include "chrome/grit/generated_resources.h"
#include "components/infobars/core/simple_alert_infobar_delegate.h"
#include "components/invalidation/invalidation_switches.h" #include "components/invalidation/invalidation_switches.h"
#include "components/nacl/common/nacl_switches.h" #include "components/nacl/common/nacl_switches.h"
#include "components/startup_metric_utils/startup_metric_utils.h" #include "components/startup_metric_utils/startup_metric_utils.h"

@@ -391,8 +391,6 @@
'browser/infobars/infobar_service.h', 'browser/infobars/infobar_service.h',
'browser/infobars/insecure_content_infobar_delegate.cc', 'browser/infobars/insecure_content_infobar_delegate.cc',
'browser/infobars/insecure_content_infobar_delegate.h', 'browser/infobars/insecure_content_infobar_delegate.h',
'browser/infobars/simple_alert_infobar_delegate.cc',
'browser/infobars/simple_alert_infobar_delegate.h',
'browser/install_verification/win/imported_module_verification.cc', 'browser/install_verification/win/imported_module_verification.cc',
'browser/install_verification/win/imported_module_verification.h', 'browser/install_verification/win/imported_module_verification.h',
'browser/install_verification/win/install_verification.cc', 'browser/install_verification/win/install_verification.cc',

@@ -35,6 +35,8 @@
'infobars/core/infobar_manager.h', 'infobars/core/infobar_manager.h',
'infobars/core/infobars_switches.cc', 'infobars/core/infobars_switches.cc',
'infobars/core/infobars_switches.h', 'infobars/core/infobars_switches.h',
'infobars/core/simple_alert_infobar_delegate.cc',
'infobars/core/simple_alert_infobar_delegate.h',
], ],
}, },
], ],

@@ -16,6 +16,8 @@ static_library("core") {
"infobar_manager.h", "infobar_manager.h",
"infobars_switches.cc", "infobars_switches.cc",
"infobars_switches.h", "infobars_switches.h",
"simple_alert_infobar_delegate.cc",
"simple_alert_infobar_delegate.h",
] ]
public_deps = [ public_deps = [

@@ -2,19 +2,20 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "chrome/browser/infobars/simple_alert_infobar_delegate.h" #include "components/infobars/core/simple_alert_infobar_delegate.h"
#include "chrome/browser/infobars/infobar_service.h"
#include "components/infobars/core/infobar.h" #include "components/infobars/core/infobar.h"
#include "components/infobars/core/infobar_manager.h"
#include "third_party/skia/include/core/SkBitmap.h" #include "third_party/skia/include/core/SkBitmap.h"
// static // static
void SimpleAlertInfoBarDelegate::Create(InfoBarService* infobar_service, void SimpleAlertInfoBarDelegate::Create(
int icon_id, infobars::InfoBarManager* infobar_manager,
const base::string16& message, int icon_id,
bool auto_expire) { const base::string16& message,
infobar_service->AddInfoBar( bool auto_expire) {
infobar_service->CreateConfirmInfoBar(scoped_ptr<ConfirmInfoBarDelegate>( infobar_manager->AddInfoBar(
infobar_manager->CreateConfirmInfoBar(scoped_ptr<ConfirmInfoBarDelegate>(
new SimpleAlertInfoBarDelegate(icon_id, message, auto_expire)))); new SimpleAlertInfoBarDelegate(icon_id, message, auto_expire))));
} }

@@ -2,22 +2,24 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef CHROME_BROWSER_INFOBARS_SIMPLE_ALERT_INFOBAR_DELEGATE_H_ #ifndef COMPONENTS_INFOBARS_CORE_SIMPLE_ALERT_INFOBAR_DELEGATE_H_
#define CHROME_BROWSER_INFOBARS_SIMPLE_ALERT_INFOBAR_DELEGATE_H_ #define COMPONENTS_INFOBARS_CORE_SIMPLE_ALERT_INFOBAR_DELEGATE_H_
#include "base/basictypes.h" #include "base/basictypes.h"
#include "base/compiler_specific.h" #include "base/compiler_specific.h"
#include "base/strings/string16.h" #include "base/strings/string16.h"
#include "components/infobars/core/confirm_infobar_delegate.h" #include "components/infobars/core/confirm_infobar_delegate.h"
class InfoBarService; namespace infobars {
class InfoBarManager;
}
class SimpleAlertInfoBarDelegate : public ConfirmInfoBarDelegate { class SimpleAlertInfoBarDelegate : public ConfirmInfoBarDelegate {
public: public:
// Creates a simple alert infobar and delegate and adds the infobar to // Creates a simple alert infobar and delegate and adds the infobar to
// |infobar_service|. // |infobar_manager|. |icon_id| may be kNoIconID if no icon is shown.
static void Create(InfoBarService* infobar_service, static void Create(infobars::InfoBarManager* infobar_manager,
int icon_id, // May be |kNoIconID| if no icon is shown. int icon_id,
const base::string16& message, const base::string16& message,
bool auto_expire); bool auto_expire);
@@ -40,4 +42,4 @@ class SimpleAlertInfoBarDelegate : public ConfirmInfoBarDelegate {
DISALLOW_COPY_AND_ASSIGN(SimpleAlertInfoBarDelegate); DISALLOW_COPY_AND_ASSIGN(SimpleAlertInfoBarDelegate);
}; };
#endif // CHROME_BROWSER_INFOBARS_SIMPLE_ALERT_INFOBAR_DELEGATE_H_ #endif // COMPONENTS_INFOBARS_CORE_SIMPLE_ALERT_INFOBAR_DELEGATE_H_