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

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

Issue 22694006: Infobar system refactor. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 2 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/views/infobars/after_translate_infobar.cc
===================================================================
--- chrome/browser/ui/views/infobars/after_translate_infobar.cc (revision 226624)
+++ chrome/browser/ui/views/infobars/after_translate_infobar.cc (working copy)
@@ -5,7 +5,9 @@
#include "chrome/browser/ui/views/infobars/after_translate_infobar.h"
#include "base/strings/utf_string_conversions.h"
+#include "chrome/browser/translate/options_menu_model.h"
#include "chrome/browser/translate/translate_infobar_delegate.h"
+#include "chrome/browser/ui/views/infobars/translate_language_menu_model.h"
#include "grit/generated_resources.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/views/controls/button/label_button.h"
@@ -14,9 +16,8 @@
#include "ui/views/controls/menu/menu_item_view.h"
AfterTranslateInfoBar::AfterTranslateInfoBar(
- InfoBarService* owner,
- TranslateInfoBarDelegate* delegate)
- : TranslateInfoBarBase(owner, delegate),
+ scoped_ptr<TranslateInfoBarDelegate> delegate)
+ : TranslateInfoBarBase(delegate.Pass()),
label_1_(NULL),
label_2_(NULL),
label_3_(NULL),
@@ -24,10 +25,10 @@
target_language_menu_button_(NULL),
revert_button_(NULL),
options_menu_button_(NULL),
- options_menu_model_(delegate),
swapped_language_buttons_(false) {
autodetermined_source_language_ =
- delegate->original_language_index() == TranslateInfoBarDelegate::kNoIndex;
+ GetDelegate()->original_language_index() ==
+ TranslateInfoBarDelegate::kNoIndex;
}
AfterTranslateInfoBar::~AfterTranslateInfoBar() {
@@ -126,6 +127,7 @@
options_menu_button_ = CreateMenuButton(
l10n_util::GetStringUTF16(IDS_TRANSLATE_INFOBAR_OPTIONS), this);
+ options_menu_model_.reset(new OptionsMenuModel(delegate));
AddChildView(options_menu_button_);
// This must happen after adding all other children so InfoBarView can ensure
@@ -177,7 +179,7 @@
views::MenuItemView::TOPLEFT);
} else {
DCHECK_EQ(options_menu_button_, source);
- RunMenuAt(&options_menu_model_, options_menu_button_,
+ RunMenuAt(options_menu_model_.get(), options_menu_button_,
views::MenuItemView::TOPRIGHT);
}
}

Powered by Google App Engine
This is Rietveld 408576698