Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(188)

Unified Diff: chrome/browser/ui/browser_init.cc

Issue 7810002: Move infobar handling to a tab helper. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: update Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/browser_init.cc
diff --git a/chrome/browser/ui/browser_init.cc b/chrome/browser/ui/browser_init.cc
index 5e9cbc6d8043cfdecc44ed08c519b9767eff4023..1c252b39dd0084f3484b19913a344f20f0fdde4d 100644
--- a/chrome/browser/ui/browser_init.cc
+++ b/chrome/browser/ui/browser_init.cc
@@ -30,6 +30,7 @@
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/pack_extension_job.h"
#include "chrome/browser/first_run/first_run.h"
+#include "chrome/browser/infobars/infobar_tab_helper.h"
#include "chrome/browser/net/predictor_api.h"
#include "chrome/browser/net/url_fixer_upper.h"
#include "chrome/browser/notifications/desktop_notification_service.h"
@@ -258,9 +259,10 @@ void NotifyNotDefaultBrowserTask::Run() {
// In ChromeBot tests, there might be a race. This line appears to get
// called during shutdown and |tab| can be NULL.
TabContentsWrapper* tab = browser->GetSelectedTabContentsWrapper();
- if (!tab || tab->infobar_count() > 0)
+ if (!tab || tab->infobar_tab_helper()->infobar_count() > 0)
return;
- tab->AddInfoBar(new DefaultBrowserInfoBarDelegate(tab->tab_contents()));
+ tab->infobar_tab_helper()->AddInfoBar(
+ new DefaultBrowserInfoBarDelegate(tab->tab_contents()));
}
@@ -1088,7 +1090,7 @@ void BrowserInit::LaunchWithProfile::AddCrashedInfoBarIfNecessary(
// The last session didn't exit cleanly. Show an infobar to the user
// so that they can restore if they want. The delegate deletes itself when
// it is closed.
- tab->AddInfoBar(
+ tab->infobar_tab_helper()->AddInfoBar(
new SessionCrashedInfoBarDelegate(profile_, tab->tab_contents()));
}
}
@@ -1114,10 +1116,13 @@ void BrowserInit::LaunchWithProfile::AddBadFlagsInfoBarIfNecessary(
}
if (bad_flag) {
- tab->AddInfoBar(new SimpleAlertInfoBarDelegate(tab->tab_contents(), NULL,
- l10n_util::GetStringFUTF16(IDS_BAD_FLAGS_WARNING_MESSAGE,
- UTF8ToUTF16(std::string("--") + bad_flag)),
- false));
+ tab->infobar_tab_helper()->AddInfoBar(
+ new SimpleAlertInfoBarDelegate(
+ tab->tab_contents(), NULL,
+ l10n_util::GetStringFUTF16(
+ IDS_BAD_FLAGS_WARNING_MESSAGE,
+ UTF8ToUTF16(std::string("--") + bad_flag)),
+ false));
}
}
@@ -1181,9 +1186,10 @@ void BrowserInit::LaunchWithProfile::
"http://dev.chromium.org/dnscertprovenancechecking";
string16 message = l10n_util::GetStringUTF16(
IDS_DNS_CERT_PROVENANCE_CHECKING_WARNING_MESSAGE);
- tab->AddInfoBar(new LearnMoreInfoBar(tab->tab_contents(),
- message,
- GURL(kLearnMoreURL)));
+ tab->infobar_tab_helper()->AddInfoBar(
+ new LearnMoreInfoBar(tab->tab_contents(),
+ message,
+ GURL(kLearnMoreURL)));
}
void BrowserInit::LaunchWithProfile::AddObsoleteSystemInfoBarIfNecessary(
@@ -1204,9 +1210,10 @@ void BrowserInit::LaunchWithProfile::AddObsoleteSystemInfoBarIfNecessary(
// Link to an article in the help center on minimum system requirements.
const char* kLearnMoreURL =
"http://www.google.com/support/chrome/bin/answer.py?answer=95411";
- tab->AddInfoBar(new LearnMoreInfoBar(tab->tab_contents(),
- message,
- GURL(kLearnMoreURL)));
+ tab->infobar_tab_helper()->AddInfoBar(
+ new LearnMoreInfoBar(tab->tab_contents(),
+ message,
+ GURL(kLearnMoreURL)));
}
#endif
}

Powered by Google App Engine
This is Rietveld 408576698