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

Unified Diff: chrome/browser/ui/views/infobars/translate_infobar_base.cc

Issue 22694006: Infobar system refactor. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years 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/views/infobars/translate_infobar_base.cc
===================================================================
--- chrome/browser/ui/views/infobars/translate_infobar_base.cc (revision 238220)
+++ chrome/browser/ui/views/infobars/translate_infobar_base.cc (working copy)
@@ -5,6 +5,7 @@
#include "chrome/browser/ui/views/infobars/translate_infobar_base.h"
#include "base/strings/utf_string_conversions.h"
+#include "chrome/browser/infobars/infobar.h"
#include "chrome/browser/translate/translate_infobar_delegate.h"
#include "chrome/browser/ui/views/infobars/after_translate_infobar.h"
#include "chrome/browser/ui/views/infobars/before_translate_infobar.h"
@@ -19,12 +20,14 @@
// TranslateInfoBarDelegate ---------------------------------------------------
-InfoBar* TranslateInfoBarDelegate::CreateInfoBar(InfoBarService* owner) {
- if (infobar_type_ == BEFORE_TRANSLATE)
- return new BeforeTranslateInfoBar(owner, this);
- if (infobar_type_ == AFTER_TRANSLATE)
- return new AfterTranslateInfoBar(owner, this);
- return new TranslateMessageInfoBar(owner, this);
+// static
+scoped_ptr<InfoBar> TranslateInfoBarDelegate::CreateInfoBar(
+ scoped_ptr<TranslateInfoBarDelegate> delegate) {
+ if (delegate->infobar_type() == BEFORE_TRANSLATE)
+ return scoped_ptr<InfoBar>(new BeforeTranslateInfoBar(delegate.Pass()));
+ if (delegate->infobar_type() == AFTER_TRANSLATE)
+ return scoped_ptr<InfoBar>(new AfterTranslateInfoBar(delegate.Pass()));
+ return scoped_ptr<InfoBar>(new TranslateMessageInfoBar(delegate.Pass()));
}
@@ -42,9 +45,9 @@
SchedulePaint();
}
-TranslateInfoBarBase::TranslateInfoBarBase(InfoBarService* owner,
- TranslateInfoBarDelegate* delegate)
- : InfoBarView(owner, delegate),
+TranslateInfoBarBase::TranslateInfoBarBase(
+ scoped_ptr<TranslateInfoBarDelegate> delegate)
+ : InfoBarView(delegate.PassAs<InfoBarDelegate>()),
error_background_(InfoBarDelegate::WARNING_TYPE) {
}

Powered by Google App Engine
This is Rietveld 408576698