Commit adbe1348 authored by satorux@chromium.org's avatar satorux@chromium.org

Revert 194525 "Add InitWidgets() phase for GTK infobars."

Broke "Linux Tests (dbg)(2)" build.
http://build.chromium.org/p/chromium.linux/builders/Linux%20Tests%20%28dbg%29%282%29/builds/33655

[4808:4808:0416/202705:277959527:FATAL:browser_main_loop.cc(186)] Gtk: gtk_box_pack: assertion `GTK_IS_WIDGET (child)' failed 

The error is FATAL with a Debug build but ERROR with a Release build, hence linux_rel try bot passed:
http://build.chromium.org/p/tryserver.chromium/builders/linux_rel/builds/117475/steps/interactive_ui_tests/logs/stdio

[10001:10001:0416/181034:1303866619:ERROR:browser_main_loop.cc(186)] Gtk: gtk_box_pack: assertion `GTK_IS_WIDGET (child)' failed

> Add InitWidgets() phase for GTK infobars.
> 
> This unifies the creation of GTK widgets and makes it happen in response to the infobar being shown.  Currently, this generally happens at construction.  Once the new ownership model lands, infobars will not yet be owned at construction time, and since widget creation includes getting a theme service from the owner, that needs to move out of the construction phase.
> 
> Incidentally, this also makes the GTK native object creation happen at the same time as the views native object creation, not that that matters much.
> 
> BUG=none
> TEST=none
> 
> Review URL: https://codereview.chromium.org/11775019

TBR=pkasting@chromium.org

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@194528 0039d316-1c4b-4281-b951-d872f2087c98
parent 71a84dec
......@@ -89,7 +89,7 @@ class InfoBar : public ui::AnimationDelegate {
// out) as we animate open and closed.
int OffsetY(const gfx::Size& prefsize) const;
InfoBarService* owner() const { return owner_; }
bool owned() const { return !!owner_; }
const InfoBarContainer* container() const { return container_; }
InfoBarContainer* container() { return container_; }
ui::SlideAnimation* animation() { return &animation_; }
......
......@@ -24,8 +24,8 @@ AfterTranslateInfoBar::AfterTranslateInfoBar(
AfterTranslateInfoBar::~AfterTranslateInfoBar() {
}
void AfterTranslateInfoBar::InitWidgets() {
TranslateInfoBarBase::InitWidgets();
void AfterTranslateInfoBar::Init() {
TranslateInfoBarBase::Init();
bool swapped_language_combos = false;
std::vector<string16> strings;
......
......@@ -18,7 +18,7 @@ class AfterTranslateInfoBar : public TranslateInfoBarBase {
virtual ~AfterTranslateInfoBar();
// Overridden from TranslateInfoBarBase:
virtual void InitWidgets() OVERRIDE;
virtual void Init() OVERRIDE;
protected:
virtual bool ShowOptionsMenuButton() const OVERRIDE;
......
......@@ -19,21 +19,16 @@ AlternateNavInfoBarGtk::AlternateNavInfoBarGtk(
InfoBarService* owner,
AlternateNavInfoBarDelegate* delegate)
: InfoBarGtk(owner, delegate) {
}
AlternateNavInfoBarGtk::~AlternateNavInfoBarGtk() {
}
void AlternateNavInfoBarGtk::InitWidgets() {
InfoBarGtk::InitWidgets();
size_t link_offset;
string16 display_text = GetDelegate()->GetMessageTextWithOffset(&link_offset);
string16 link_text = GetDelegate()->GetLinkText();
string16 display_text = delegate->GetMessageTextWithOffset(&link_offset);
string16 link_text = delegate->GetLinkText();
AddLabelWithInlineLink(display_text, link_text, link_offset,
G_CALLBACK(OnLinkClickedThunk));
}
AlternateNavInfoBarGtk::~AlternateNavInfoBarGtk() {
}
void AlternateNavInfoBarGtk::OnLinkClicked(GtkWidget* button) {
if (GetDelegate()->LinkClicked(
event_utils::DispositionForCurrentButtonPressEvent()))
......
......@@ -20,9 +20,6 @@ class AlternateNavInfoBarGtk : public InfoBarGtk {
private:
virtual ~AlternateNavInfoBarGtk();
// InfoBarGtk:
virtual void InitWidgets() OVERRIDE;
CHROMEGTK_CALLBACK_0(AlternateNavInfoBarGtk, void, OnLinkClicked);
AlternateNavInfoBarDelegate* GetDelegate();
......
......@@ -21,8 +21,8 @@ BeforeTranslateInfoBar::BeforeTranslateInfoBar(
BeforeTranslateInfoBar::~BeforeTranslateInfoBar() {
}
void BeforeTranslateInfoBar::InitWidgets() {
TranslateInfoBarBase::InitWidgets();
void BeforeTranslateInfoBar::Init() {
TranslateInfoBarBase::Init();
GtkWidget* hbox = gtk_hbox_new(FALSE, ui::kControlSpacing);
gtk_util::CenterWidgetInHBox(hbox_, hbox, false, 0);
......
......@@ -17,7 +17,7 @@ class BeforeTranslateInfoBar : public TranslateInfoBarBase {
virtual ~BeforeTranslateInfoBar();
// Overridden from TranslateInfoBarBase:
virtual void InitWidgets() OVERRIDE;
virtual void Init() OVERRIDE;
protected:
virtual bool ShowOptionsMenuButton() const OVERRIDE;
......
......@@ -24,18 +24,7 @@ InfoBar* ConfirmInfoBarDelegate::CreateInfoBar(InfoBarService* owner) {
ConfirmInfoBarGtk::ConfirmInfoBarGtk(InfoBarService* owner,
ConfirmInfoBarDelegate* delegate)
: InfoBarGtk(owner, delegate),
confirm_hbox_(NULL),
size_group_(NULL) {
}
ConfirmInfoBarGtk::~ConfirmInfoBarGtk() {
if (size_group_)
g_object_unref(size_group_);
}
void ConfirmInfoBarGtk::InitWidgets() {
InfoBarGtk::InitWidgets();
confirm_hbox_ = gtk_chrome_shrinkable_hbox_new(FALSE, FALSE,
kEndOfLabelSpacing);
// This alignment allocates the confirm hbox only as much space as it
......@@ -49,7 +38,7 @@ void ConfirmInfoBarGtk::InitWidgets() {
AddButton(ConfirmInfoBarDelegate::BUTTON_OK);
AddButton(ConfirmInfoBarDelegate::BUTTON_CANCEL);
std::string label_text = UTF16ToUTF8(GetDelegate()->GetMessageText());
std::string label_text = UTF16ToUTF8(delegate->GetMessageText());
GtkWidget* label = CreateLabel(label_text);
gtk_util::ForceFontSizePixels(label, 13.4);
gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
......@@ -58,7 +47,7 @@ void ConfirmInfoBarGtk::InitWidgets() {
G_CALLBACK(gtk_util::InitLabelSizeRequestAndEllipsizeMode),
NULL);
std::string link_text = UTF16ToUTF8(GetDelegate()->GetLinkText());
std::string link_text = UTF16ToUTF8(delegate->GetLinkText());
if (link_text.empty())
return;
......@@ -72,12 +61,12 @@ void ConfirmInfoBarGtk::InitWidgets() {
gtk_util::CenterWidgetInHBox(hbox_, link, true, kEndOfLabelSpacing);
}
ConfirmInfoBarDelegate* ConfirmInfoBarGtk::GetDelegate() {
return delegate()->AsConfirmInfoBarDelegate();
ConfirmInfoBarGtk::~ConfirmInfoBarGtk() {
if (size_group_)
g_object_unref(size_group_);
}
void ConfirmInfoBarGtk::AddButton(ConfirmInfoBarDelegate::InfoBarButton type) {
DCHECK(confirm_hbox_);
if (delegate()->AsConfirmInfoBarDelegate()->GetButtons() & type) {
if (!size_group_)
size_group_ = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
......
......@@ -24,11 +24,6 @@ class ConfirmInfoBarGtk : public InfoBarGtk {
private:
virtual ~ConfirmInfoBarGtk();
// InfoBarGtk:
virtual void InitWidgets() OVERRIDE;
ConfirmInfoBarDelegate* GetDelegate();
// Adds a button to the info bar by type. It will do nothing if the delegate
// doesn't specify a button of the given type.
void AddButton(ConfirmInfoBarDelegate::InfoBarButton type);
......
......@@ -35,12 +35,20 @@ ExtensionInfoBarGtk::ExtensionInfoBarGtk(InfoBarService* owner,
view_(NULL),
button_(NULL),
icon_(NULL),
alignment_(NULL),
ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)) {
delegate->set_observer(this);
// Always render the close button as if we were doing chrome style widget
// rendering. For extension infobars, we force chrome style rendering because
// extension authors are going to expect to match the declared gradient in
// extensions_infobar.css, and the close button provided by some GTK+ themes
// won't look good on this background.
close_button_->ForceChromeTheme();
int height = delegate->height();
SetBarTargetHeight((height > 0) ? (height + kSeparatorLineHeight) : 0);
BuildWidgets();
}
ExtensionInfoBarGtk::~ExtensionInfoBarGtk() {
......@@ -49,7 +57,8 @@ ExtensionInfoBarGtk::~ExtensionInfoBarGtk() {
}
void ExtensionInfoBarGtk::PlatformSpecificHide(bool animate) {
DCHECK(alignment_);
// This view is not owned by us; we can't unparent it because we aren't the
// owning container.
gtk_util::RemoveAllChildren(alignment_);
}
......@@ -68,7 +77,6 @@ void ExtensionInfoBarGtk::OnImageLoaded(const gfx::Image& image) {
if (!delegate_)
return; // The delegate can go away while we asynchronously load images.
DCHECK(icon_);
// TODO(erg): IDR_EXTENSIONS_SECTION should have an IDR_INFOBAR_EXTENSIONS
// icon of the correct size with real subpixel shading and such.
const gfx::ImageSkia* icon = NULL;
......@@ -102,16 +110,7 @@ void ExtensionInfoBarGtk::OnImageLoaded(const gfx::Image& image) {
g_object_unref(pixbuf);
}
void ExtensionInfoBarGtk::InitWidgets() {
InfoBarGtk::InitWidgets();
// Always render the close button as if we were doing chrome style widget
// rendering. For extension infobars, we force chrome style rendering because
// extension authors are going to expect to match the declared gradient in
// extensions_infobar.css, and the close button provided by some GTK+ themes
// won't look good on this background.
close_button_->ForceChromeTheme();
void ExtensionInfoBarGtk::BuildWidgets() {
icon_ = gtk_image_new();
gtk_misc_set_alignment(GTK_MISC(icon_), 0.5, 0.5);
......@@ -179,7 +178,6 @@ void ExtensionInfoBarGtk::OnDelegateDeleted() {
}
Browser* ExtensionInfoBarGtk::GetBrowser() {
DCHECK(icon_);
// Get the Browser object this infobar is attached to.
GtkWindow* parent = platform_util::GetTopLevel(icon_);
if (!parent)
......
......@@ -32,7 +32,6 @@ class ExtensionInfoBarGtk : public InfoBarGtk,
double* r, double* g, double* b) OVERRIDE;
virtual void GetBottomColor(InfoBarDelegate::Type type,
double* r, double* g, double* b) OVERRIDE;
virtual void InitWidgets() OVERRIDE;
// Overridden from MenuGtk::Delegate:
virtual void StoppedShowing() OVERRIDE;
......@@ -41,6 +40,9 @@ class ExtensionInfoBarGtk : public InfoBarGtk,
virtual void OnDelegateDeleted() OVERRIDE;
private:
// Build the widgets of the Infobar.
void BuildWidgets();
void OnImageLoaded(const gfx::Image& image);
// Looks at the window the infobar is in and gets the browser. Can return
......
......@@ -52,10 +52,53 @@ const int InfoBarGtk::kEndOfLabelSpacing = 6;
InfoBarGtk::InfoBarGtk(InfoBarService* owner, InfoBarDelegate* delegate)
: InfoBar(owner, delegate),
bg_box_(NULL),
hbox_(NULL),
theme_service_(NULL),
theme_service_(GtkThemeService::GetFrom(Profile::FromBrowserContext(
owner->GetWebContents()->GetBrowserContext()))),
signals_(new ui::GtkSignalRegistrar) {
DCHECK(delegate);
// Create |hbox_| and pad the sides.
hbox_ = gtk_hbox_new(FALSE, kElementPadding);
// Make the whole infor bar horizontally shrinkable.
gtk_widget_set_size_request(hbox_, 0, -1);
GtkWidget* padding = gtk_alignment_new(0, 0, 1, 1);
gtk_alignment_set_padding(GTK_ALIGNMENT(padding),
0, 0, kLeftPadding, kRightPadding);
bg_box_ = gtk_event_box_new();
gtk_widget_set_app_paintable(bg_box_, TRUE);
g_signal_connect(bg_box_, "expose-event",
G_CALLBACK(OnBackgroundExposeThunk), this);
gtk_container_add(GTK_CONTAINER(padding), hbox_);
gtk_container_add(GTK_CONTAINER(bg_box_), padding);
// Add the icon on the left, if any.
gfx::Image* icon = delegate->GetIcon();
if (icon) {
GtkWidget* image = gtk_image_new_from_pixbuf(icon->ToGdkPixbuf());
gtk_misc_set_alignment(GTK_MISC(image), 0.5, 0.5);
gtk_box_pack_start(GTK_BOX(hbox_), image, FALSE, FALSE, 0);
}
close_button_.reset(CustomDrawButton::CloseButtonBar(theme_service_));
gtk_util::CenterWidgetInHBox(hbox_, close_button_->widget(), true, 0);
signals_->Connect(close_button_->widget(), "clicked",
G_CALLBACK(OnCloseButtonThunk), this);
widget_.Own(gtk_expanded_container_new());
gtk_container_add(GTK_CONTAINER(widget_.get()), bg_box_);
gtk_widget_set_size_request(widget_.get(), -1, 0);
g_signal_connect(widget_.get(), "child-size-request",
G_CALLBACK(OnChildSizeRequestThunk),
this);
registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED,
content::Source<ThemeService>(theme_service_));
UpdateBorderColor();
}
InfoBarGtk::~InfoBarGtk() {
......@@ -66,7 +109,6 @@ GtkWidget* InfoBarGtk::widget() {
}
GdkColor InfoBarGtk::GetBorderColor() const {
DCHECK(theme_service_);
return theme_service_->GetBorderColor();
}
......@@ -79,12 +121,10 @@ ui::GtkSignalRegistrar* InfoBarGtk::Signals() {
}
GtkWidget* InfoBarGtk::CreateLabel(const std::string& text) {
DCHECK(theme_service_);
return theme_service_->BuildLabel(text, ui::kGdkBlack);
}
GtkWidget* InfoBarGtk::CreateLinkButton(const std::string& text) {
DCHECK(theme_service_);
return theme_service_->BuildChromeLinkButton(text);
}
......@@ -118,7 +158,6 @@ void InfoBarGtk::AddLabelWithInlineLink(const string16& display_text,
const string16& link_text,
size_t link_offset,
GCallback callback) {
DCHECK(hbox_);
GtkWidget* link_button = CreateLinkButton(UTF16ToUTF8(link_text));
gtk_util::ForceFontSizePixels(
GTK_CHROME_LINK_BUTTON(link_button)->label, 13.4);
......@@ -161,7 +200,6 @@ void InfoBarGtk::ShowMenuWithModel(GtkWidget* sender,
void InfoBarGtk::GetTopColor(InfoBarDelegate::Type type,
double* r, double* g, double* b) {
DCHECK(theme_service_);
SkColor color = theme_service_->UsingNativeTheme() ?
theme_service_->GetColor(ThemeProperties::COLOR_TOOLBAR) :
GetInfoBarTopColor(type);
......@@ -172,7 +210,6 @@ void InfoBarGtk::GetTopColor(InfoBarDelegate::Type type,
void InfoBarGtk::GetBottomColor(InfoBarDelegate::Type type,
double* r, double* g, double* b) {
DCHECK(theme_service_);
SkColor color = theme_service_->UsingNativeTheme() ?
theme_service_->GetColor(ThemeProperties::COLOR_TOOLBAR) :
GetInfoBarBottomColor(type);
......@@ -182,14 +219,13 @@ void InfoBarGtk::GetBottomColor(InfoBarDelegate::Type type,
}
void InfoBarGtk::UpdateBorderColor() {
DCHECK(widget());
gtk_widget_queue_draw(widget());
}
void InfoBarGtk::OnCloseButton(GtkWidget* button) {
// If we're not owned, we're already closing, so don't call
// InfoBarDismissed(), since this can lead to us double-recording dismissals.
if (delegate() && owner())
if (delegate() && owned())
delegate()->InfoBarDismissed();
RemoveSelf();
}
......@@ -197,7 +233,6 @@ void InfoBarGtk::OnCloseButton(GtkWidget* button) {
gboolean InfoBarGtk::OnBackgroundExpose(GtkWidget* sender,
GdkEventExpose* event) {
TRACE_EVENT0("ui::gtk", "InfoBarGtk::OnBackgroundExpose");
DCHECK(theme_service_);
GtkAllocation allocation;
gtk_widget_get_allocation(sender, &allocation);
......@@ -242,11 +277,6 @@ gboolean InfoBarGtk::OnBackgroundExpose(GtkWidget* sender,
}
void InfoBarGtk::PlatformSpecificShow(bool animate) {
if (!theme_service_)
InitWidgets();
DCHECK(bg_box_);
DCHECK(widget());
gtk_widget_show_all(widget_.get());
gtk_widget_set_size_request(widget_.get(), -1, bar_height());
......@@ -263,8 +293,6 @@ void InfoBarGtk::PlatformSpecificOnCloseSoon() {
}
void InfoBarGtk::PlatformSpecificOnHeightsRecalculated() {
DCHECK(bg_box_);
DCHECK(widget());
gtk_widget_set_size_request(bg_box_, -1, bar_target_height());
gtk_expanded_container_move(GTK_EXPANDED_CONTAINER(widget_.get()),
bg_box_, 0,
......@@ -277,56 +305,6 @@ void InfoBarGtk::PlatformSpecificOnHeightsRecalculated() {
void InfoBarGtk::Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) {
DCHECK(widget());
UpdateBorderColor();
}
void InfoBarGtk::InitWidgets() {
theme_service_ = GtkThemeService::GetFrom(Profile::FromBrowserContext(
owner()->GetWebContents()->GetBrowserContext()));
// Create |hbox_| and pad the sides.
hbox_ = gtk_hbox_new(FALSE, kElementPadding);
// Make the whole infor bar horizontally shrinkable.
gtk_widget_set_size_request(hbox_, 0, -1);
GtkWidget* padding = gtk_alignment_new(0, 0, 1, 1);
gtk_alignment_set_padding(GTK_ALIGNMENT(padding),
0, 0, kLeftPadding, kRightPadding);
bg_box_ = gtk_event_box_new();
gtk_widget_set_app_paintable(bg_box_, TRUE);
g_signal_connect(bg_box_, "expose-event",
G_CALLBACK(OnBackgroundExposeThunk), this);
gtk_container_add(GTK_CONTAINER(padding), hbox_);
gtk_container_add(GTK_CONTAINER(bg_box_), padding);
// Add the icon on the left, if any.
gfx::Image* icon = delegate()->GetIcon();
if (icon) {
GtkWidget* image = gtk_image_new_from_pixbuf(icon->ToGdkPixbuf());
gtk_misc_set_alignment(GTK_MISC(image), 0.5, 0.5);
gtk_box_pack_start(GTK_BOX(hbox_), image, FALSE, FALSE, 0);
}
close_button_.reset(CustomDrawButton::CloseButtonBar(theme_service_));
gtk_util::CenterWidgetInHBox(hbox_, close_button_->widget(), true, 0);
signals_->Connect(close_button_->widget(), "clicked",
G_CALLBACK(OnCloseButtonThunk), this);
widget_.Own(gtk_expanded_container_new());
gtk_container_add(GTK_CONTAINER(widget_.get()), bg_box_);
gtk_widget_set_size_request(widget_.get(), -1, 0);
g_signal_connect(widget_.get(), "child-size-request",
G_CALLBACK(OnChildSizeRequestThunk),
this);
registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED,
content::Source<ThemeService>(theme_service_));
UpdateBorderColor();
}
......
......@@ -98,17 +98,6 @@ class InfoBarGtk : public InfoBar,
const content::NotificationSource& source,
const content::NotificationDetails& details) OVERRIDE;
// Called the first time we try to show the infobar. Inits any widgets and
// related objects necessary.
//
// NOTE: Subclasses who need to init widgets should override this function and
// explicitly call their parent's implementation first, then continue with
// further work they need to do. Failing to call the parent implementation
// first (or at all), or setting up widgets in the constructor instead of
// here, will lead to bad side effects like crashing or having this function
// get called repeatedly.
virtual void InitWidgets();
// The second highest widget in the hierarchy (after the |widget_|).
GtkWidget* bg_box_;
......
......@@ -58,6 +58,20 @@ TranslateInfoBarBase::TranslateInfoBarBase(InfoBarService* owner,
TranslateInfoBarBase::~TranslateInfoBarBase() {
}
void TranslateInfoBarBase::Init() {
if (!ShowOptionsMenuButton())
return;
// The options button sits outside the translate_box so that it can be end
// packed in hbox_.
GtkWidget* options_menu_button = CreateMenuButton(
l10n_util::GetStringUTF8(IDS_TRANSLATE_INFOBAR_OPTIONS));
Signals()->Connect(options_menu_button, "clicked",
G_CALLBACK(&OnOptionsClickedThunk), this);
gtk_widget_show_all(options_menu_button);
gtk_util::CenterWidgetInHBox(hbox_, options_menu_button, true, 0);
}
void TranslateInfoBarBase::GetTopColor(InfoBarDelegate::Type type,
double* r, double* g, double* b) {
if (background_error_percent_ <= 0) {
......@@ -108,24 +122,7 @@ void TranslateInfoBarBase::GetBottomColor(InfoBarDelegate::Type type,
}
}
void TranslateInfoBarBase::InitWidgets() {
InfoBarGtk::InitWidgets();
if (!ShowOptionsMenuButton())
return;
// The options button sits outside the translate_box so that it can be end
// packed in hbox_.
GtkWidget* options_menu_button = CreateMenuButton(
l10n_util::GetStringUTF8(IDS_TRANSLATE_INFOBAR_OPTIONS));
Signals()->Connect(options_menu_button, "clicked",
G_CALLBACK(&OnOptionsClickedThunk), this);
gtk_widget_show_all(options_menu_button);
gtk_util::CenterWidgetInHBox(hbox_, options_menu_button, true, 0);
}
void TranslateInfoBarBase::AnimationProgressed(const ui::Animation* animation) {
DCHECK(widget());
if (animation == background_color_animation_.get()) {
background_error_percent_ = animation->GetCurrentValue();
// Queue the info bar widget for redisplay so it repaints its background.
......@@ -217,5 +214,6 @@ InfoBar* TranslateInfoBarDelegate::CreateInfoBar(InfoBarService* owner) {
default:
NOTREACHED();
}
infobar->Init();
return infobar;
}
......@@ -19,12 +19,15 @@ class TranslateInfoBarBase : public InfoBarGtk {
TranslateInfoBarDelegate* delegate);
virtual ~TranslateInfoBarBase();
// Initializes the infobar widgets. Should be called after the object has been
// created.
virtual void Init();
// Overridden from InfoBar:
virtual void GetTopColor(InfoBarDelegate::Type type,
double* r, double* g, double* b) OVERRIDE;
virtual void GetBottomColor(InfoBarDelegate::Type type,
double* r, double* g, double* b) OVERRIDE;
virtual void InitWidgets() OVERRIDE;
// Overridden from ui::AnimationDelegate:
virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE;
......
......@@ -19,8 +19,8 @@ TranslateMessageInfoBar::TranslateMessageInfoBar(
TranslateMessageInfoBar::~TranslateMessageInfoBar() {
}
void TranslateMessageInfoBar::InitWidgets() {
TranslateInfoBarBase::InitWidgets();
void TranslateMessageInfoBar::Init() {
TranslateInfoBarBase::Init();
GtkWidget* hbox = gtk_hbox_new(FALSE, ui::kControlSpacing);
gtk_util::CenterWidgetInHBox(hbox_, hbox, false, 0);
......
......@@ -17,7 +17,7 @@ class TranslateMessageInfoBar : public TranslateInfoBarBase {
virtual ~TranslateMessageInfoBar();
// Overridden from TranslateInfoBarBase:
virtual void InitWidgets() OVERRIDE;
virtual void Init() OVERRIDE;
private:
CHROMEGTK_CALLBACK_0(TranslateMessageInfoBar, void, OnButtonPressed);
......
......@@ -133,7 +133,7 @@ void AfterTranslateInfoBar::ViewHierarchyChanged(bool is_add,
void AfterTranslateInfoBar::ButtonPressed(views::Button* sender,
const ui::Event& event) {
if (!owner())
if (!owned())
return; // We're closing; don't call anything, it might access the owner.
if (sender == revert_button_)
GetDelegate()->RevertTranslation();
......@@ -155,7 +155,7 @@ int AfterTranslateInfoBar::ContentMinimumWidth() const {
void AfterTranslateInfoBar::OnMenuButtonClicked(views::View* source,
const gfx::Point& point) {
if (!owner())
if (!owned())
return; // We're closing; don't call anything, it might access the owner.
if (source == original_language_menu_button_) {
RunMenuAt(original_language_menu_model_.get(),
......
......@@ -76,7 +76,7 @@ void AlternateNavInfoBarView::ViewHierarchyChanged(bool is_add,
void AlternateNavInfoBarView::LinkClicked(views::Link* source,
int event_flags) {
if (!owner())
if (!owned())
return; // We're closing; don't call anything, it might access the owner.
DCHECK(link_ != NULL);
DCHECK_EQ(link_, source);
......
......@@ -164,7 +164,7 @@ int BeforeTranslateInfoBar::ContentMinimumWidth() const {
void BeforeTranslateInfoBar::ButtonPressed(views::Button* sender,
const ui::Event& event) {
if (!owner())
if (!owned())
return; // We're closing; don't call anything, it might access the owner.
TranslateInfoBarDelegate* delegate = GetDelegate();
if (sender == accept_button_) {
......@@ -183,7 +183,7 @@ void BeforeTranslateInfoBar::ButtonPressed(views::Button* sender,
void BeforeTranslateInfoBar::OnMenuButtonClicked(views::View* source,
const gfx::Point& point) {
if (!owner())
if (!owned())
return; // We're closing; don't call anything, it might access the owner.
if (source == language_menu_button_) {
RunMenuAt(language_menu_model_.get(), language_menu_button_,
......
......@@ -98,7 +98,7 @@ void ConfirmInfoBar::ViewHierarchyChanged(bool is_add,
void ConfirmInfoBar::ButtonPressed(views::Button* sender,
const ui::Event& event) {
if (!owner())
if (!owned())
return; // We're closing; don't call anything, it might access the owner.
ConfirmInfoBarDelegate* delegate = GetDelegate();
if ((ok_button_ != NULL) && sender == ok_button_) {
......@@ -124,7 +124,7 @@ int ConfirmInfoBar::ContentMinimumWidth() const {
}
void ConfirmInfoBar::LinkClicked(views::Link* source, int event_flags) {
if (!owner())
if (!owned())
return; // We're closing; don't call anything, it might access the owner.
DCHECK(link_ != NULL);
DCHECK_EQ(link_, source);
......
......@@ -170,7 +170,7 @@ void ExtensionInfoBar::OnDelegateDeleted() {
void ExtensionInfoBar::OnMenuButtonClicked(views::View* source,
const gfx::Point& point) {
if (!owner())
if (!owned())
return; // We're closing; don't call anything, it might access the owner.
const extensions::Extension* extension = GetDelegate()->extension_host()->
extension();
......
......@@ -270,7 +270,7 @@ void InfoBarView::PaintChildren(gfx::Canvas* canvas) {
void InfoBarView::ButtonPressed(views::Button* sender,
const ui::Event& event) {
if (!owner())
if (!owned())
return; // We're closing; don't call anything, it might access the owner.
if (sender == close_button_) {
delegate()->InfoBarDismissed();
......@@ -303,7 +303,7 @@ const InfoBarContainer::Delegate* InfoBarView::container_delegate() const {
void InfoBarView::RunMenuAt(ui::MenuModel* menu_model,
views::MenuButton* button,
views::MenuItemView::AnchorPosition anchor) {
DCHECK(owner()); // We'd better not open any menus while we're closing.
DCHECK(owned()); // We'd better not open any menus while we're closing.
gfx::Point screen_point;
views::View::ConvertPointToScreen(button, &screen_point);
menu_runner_.reset(new views::MenuRunner(menu_model));
......
......@@ -57,7 +57,7 @@ void TranslateMessageInfoBar::ViewHierarchyChanged(bool is_add,
void TranslateMessageInfoBar::ButtonPressed(views::Button* sender,
const ui::Event& event) {
if (!owner())
if (!owned())
return; // We're closing; don't call anything, it might access the owner.
if (sender == button_)
GetDelegate()->MessageInfoBarButtonPressed();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment