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

Unified Diff: chrome/browser/ui/sync/one_click_signin_helper.cc

Issue 11644059: Change infobar creation to use a public static Create() method on the infobar delegate classes. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 11 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/sync/one_click_signin_helper.cc
===================================================================
--- chrome/browser/ui/sync/one_click_signin_helper.cc (revision 175396)
+++ chrome/browser/ui/sync/one_click_signin_helper.cc (working copy)
@@ -232,13 +232,19 @@
// of this infobar.
class OneClickInfoBarDelegateImpl : public OneClickSigninInfoBarDelegate {
public:
+ // Creates a one click signin delegate and adds it to |infobar_service|.
+ static void Create(InfoBarService* infobar_service,
+ const std::string& session_index,
+ const std::string& email,
+ const std::string& password);
+
+ private:
OneClickInfoBarDelegateImpl(InfoBarService* owner,
- const std::string& session_index,
- const std::string& email,
- const std::string& password);
+ const std::string& session_index,
+ const std::string& email,
+ const std::string& password);
virtual ~OneClickInfoBarDelegateImpl();
- private:
// InfoBarDelegate overrides.
virtual InfoBarAutomationType GetInfoBarAutomationType() const OVERRIDE;
virtual void InfoBarDismissed() OVERRIDE;
@@ -270,6 +276,16 @@
DISALLOW_COPY_AND_ASSIGN(OneClickInfoBarDelegateImpl);
};
+// static
+void OneClickInfoBarDelegateImpl::Create(InfoBarService* infobar_service,
+ const std::string& session_index,
+ const std::string& email,
+ const std::string& password) {
+ infobar_service->AddInfoBar(scoped_ptr<InfoBarDelegate>(
+ new OneClickInfoBarDelegateImpl(infobar_service, session_index, email,
+ password)));
+}
+
OneClickInfoBarDelegateImpl::OneClickInfoBarDelegateImpl(
InfoBarService* owner,
const std::string& session_index,
@@ -867,8 +883,6 @@
Browser* browser = chrome::FindBrowserWithWebContents(contents);
Profile* profile =
Profile::FromBrowserContext(contents->GetBrowserContext());
- InfoBarService* infobar_tab_helper =
- InfoBarService::FromWebContents(contents);
VLOG(1) << "OneClickSigninHelper::DidStopLoading: signin is go."
<< " auto_accept=" << auto_accept_
@@ -881,9 +895,9 @@
one_click_signin::HISTOGRAM_DISMISSED,
one_click_signin::HISTOGRAM_MAX);
} else {
- infobar_tab_helper->AddInfoBar(
- new OneClickInfoBarDelegateImpl(infobar_tab_helper, session_index_,
- email_, password_));
+ OneClickInfoBarDelegateImpl::Create(
+ InfoBarService::FromWebContents(contents), session_index_, email_,
+ password_);
}
break;
case AUTO_ACCEPT_ACCEPTED:
« no previous file with comments | « chrome/browser/ui/startup/startup_browser_creator_impl.cc ('k') | chrome/browser/ui/sync/one_click_signin_infobar_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698