diff options
Diffstat (limited to 'chrome/browser/ui')
32 files changed, 66 insertions, 647 deletions
diff --git a/chrome/browser/ui/cocoa/extensions/extension_infobar_controller.mm b/chrome/browser/ui/cocoa/extensions/extension_infobar_controller.mm index 982b1d7..77a9afa 100644 --- a/chrome/browser/ui/cocoa/extensions/extension_infobar_controller.mm +++ b/chrome/browser/ui/cocoa/extensions/extension_infobar_controller.mm @@ -259,7 +259,7 @@ class InfobarBridge : public ExtensionInfoBarDelegate::DelegateObserver, @end -InfoBar* ExtensionInfoBarDelegate::CreateInfoBar() { +InfoBar* ExtensionInfoBarDelegate::CreateInfoBar(TabContentsWrapper* owner) { NSWindow* window = [(NSView*)tab_contents_->GetContentNativeView() window]; ExtensionInfoBarController* controller = [[ExtensionInfoBarController alloc] initWithDelegate:this diff --git a/chrome/browser/ui/cocoa/infobars/infobar_container_controller.mm b/chrome/browser/ui/cocoa/infobars/infobar_container_controller.mm index 509b9b7..af68668 100644 --- a/chrome/browser/ui/cocoa/infobars/infobar_container_controller.mm +++ b/chrome/browser/ui/cocoa/infobars/infobar_container_controller.mm @@ -180,7 +180,7 @@ class InfoBarNotificationObserver : public NotificationObserver { } - (void)addInfoBar:(InfoBarDelegate*)delegate animate:(BOOL)animate { - scoped_ptr<InfoBar> infobar(delegate->CreateInfoBar()); + scoped_ptr<InfoBar> infobar(delegate->CreateInfoBar(currentTabContents_)); InfoBarController* controller = infobar->controller(); [controller setContainerController:self]; [[controller animatableView] setResizeDelegate:self]; diff --git a/chrome/browser/ui/cocoa/infobars/infobar_controller.mm b/chrome/browser/ui/cocoa/infobars/infobar_controller.mm index c2e6d50..7bfe220 100644 --- a/chrome/browser/ui/cocoa/infobars/infobar_controller.mm +++ b/chrome/browser/ui/cocoa/infobars/infobar_controller.mm @@ -506,13 +506,13 @@ const float kAnimateCloseDuration = 0.12; ////////////////////////////////////////////////////////////////////////// // CreateInfoBar() implementations -InfoBar* LinkInfoBarDelegate::CreateInfoBar() { +InfoBar* LinkInfoBarDelegate::CreateInfoBar(TabContentsWrapper* owner) { LinkInfoBarController* controller = [[LinkInfoBarController alloc] initWithDelegate:this]; return new InfoBar(controller); } -InfoBar* ConfirmInfoBarDelegate::CreateInfoBar() { +InfoBar* ConfirmInfoBarDelegate::CreateInfoBar(TabContentsWrapper* owner) { ConfirmInfoBarController* controller = [[ConfirmInfoBarController alloc] initWithDelegate:this]; return new InfoBar(controller); diff --git a/chrome/browser/ui/cocoa/translate/translate_infobar_base.mm b/chrome/browser/ui/cocoa/translate/translate_infobar_base.mm index a13174c..c5613a3 100644 --- a/chrome/browser/ui/cocoa/translate/translate_infobar_base.mm +++ b/chrome/browser/ui/cocoa/translate/translate_infobar_base.mm @@ -109,7 +109,7 @@ void AddMenuItem(NSMenu *menu, id target, SEL selector, NSString* title, } // namespace TranslateInfoBarUtilities // TranslateInfoBarDelegate views specific method: -InfoBar* TranslateInfoBarDelegate::CreateInfoBar() { +InfoBar* TranslateInfoBarDelegate::CreateInfoBar(TabContentsWrapper* owner) { TranslateInfoBarControllerBase* infobar_controller = NULL; switch (type_) { case BEFORE_TRANSLATE: diff --git a/chrome/browser/ui/cocoa/translate/translate_infobar_unittest.mm b/chrome/browser/ui/cocoa/translate/translate_infobar_unittest.mm index 09ad581..9e2aa6b 100644 --- a/chrome/browser/ui/cocoa/translate/translate_infobar_unittest.mm +++ b/chrome/browser/ui/cocoa/translate/translate_infobar_unittest.mm @@ -14,6 +14,7 @@ #import "chrome/browser/ui/cocoa/infobars/infobar.h" #import "chrome/browser/ui/cocoa/translate/translate_infobar_base.h" #import "chrome/browser/ui/cocoa/translate/before_translate_infobar_controller.h" +#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" #import "content/browser/site_instance.h" #import "content/browser/tab_contents/tab_contents.h" #import "testing/gmock/include/gmock/gmock.h" @@ -68,7 +69,7 @@ class MockTranslateInfoBarDelegate : public TranslateInfoBarDelegate { class TranslationInfoBarTest : public CocoaTest { public: BrowserTestHelper browser_helper_; - scoped_ptr<TabContents> tab_contents; + scoped_ptr<TabContentsWrapper> tab_contents; scoped_ptr<MockTranslateInfoBarDelegate> infobar_delegate; scoped_nsobject<TranslateInfoBarControllerBase> infobar_controller; @@ -77,12 +78,8 @@ class TranslationInfoBarTest : public CocoaTest { // the test. virtual void SetUp() { CocoaTest::SetUp(); - tab_contents.reset( - new TabContents(browser_helper_.profile(), - NULL, - MSG_ROUTING_NONE, - NULL, - NULL)); + tab_contents.reset(new TabContentsWrapper(new TabContents( + browser_helper_.profile(), NULL, MSG_ROUTING_NONE, NULL, NULL))); CreateInfoBar(); } @@ -94,11 +91,12 @@ class TranslationInfoBarTest : public CocoaTest { TranslateErrors::Type error = TranslateErrors::NONE; if (type == TranslateInfoBarDelegate::TRANSLATION_ERROR) error = TranslateErrors::NETWORK; - infobar_delegate.reset( - new MockTranslateInfoBarDelegate(type, error, tab_contents.get())); + infobar_delegate.reset(new MockTranslateInfoBarDelegate(type, error, + tab_contents->tab_contents())); [[infobar_controller view] removeFromSuperview]; scoped_ptr<InfoBar> infobar( - static_cast<InfoBarDelegate*>(infobar_delegate.get())->CreateInfoBar()); + static_cast<InfoBarDelegate*>(infobar_delegate.get())-> + CreateInfoBar(tab_contents.get())); infobar_controller.reset( reinterpret_cast<TranslateInfoBarControllerBase*>( infobar->controller())); diff --git a/chrome/browser/ui/gtk/infobars/confirm_infobar_gtk.cc b/chrome/browser/ui/gtk/infobars/confirm_infobar_gtk.cc index 76fe742..51fc25b 100644 --- a/chrome/browser/ui/gtk/infobars/confirm_infobar_gtk.cc +++ b/chrome/browser/ui/gtk/infobars/confirm_infobar_gtk.cc @@ -13,7 +13,7 @@ // ConfirmInfoBarDelegate ------------------------------------------------------ -InfoBar* ConfirmInfoBarDelegate::CreateInfoBar() { +InfoBar* ConfirmInfoBarDelegate::CreateInfoBar(TabContentsWrapper* owner) { return new ConfirmInfoBarGtk(this); } diff --git a/chrome/browser/ui/gtk/infobars/extension_infobar_gtk.cc b/chrome/browser/ui/gtk/infobars/extension_infobar_gtk.cc index 6e2bcd0..85e3597 100644 --- a/chrome/browser/ui/gtk/infobars/extension_infobar_gtk.cc +++ b/chrome/browser/ui/gtk/infobars/extension_infobar_gtk.cc @@ -88,6 +88,6 @@ void ExtensionInfoBarGtk::OnExtensionPreferredSizeChanged( // of the content. } -InfoBar* ExtensionInfoBarDelegate::CreateInfoBar() { +InfoBar* ExtensionInfoBarDelegate::CreateInfoBar(TabContentsWrapper* owner) { return new ExtensionInfoBarGtk(this); } diff --git a/chrome/browser/ui/gtk/infobars/infobar_container_gtk.cc b/chrome/browser/ui/gtk/infobars/infobar_container_gtk.cc index 57b1f71..5f1428e 100644 --- a/chrome/browser/ui/gtk/infobars/infobar_container_gtk.cc +++ b/chrome/browser/ui/gtk/infobars/infobar_container_gtk.cc @@ -176,7 +176,7 @@ void InfoBarContainerGtk::ShowArrowForDelegate(InfoBarDelegate* delegate, } void InfoBarContainerGtk::AddInfoBar(InfoBarDelegate* delegate, bool animate) { - InfoBar* infobar = delegate->CreateInfoBar(); + InfoBar* infobar = delegate->CreateInfoBar(tab_contents_); infobar->set_container(this); infobar->SetThemeProvider(GtkThemeService::GetFrom(profile_)); gtk_box_pack_start(GTK_BOX(widget()), infobar->widget(), diff --git a/chrome/browser/ui/gtk/infobars/link_infobar_gtk.cc b/chrome/browser/ui/gtk/infobars/link_infobar_gtk.cc index db4821b..10aa10b 100644 --- a/chrome/browser/ui/gtk/infobars/link_infobar_gtk.cc +++ b/chrome/browser/ui/gtk/infobars/link_infobar_gtk.cc @@ -9,7 +9,7 @@ // LinkInfoBarDelegate --------------------------------------------------------- -InfoBar* LinkInfoBarDelegate::CreateInfoBar() { +InfoBar* LinkInfoBarDelegate::CreateInfoBar(TabContentsWrapper* owner) { return new LinkInfoBarGtk(this); } diff --git a/chrome/browser/ui/gtk/infobars/translate_infobar_base_gtk.cc b/chrome/browser/ui/gtk/infobars/translate_infobar_base_gtk.cc index 2579f16..0f53e03 100644 --- a/chrome/browser/ui/gtk/infobars/translate_infobar_base_gtk.cc +++ b/chrome/browser/ui/gtk/infobars/translate_infobar_base_gtk.cc @@ -218,7 +218,7 @@ void TranslateInfoBarBase::OnOptionsClicked(GtkWidget* sender) { } // TranslateInfoBarDelegate specific method: -InfoBar* TranslateInfoBarDelegate::CreateInfoBar() { +InfoBar* TranslateInfoBarDelegate::CreateInfoBar(TabContentsWrapper* owner) { TranslateInfoBarBase* infobar = NULL; switch (type_) { case BEFORE_TRANSLATE: diff --git a/chrome/browser/ui/views/frame/browser_view.h b/chrome/browser/ui/views/frame/browser_view.h index 150739f..a2ef9fa 100644 --- a/chrome/browser/ui/views/frame/browser_view.h +++ b/chrome/browser/ui/views/frame/browser_view.h @@ -13,13 +13,13 @@ #include "base/memory/scoped_ptr.h" #include "base/timer.h" #include "build/build_config.h" +#include "chrome/browser/tab_contents/infobar_container.h" #include "chrome/browser/tabs/tab_strip_model_observer.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/views/compact_nav/compact_location_bar_view_host.h" #include "chrome/browser/ui/views/frame/browser_bubble_host.h" #include "chrome/browser/ui/views/frame/browser_frame.h" -#include "chrome/browser/ui/views/infobars/infobar_container.h" #include "chrome/browser/ui/views/tab_contents/tab_contents_container.h" #include "chrome/browser/ui/views/tabs/abstract_tab_strip_view.h" #include "chrome/browser/ui/views/unhandled_keyboard_event_handler.h" diff --git a/chrome/browser/ui/views/infobars/after_translate_infobar.cc b/chrome/browser/ui/views/infobars/after_translate_infobar.cc index 4bb557f..c7898c4 100644 --- a/chrome/browser/ui/views/infobars/after_translate_infobar.cc +++ b/chrome/browser/ui/views/infobars/after_translate_infobar.cc @@ -13,8 +13,9 @@ #include "views/controls/menu/menu_2.h" AfterTranslateInfoBar::AfterTranslateInfoBar( + TabContentsWrapper* owner, TranslateInfoBarDelegate* delegate) - : TranslateInfoBarBase(delegate), + : TranslateInfoBarBase(owner, delegate), label_1_(NULL), label_2_(NULL), label_3_(NULL), diff --git a/chrome/browser/ui/views/infobars/after_translate_infobar.h b/chrome/browser/ui/views/infobars/after_translate_infobar.h index c1cd254..794dc2f 100644 --- a/chrome/browser/ui/views/infobars/after_translate_infobar.h +++ b/chrome/browser/ui/views/infobars/after_translate_infobar.h @@ -20,7 +20,8 @@ class MenuButton; class AfterTranslateInfoBar : public TranslateInfoBarBase, public views::ViewMenuDelegate { public: - explicit AfterTranslateInfoBar(TranslateInfoBarDelegate* delegate); + AfterTranslateInfoBar(TabContentsWrapper* owner, + TranslateInfoBarDelegate* delegate); private: virtual ~AfterTranslateInfoBar(); diff --git a/chrome/browser/ui/views/infobars/before_translate_infobar.cc b/chrome/browser/ui/views/infobars/before_translate_infobar.cc index 308f064..644bc6e 100644 --- a/chrome/browser/ui/views/infobars/before_translate_infobar.cc +++ b/chrome/browser/ui/views/infobars/before_translate_infobar.cc @@ -13,8 +13,9 @@ #include "views/controls/menu/menu_2.h" BeforeTranslateInfoBar::BeforeTranslateInfoBar( + TabContentsWrapper* owner, TranslateInfoBarDelegate* delegate) - : TranslateInfoBarBase(delegate), + : TranslateInfoBarBase(owner, delegate), label_1_(NULL), label_2_(NULL), language_menu_button_(NULL), diff --git a/chrome/browser/ui/views/infobars/before_translate_infobar.h b/chrome/browser/ui/views/infobars/before_translate_infobar.h index 546b33f..651d715 100644 --- a/chrome/browser/ui/views/infobars/before_translate_infobar.h +++ b/chrome/browser/ui/views/infobars/before_translate_infobar.h @@ -20,7 +20,8 @@ class MenuButton; class BeforeTranslateInfoBar : public TranslateInfoBarBase, public views::ViewMenuDelegate { public: - explicit BeforeTranslateInfoBar(TranslateInfoBarDelegate* delegate); + BeforeTranslateInfoBar(TabContentsWrapper* owner, + TranslateInfoBarDelegate* delegate); private: virtual ~BeforeTranslateInfoBar(); diff --git a/chrome/browser/ui/views/infobars/confirm_infobar.cc b/chrome/browser/ui/views/infobars/confirm_infobar.cc index 8ed7132b..dc6ba1a 100644 --- a/chrome/browser/ui/views/infobars/confirm_infobar.cc +++ b/chrome/browser/ui/views/infobars/confirm_infobar.cc @@ -12,14 +12,15 @@ // ConfirmInfoBarDelegate ----------------------------------------------------- -InfoBar* ConfirmInfoBarDelegate::CreateInfoBar() { - return new ConfirmInfoBar(this); +InfoBar* ConfirmInfoBarDelegate::CreateInfoBar(TabContentsWrapper* owner) { + return new ConfirmInfoBar(owner, this); } // ConfirmInfoBar ------------------------------------------------------------- -ConfirmInfoBar::ConfirmInfoBar(ConfirmInfoBarDelegate* delegate) - : InfoBarView(delegate), +ConfirmInfoBar::ConfirmInfoBar(TabContentsWrapper* owner, + ConfirmInfoBarDelegate* delegate) + : InfoBarView(owner, delegate), label_(NULL), ok_button_(NULL), cancel_button_(NULL), diff --git a/chrome/browser/ui/views/infobars/confirm_infobar.h b/chrome/browser/ui/views/infobars/confirm_infobar.h index ef2d37d..52dff90 100644 --- a/chrome/browser/ui/views/infobars/confirm_infobar.h +++ b/chrome/browser/ui/views/infobars/confirm_infobar.h @@ -24,7 +24,7 @@ class TextButton; class ConfirmInfoBar : public InfoBarView, public views::LinkListener { public: - explicit ConfirmInfoBar(ConfirmInfoBarDelegate* delegate); + ConfirmInfoBar(TabContentsWrapper* owner, ConfirmInfoBarDelegate* delegate); private: virtual ~ConfirmInfoBar(); diff --git a/chrome/browser/ui/views/infobars/extension_infobar.cc b/chrome/browser/ui/views/infobars/extension_infobar.cc index 6892509..05fe88a 100644 --- a/chrome/browser/ui/views/infobars/extension_infobar.cc +++ b/chrome/browser/ui/views/infobars/extension_infobar.cc @@ -23,8 +23,8 @@ // ExtensionInfoBarDelegate --------------------------------------------------- -InfoBar* ExtensionInfoBarDelegate::CreateInfoBar() { - return new ExtensionInfoBar(this); +InfoBar* ExtensionInfoBarDelegate::CreateInfoBar(TabContentsWrapper* owner) { + return new ExtensionInfoBar(owner, this); } // ExtensionInfoBar ----------------------------------------------------------- @@ -34,8 +34,9 @@ namespace { static const int kMenuHorizontalMargin = 1; }; -ExtensionInfoBar::ExtensionInfoBar(ExtensionInfoBarDelegate* delegate) - : InfoBarView(delegate), +ExtensionInfoBar::ExtensionInfoBar(TabContentsWrapper* owner, + ExtensionInfoBarDelegate* delegate) + : InfoBarView(owner, delegate), delegate_(delegate), menu_(NULL), ALLOW_THIS_IN_INITIALIZER_LIST(tracker_(this)) { diff --git a/chrome/browser/ui/views/infobars/extension_infobar.h b/chrome/browser/ui/views/infobars/extension_infobar.h index 67dc3dd..69d3c5c 100644 --- a/chrome/browser/ui/views/infobars/extension_infobar.h +++ b/chrome/browser/ui/views/infobars/extension_infobar.h @@ -13,6 +13,7 @@ #include "views/controls/menu/view_menu_delegate.h" class ExtensionContextMenuModel; +class TabContentsWrapper; namespace views { class MenuButton; class Menu2; @@ -24,7 +25,8 @@ class ExtensionInfoBar : public InfoBarView, public ExtensionInfoBarDelegate::DelegateObserver, public views::ViewMenuDelegate { public: - explicit ExtensionInfoBar(ExtensionInfoBarDelegate* delegate); + ExtensionInfoBar(TabContentsWrapper* owner, + ExtensionInfoBarDelegate* delegate); private: virtual ~ExtensionInfoBar(); diff --git a/chrome/browser/ui/views/infobars/infobar.cc b/chrome/browser/ui/views/infobars/infobar.cc deleted file mode 100644 index e31b161..0000000 --- a/chrome/browser/ui/views/infobars/infobar.cc +++ /dev/null @@ -1,143 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/ui/views/infobars/infobar.h" - -#include <cmath> - -#include "ui/base/animation/slide_animation.h" -#include "chrome/browser/tab_contents/infobar_delegate.h" -#include "chrome/browser/ui/views/infobars/infobar_container.h" - -InfoBar::InfoBar(InfoBarDelegate* delegate) - : delegate_(delegate), - container_(NULL), - ALLOW_THIS_IN_INITIALIZER_LIST(animation_(new ui::SlideAnimation(this))), - arrow_height_(0), - arrow_target_height_(kDefaultArrowTargetHeight), - arrow_half_width_(0), - bar_height_(0), - bar_target_height_(kDefaultBarTargetHeight) { - DCHECK(delegate != NULL); - animation_->SetTweenType(ui::Tween::LINEAR); -} - -InfoBar::~InfoBar() { -} - -void InfoBar::Show(bool animate) { - if (animate) { - animation_->Show(); - } else { - animation_->Reset(1.0); - AnimationEnded(NULL); - } -} - -void InfoBar::Hide(bool animate) { - PlatformSpecificHide(animate); - if (animate) { - animation_->Hide(); - } else { - animation_->Reset(0.0); - AnimationEnded(NULL); - } -} - -void InfoBar::SetArrowTargetHeight(int height) { - DCHECK_LE(height, kMaximumArrowTargetHeight); - // Once the closing animation starts, we ignore further requests to change the - // target height. - if ((arrow_target_height_ != height) && !animation()->IsClosing()) { - arrow_target_height_ = height; - RecalculateHeights(false); - } -} - -void InfoBar::AnimationProgressed(const ui::Animation* animation) { - RecalculateHeights(false); -} - -void InfoBar::RemoveInfoBar() { - if (container_) - container_->RemoveDelegate(delegate_); -} - -void InfoBar::SetBarTargetHeight(int height) { - if (bar_target_height_ != height) { - bar_target_height_ = height; - RecalculateHeights(false); - } -} - -int InfoBar::OffsetY(const gfx::Size& prefsize) const { - return arrow_height_ + - std::max((bar_target_height_ - prefsize.height()) / 2, 0) - - (bar_target_height_ - bar_height_); -} - -void InfoBar::AnimationEnded(const ui::Animation* animation) { - // When the animation ends, we must ensure the container is notified even if - // the heights haven't changed, lest it never get an "animation finished" - // notification. (If the browser doesn't get this notification, it will not - // bother to re-layout the content area for the new infobar size.) - RecalculateHeights(true); - MaybeDelete(); -} - -void InfoBar::RecalculateHeights(bool force_notify) { - int old_arrow_height = arrow_height_; - int old_bar_height = bar_height_; - - // Find the desired arrow height/half-width. The arrow area is - // |arrow_height_| * |arrow_half_width_|. When the bar is opening or closing, - // scaling each of these with the square root of the animation value causes a - // linear animation of the area, which matches the perception of the animation - // of the bar portion. - double scale_factor = sqrt(animation()->GetCurrentValue()); - arrow_height_ = static_cast<int>(arrow_target_height_ * scale_factor); - if (animation_->is_animating()) { - arrow_half_width_ = static_cast<int>(std::min(arrow_target_height_, - kMaximumArrowTargetHalfWidth) * scale_factor); - } else { - // When the infobar is not animating (i.e. fully open), we set the - // half-width to be proportionally the same distance between its default and - // maximum values as the height is between its. - arrow_half_width_ = kDefaultArrowTargetHalfWidth + - ((kMaximumArrowTargetHalfWidth - kDefaultArrowTargetHalfWidth) * - ((arrow_height_ - kDefaultArrowTargetHeight) / - (kMaximumArrowTargetHeight - kDefaultArrowTargetHeight))); - } - // Add pixels for the stroke, if the arrow is to be visible at all. Without - // this, changing the arrow height from 0 to kSeparatorLineHeight would - // produce no visible effect, because the stroke would paint atop the divider - // line above the infobar. - if (arrow_height_) - arrow_height_ += kSeparatorLineHeight; - - bar_height_ = - static_cast<int>(bar_target_height_ * animation()->GetCurrentValue()); - - // Don't re-layout if nothing has changed, e.g. because the animation step was - // not large enough to actually change the heights by at least a pixel. - bool heights_differ = - (old_arrow_height != arrow_height_) || (old_bar_height != bar_height_); - if (heights_differ) - PlatformSpecificOnHeightsRecalculated(); - - if (container_ && (heights_differ || force_notify)) - container_->OnInfoBarStateChanged(animation_->is_animating()); -} - -void InfoBar::MaybeDelete() { - if (delegate_ && (animation_->GetCurrentValue() == 0.0)) { - if (container_) - container_->RemoveInfoBar(this); - // Note that we only tell the delegate we're closed here, and not when we're - // simply destroyed (by virtue of a tab switch or being moved from window to - // window), since this action can cause the delegate to destroy itself. - delegate_->InfoBarClosed(); - delegate_ = NULL; - } -} diff --git a/chrome/browser/ui/views/infobars/infobar.h b/chrome/browser/ui/views/infobars/infobar.h deleted file mode 100644 index cb4aef7..0000000 --- a/chrome/browser/ui/views/infobars/infobar.h +++ /dev/null @@ -1,115 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_UI_VIEWS_INFOBARS_INFOBAR_H_ -#define CHROME_BROWSER_UI_VIEWS_INFOBARS_INFOBAR_H_ -#pragma once - -#include "base/basictypes.h" -#include "base/scoped_ptr.h" -#include "ui/base/animation/animation_delegate.h" -#include "ui/gfx/size.h" - -class InfoBarContainer; -class InfoBarDelegate; - -namespace ui { -class SlideAnimation; -} - -class InfoBar : public ui::AnimationDelegate { - public: - explicit InfoBar(InfoBarDelegate* delegate); - virtual ~InfoBar(); - - // Platforms must define these. - static const int kSeparatorLineHeight; - static const int kDefaultArrowTargetHeight; - static const int kMaximumArrowTargetHeight; - // The half-width (see comments on |arrow_half_width_| below) scales to its - // default and maximum values proportionally to how the height scales to its. - static const int kDefaultArrowTargetHalfWidth; - static const int kMaximumArrowTargetHalfWidth; - - InfoBarDelegate* delegate() { return delegate_; } - void set_container(InfoBarContainer* container) { container_ = container; } - - // Makes the infobar visible. If |animate| is true, the infobar is then - // animated to full size. - void Show(bool animate); - - // Makes the infobar hidden. If |animate| is true, the infobar is first - // animated to zero size. Once the infobar is hidden, it is removed from its - // container (triggering its deletion), and its delegate is closed. - void Hide(bool animate); - - // Changes the target height of the arrow portion of the infobar. This has no - // effect once the infobar is animating closed. - void SetArrowTargetHeight(int height); - - const ui::SlideAnimation* animation() const { return animation_.get(); } - int arrow_height() const { return arrow_height_; } - int total_height() const { return arrow_height_ + bar_height_; } - - protected: - // Platforms must define this. - static const int kDefaultBarTargetHeight; - - // ui::AnimationDelegate: - virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; - - // Called when the user closes the infobar, notifies the delegate we've been - // dismissed and forwards a removal request to our owner. - void RemoveInfoBar(); - - // Changes the target height of the main ("bar") portion of the infobar. - void SetBarTargetHeight(int height); - - // Given a control with size |prefsize|, returns the centered y position - // within us, taking into account animation so the control "slides in" (or - // out) as we animate open and closed. - int OffsetY(const gfx::Size& prefsize) const; - - const InfoBarContainer* container() const { return container_; } - ui::SlideAnimation* animation() { return animation_.get(); } - int arrow_half_width() const { return arrow_half_width_; } - int bar_height() const { return bar_height_; } - - // Platforms may optionally override these if they need to do work during - // processing of the given calls. - virtual void PlatformSpecificHide(bool animate) {} - virtual void PlatformSpecificOnHeightsRecalculated() {} - - private: - // ui::AnimationDelegate: - virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; - - // Finds the new desired arrow and bar heights, and if they differ from the - // current ones, calls PlatformSpecificOnHeightRecalculated(). Informs our - // container our state has changed if either the heights have changed or - // |force_notify| is set. - void RecalculateHeights(bool force_notify); - - // Checks whether we're closed. If so, notifies the container that it should - // remove us (which will cause the platform-specific code to asynchronously - // delete us) and closes the delegate. - void MaybeDelete(); - - InfoBarDelegate* delegate_; - InfoBarContainer* container_; - scoped_ptr<ui::SlideAnimation> animation_; - - // The current and target heights of the arrow and bar portions, and half the - // current arrow width. (It's easier to work in half-widths as we draw the - // arrow as two halves on either side of a center point.) - int arrow_height_; // Includes both fill and top stroke. - int arrow_target_height_; - int arrow_half_width_; // Includes only fill. - int bar_height_; // Includes both fill and bottom separator. - int bar_target_height_; - - DISALLOW_COPY_AND_ASSIGN(InfoBar); -}; - -#endif // CHROME_BROWSER_UI_VIEWS_INFOBARS_INFOBAR_H_ diff --git a/chrome/browser/ui/views/infobars/infobar_container.cc b/chrome/browser/ui/views/infobars/infobar_container.cc deleted file mode 100644 index 4fe550c..0000000 --- a/chrome/browser/ui/views/infobars/infobar_container.cc +++ /dev/null @@ -1,198 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/ui/views/infobars/infobar_container.h" - -#include "chrome/browser/tab_contents/infobar_delegate.h" -#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" -#include "chrome/browser/ui/views/infobars/infobar.h" -#include "content/common/notification_details.h" -#include "content/common/notification_source.h" -#include "ui/base/animation/slide_animation.h" - -InfoBarContainer::Delegate::~Delegate() { -} - -InfoBarContainer::InfoBarContainer(Delegate* delegate) - : delegate_(delegate), - tab_contents_(NULL), - top_arrow_target_height_(InfoBar::kDefaultArrowTargetHeight) { -} - -InfoBarContainer::~InfoBarContainer() { - // RemoveAllInfoBarsForDestruction() should have already cleared our infobars. - DCHECK(infobars_.empty()); -} - -void InfoBarContainer::ChangeTabContents(TabContentsWrapper* contents) { - registrar_.RemoveAll(); - - while (!infobars_.empty()) { - InfoBar* infobar = infobars_.front(); - // NULL the container pointer first so that if the infobar is currently - // animating, OnInfoBarAnimated() won't get called; we'll manually trigger - // this once for the whole set of changes below. This also prevents - // InfoBar::MaybeDelete() from calling RemoveInfoBar() a second time if the - // infobar happens to be at zero height (dunno if this can actually happen). - infobar->set_container(NULL); - RemoveInfoBar(infobar); - } - - tab_contents_ = contents; - if (tab_contents_) { - Source<TabContents> tc_source(tab_contents_->tab_contents()); - registrar_.Add(this, NotificationType::TAB_CONTENTS_INFOBAR_ADDED, - tc_source); - registrar_.Add(this, NotificationType::TAB_CONTENTS_INFOBAR_REMOVED, - tc_source); - registrar_.Add(this, NotificationType::TAB_CONTENTS_INFOBAR_REPLACED, - tc_source); - - for (size_t i = 0; i < contents->infobar_count(); ++i) { - // As when we removed the infobars above, we prevent callbacks to - // OnInfoBarAnimated() for each infobar. - AddInfoBar(tab_contents_->GetInfoBarDelegateAt(i)->CreateInfoBar(), false, - NO_CALLBACK); - } - } - - // Now that everything is up to date, signal the delegate to re-layout. - OnInfoBarStateChanged(false); -} - -int InfoBarContainer::GetVerticalOverlap(int* total_height) { - // Our |total_height| is the sum of the preferred heights of the InfoBars - // contained within us plus the |vertical_overlap|. - int vertical_overlap = 0; - int next_infobar_y = 0; - - for (InfoBars::iterator i(infobars_.begin()); i != infobars_.end(); ++i) { - InfoBar* infobar = *i; - next_infobar_y -= infobar->arrow_height(); - vertical_overlap = std::max(vertical_overlap, -next_infobar_y); - next_infobar_y += infobar->total_height(); - } - - if (total_height) - *total_height = next_infobar_y + vertical_overlap; - return vertical_overlap; -} - -void InfoBarContainer::SetMaxTopArrowHeight(int height) { - // Decrease the height by the arrow stroke thickness, which is the separator - // line height, because the infobar arrow target heights are without-stroke. - top_arrow_target_height_ = std::min( - std::max(height - InfoBar::kSeparatorLineHeight, 0), - InfoBar::kMaximumArrowTargetHeight); - UpdateInfoBarArrowTargetHeights(); -} - -void InfoBarContainer::OnInfoBarStateChanged(bool is_animating) { - if (delegate_) - delegate_->InfoBarContainerStateChanged(is_animating); -} - -void InfoBarContainer::RemoveDelegate(InfoBarDelegate* delegate) { - tab_contents_->RemoveInfoBar(delegate); -} - -void InfoBarContainer::RemoveInfoBar(InfoBar* infobar) { - InfoBars::iterator infobar_iterator(std::find(infobars_.begin(), - infobars_.end(), infobar)); - DCHECK(infobar_iterator != infobars_.end()); - PlatformSpecificRemoveInfoBar(infobar); - infobars_.erase(infobar_iterator); -} - -void InfoBarContainer::RemoveAllInfoBarsForDestruction() { - // Before we remove any children, we reset |delegate_|, so that no removals - // will result in us trying to call - // delegate_->InfoBarContainerStateChanged(). This is important because at - // this point |delegate_| may be shutting down, and it's at best unimportant - // and at worst disastrous to call that. - delegate_ = NULL; - ChangeTabContents(NULL); -} - -void InfoBarContainer::Observe(NotificationType type, - const NotificationSource& source, - const NotificationDetails& details) { - switch (type.value) { - case NotificationType::TAB_CONTENTS_INFOBAR_ADDED: - AddInfoBar(Details<InfoBarDelegate>(details)->CreateInfoBar(), true, - WANT_CALLBACK); - break; - - case NotificationType::TAB_CONTENTS_INFOBAR_REMOVED: - RemoveInfoBar(Details<InfoBarDelegate>(details).ptr(), true); - break; - - case NotificationType::TAB_CONTENTS_INFOBAR_REPLACED: { - typedef std::pair<InfoBarDelegate*, InfoBarDelegate*> InfoBarPair; - InfoBarPair* infobar_pair = Details<InfoBarPair>(details).ptr(); - RemoveInfoBar(infobar_pair->first, false); - AddInfoBar(infobar_pair->second->CreateInfoBar(), false, WANT_CALLBACK); - break; - } - - default: - NOTREACHED(); - break; - } -} - -void InfoBarContainer::RemoveInfoBar(InfoBarDelegate* delegate, - bool use_animation) { - // Search for the infobar associated with |delegate|. We cannot search for - // |delegate| in |tab_contents_|, because an InfoBar remains alive until its - // close animation completes, while the delegate is removed from the tab - // immediately. - for (InfoBars::iterator i(infobars_.begin()); i != infobars_.end(); ++i) { - InfoBar* infobar = *i; - if (infobar->delegate() == delegate) { - // We merely need hide the infobar; it will call back to RemoveInfoBar() - // itself once it's hidden. - infobar->Hide(use_animation); - UpdateInfoBarArrowTargetHeights(); - break; - } - } -} - -void InfoBarContainer::AddInfoBar(InfoBar* infobar, - bool animate, - CallbackStatus callback_status) { - DCHECK(std::find(infobars_.begin(), infobars_.end(), infobar) == - infobars_.end()); - infobars_.push_back(infobar); - UpdateInfoBarArrowTargetHeights(); - PlatformSpecificAddInfoBar(infobar); - if (callback_status == WANT_CALLBACK) - infobar->set_container(this); - infobar->Show(animate); - if (callback_status == NO_CALLBACK) - infobar->set_container(this); -} - -void InfoBarContainer::UpdateInfoBarArrowTargetHeights() { - for (size_t i = 0; i < infobars_.size(); ++i) - infobars_[i]->SetArrowTargetHeight(ArrowTargetHeightForInfoBar(i)); -} - -int InfoBarContainer::ArrowTargetHeightForInfoBar(size_t infobar_index) const { - if (!delegate_->DrawInfoBarArrows(NULL)) - return 0; - if (infobar_index == 0) - return top_arrow_target_height_; - const ui::SlideAnimation* first_infobar_animation = - const_cast<const InfoBar*>(infobars_.front())->animation(); - if ((infobar_index > 1) || first_infobar_animation->IsShowing()) - return InfoBar::kDefaultArrowTargetHeight; - // When the first infobar is animating closed, we animate the second infobar's - // arrow target height from the default to the top target height. Note that - // the animation values here are going from 1.0 -> 0.0 as the top bar closes. - return top_arrow_target_height_ + static_cast<int>( - (InfoBar::kDefaultArrowTargetHeight - top_arrow_target_height_) * - first_infobar_animation->GetCurrentValue()); -} diff --git a/chrome/browser/ui/views/infobars/infobar_container.h b/chrome/browser/ui/views/infobars/infobar_container.h deleted file mode 100644 index 312140c..0000000 --- a/chrome/browser/ui/views/infobars/infobar_container.h +++ /dev/null @@ -1,136 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_UI_VIEWS_INFOBARS_INFOBAR_CONTAINER_H_ -#define CHROME_BROWSER_UI_VIEWS_INFOBARS_INFOBAR_CONTAINER_H_ -#pragma once - -#include <vector> - -#include "base/compiler_specific.h" -#include "content/common/notification_observer.h" -#include "content/common/notification_registrar.h" -#include "third_party/skia/include/core/SkColor.h" - -class InfoBar; -class InfoBarDelegate; -class TabContents; -class TabContentsWrapper; - -// InfoBarContainer is a cross-platform base class to handle the visibility- -// related aspects of InfoBars. While InfoBars own themselves, the -// InfoBarContainer is responsible for telling particular InfoBars that they -// should be hidden or visible. -// -// Platforms need to subclass this to implement a few platform-specific -// functions, which are pure virtual here. -class InfoBarContainer : public NotificationObserver { - public: - class Delegate { - public: - // The separator color may vary depending on where the container is hosted. - virtual SkColor GetInfoBarSeparatorColor() const = 0; - - // The delegate is notified each time the infobar container changes height, - // as well as when it stops animating. - virtual void InfoBarContainerStateChanged(bool is_animating) = 0; - - // The delegate needs to tell us whether "unspoofable" arrows should be - // drawn, and if so, at what |x| coordinate. |x| may be NULL. - virtual bool DrawInfoBarArrows(int* x) const = 0; - - protected: - virtual ~Delegate(); - }; - - explicit InfoBarContainer(Delegate* delegate); - virtual ~InfoBarContainer(); - - // Changes the TabContents for which this container is showing infobars. This - // will remove all current infobars from the container, add the infobars from - // |contents|, and show them all. |contents| may be NULL. - void ChangeTabContents(TabContentsWrapper* contents); - - // Returns the amount by which to overlap the toolbar above, and, when - // |total_height| is non-NULL, set it to the height of the InfoBarContainer - // (including overlap). - int GetVerticalOverlap(int* total_height); - - // Called by the delegate when the distance between what the top infobar's - // "unspoofable" arrow would point to and the top infobar itself changes. - // This enables the top infobar to show a longer arrow (e.g. because of a - // visible bookmark bar) or shorter (e.g. due to being in a popup window) if - // desired. - // - // IMPORTANT: This MUST NOT result in a call back to - // Delegate::InfoBarContainerStateChanged() unless it causes an actual - // change, lest we infinitely recurse. - void SetMaxTopArrowHeight(int height); - - // Called when a contained infobar has animated or by some other means changed - // its height, or when it stops animating. The container is expected to do - // anything necessary to respond, e.g. re-layout. - void OnInfoBarStateChanged(bool is_animating); - - // Removes the specified InfoBarDelegate from the selected TabContents. This - // will notify us back and cause us to close the InfoBar. This is called from - // the InfoBar's close button handler. - void RemoveDelegate(InfoBarDelegate* delegate); - - // Called by |infobar| to request that it be removed from the container, as it - // is about to delete itself. At this point, |infobar| should already be - // hidden. - void RemoveInfoBar(InfoBar* infobar); - - const Delegate* delegate() const { return delegate_; } - - protected: - // Subclasses must call this during destruction, so that we can remove - // infobars (which will call the pure virtual functions below) while the - // subclass portion of |this| has not yet been destroyed. - void RemoveAllInfoBarsForDestruction(); - - // These must be implemented on each platform to e.g. adjust the visible - // object hierarchy. - virtual void PlatformSpecificAddInfoBar(InfoBar* infobar) = 0; - virtual void PlatformSpecificRemoveInfoBar(InfoBar* infobar) = 0; - - private: - typedef std::vector<InfoBar*> InfoBars; - - // NotificationObserver: - virtual void Observe(NotificationType type, - const NotificationSource& source, - const NotificationDetails& details) OVERRIDE; - - // Removes an InfoBar for the specified delegate, in response to a - // notification from the selected TabContents. The InfoBar's disappearance - // will be animated if |use_animation| is true. - void RemoveInfoBar(InfoBarDelegate* delegate, bool use_animation); - - // Adds |infobar| to this container and calls Show() on it. |animate| is - // passed along to infobar->Show(). Depending on the value of - // |callback_status|, this calls infobar->set_container(this) either before or - // after the call to Show() so that OnInfoBarAnimated() either will or won't - // be called as a result. - enum CallbackStatus { NO_CALLBACK, WANT_CALLBACK }; - void AddInfoBar(InfoBar* infobar, - bool animate, - CallbackStatus callback_status); - - void UpdateInfoBarArrowTargetHeights(); - int ArrowTargetHeightForInfoBar(size_t infobar_index) const; - - NotificationRegistrar registrar_; - Delegate* delegate_; - TabContentsWrapper* tab_contents_; - InfoBars infobars_; - - // Calculated in SetMaxTopArrowHeight(). - int top_arrow_target_height_; - - DISALLOW_COPY_AND_ASSIGN(InfoBarContainer); -}; - -#endif // CHROME_BROWSER_UI_VIEWS_INFOBARS_INFOBAR_CONTAINER_H_ diff --git a/chrome/browser/ui/views/infobars/infobar_container_view.h b/chrome/browser/ui/views/infobars/infobar_container_view.h index 1cac809..d6b937d 100644 --- a/chrome/browser/ui/views/infobars/infobar_container_view.h +++ b/chrome/browser/ui/views/infobars/infobar_container_view.h @@ -6,8 +6,8 @@ #define CHROME_BROWSER_UI_VIEWS_INFOBARS_INFOBAR_CONTAINER_VIEW_H_ #pragma once +#include "chrome/browser/tab_contents/infobar_container.h" #include "chrome/browser/ui/views/accessible_pane_view.h" -#include "chrome/browser/ui/views/infobars/infobar_container.h" // The views-specific implementation of InfoBarContainer. class InfoBarContainerView : public AccessiblePaneView, diff --git a/chrome/browser/ui/views/infobars/infobar_view.cc b/chrome/browser/ui/views/infobars/infobar_view.cc index bb88b34..c947249 100644 --- a/chrome/browser/ui/views/infobars/infobar_view.cc +++ b/chrome/browser/ui/views/infobars/infobar_view.cc @@ -56,8 +56,8 @@ const int InfoBarView::kButtonButtonSpacing = 10; const int InfoBarView::kEndOfLabelSpacing = 16; const int InfoBarView::kHorizontalPadding = 6; -InfoBarView::InfoBarView(InfoBarDelegate* delegate) - : InfoBar(delegate), +InfoBarView::InfoBarView(TabContentsWrapper* owner, InfoBarDelegate* delegate) + : InfoBar(owner, delegate), icon_(NULL), close_button_(NULL), ALLOW_THIS_IN_INITIALIZER_LIST(delete_factory_(this)), diff --git a/chrome/browser/ui/views/infobars/infobar_view.h b/chrome/browser/ui/views/infobars/infobar_view.h index 13596c5..82c0c8a 100644 --- a/chrome/browser/ui/views/infobars/infobar_view.h +++ b/chrome/browser/ui/views/infobars/infobar_view.h @@ -7,9 +7,9 @@ #pragma once #include "base/task.h" -#include "chrome/browser/ui/views/infobars/infobar.h" +#include "chrome/browser/tab_contents/infobar.h" +#include "chrome/browser/tab_contents/infobar_container.h" #include "chrome/browser/ui/views/infobars/infobar_background.h" -#include "chrome/browser/ui/views/infobars/infobar_container.h" #include "views/controls/button/button.h" #include "views/focus/focus_manager.h" @@ -32,7 +32,7 @@ class InfoBarView : public InfoBar, public views::ButtonListener, public views::FocusChangeListener { public: - explicit InfoBarView(InfoBarDelegate* delegate); + InfoBarView(TabContentsWrapper* owner, InfoBarDelegate* delegate); SkPath* fill_path() const { return fill_path_.get(); } SkPath* stroke_path() const { return stroke_path_.get(); } diff --git a/chrome/browser/ui/views/infobars/link_infobar.cc b/chrome/browser/ui/views/infobars/link_infobar.cc index accaeb6..a923648 100644 --- a/chrome/browser/ui/views/infobars/link_infobar.cc +++ b/chrome/browser/ui/views/infobars/link_infobar.cc @@ -11,14 +11,15 @@ // LinkInfoBarDelegate -------------------------------------------------------- -InfoBar* LinkInfoBarDelegate::CreateInfoBar() { - return new LinkInfoBar(this); +InfoBar* LinkInfoBarDelegate::CreateInfoBar(TabContentsWrapper* owner) { + return new LinkInfoBar(owner, this); } // LinkInfoBar ---------------------------------------------------------------- -LinkInfoBar::LinkInfoBar(LinkInfoBarDelegate* delegate) - : InfoBarView(delegate), +LinkInfoBar::LinkInfoBar(TabContentsWrapper* owner, + LinkInfoBarDelegate* delegate) + : InfoBarView(owner, delegate), label_1_(NULL), link_(NULL), label_2_(NULL) { diff --git a/chrome/browser/ui/views/infobars/link_infobar.h b/chrome/browser/ui/views/infobars/link_infobar.h index 99e5d9d..18e49f8 100644 --- a/chrome/browser/ui/views/infobars/link_infobar.h +++ b/chrome/browser/ui/views/infobars/link_infobar.h @@ -17,7 +17,7 @@ class LinkInfoBarDelegate; class LinkInfoBar : public InfoBarView, public views::LinkListener { public: - explicit LinkInfoBar(LinkInfoBarDelegate* delegate); + LinkInfoBar(TabContentsWrapper* owner, LinkInfoBarDelegate* delegate); private: virtual ~LinkInfoBar(); diff --git a/chrome/browser/ui/views/infobars/translate_infobar_base.cc b/chrome/browser/ui/views/infobars/translate_infobar_base.cc index f687e11..b20112a 100644 --- a/chrome/browser/ui/views/infobars/translate_infobar_base.cc +++ b/chrome/browser/ui/views/infobars/translate_infobar_base.cc @@ -19,18 +19,18 @@ // TranslateInfoBarDelegate --------------------------------------------------- -InfoBar* TranslateInfoBarDelegate::CreateInfoBar() { +InfoBar* TranslateInfoBarDelegate::CreateInfoBar(TabContentsWrapper* owner) { TranslateInfoBarBase* infobar = NULL; switch (type_) { case BEFORE_TRANSLATE: - infobar = new BeforeTranslateInfoBar(this); + infobar = new BeforeTranslateInfoBar(owner, this); break; case AFTER_TRANSLATE: - infobar = new AfterTranslateInfoBar(this); + infobar = new AfterTranslateInfoBar(owner, this); break; case TRANSLATING: case TRANSLATION_ERROR: - infobar = new TranslateMessageInfoBar(this); + infobar = new TranslateMessageInfoBar(owner, this); break; default: NOTREACHED(); @@ -44,8 +44,9 @@ InfoBar* TranslateInfoBarDelegate::CreateInfoBar() { // static const int TranslateInfoBarBase::kButtonInLabelSpacing = 5; -TranslateInfoBarBase::TranslateInfoBarBase(TranslateInfoBarDelegate* delegate) - : InfoBarView(delegate), +TranslateInfoBarBase::TranslateInfoBarBase(TabContentsWrapper* owner, + TranslateInfoBarDelegate* delegate) + : InfoBarView(owner, delegate), error_background_(InfoBarDelegate::WARNING_TYPE) { } diff --git a/chrome/browser/ui/views/infobars/translate_infobar_base.h b/chrome/browser/ui/views/infobars/translate_infobar_base.h index 4a6923d..30865e8 100644 --- a/chrome/browser/ui/views/infobars/translate_infobar_base.h +++ b/chrome/browser/ui/views/infobars/translate_infobar_base.h @@ -22,7 +22,8 @@ class MenuButton; class TranslateInfoBarBase : public TranslateInfoBarView, public InfoBarView { public: - explicit TranslateInfoBarBase(TranslateInfoBarDelegate* delegate); + TranslateInfoBarBase(TabContentsWrapper* owner, + TranslateInfoBarDelegate* delegate); virtual ~TranslateInfoBarBase(); protected: diff --git a/chrome/browser/ui/views/infobars/translate_message_infobar.cc b/chrome/browser/ui/views/infobars/translate_message_infobar.cc index f31e3b6..7a70485 100644 --- a/chrome/browser/ui/views/infobars/translate_message_infobar.cc +++ b/chrome/browser/ui/views/infobars/translate_message_infobar.cc @@ -9,8 +9,9 @@ #include "views/controls/label.h" TranslateMessageInfoBar::TranslateMessageInfoBar( + TabContentsWrapper* owner, TranslateInfoBarDelegate* delegate) - : TranslateInfoBarBase(delegate), + : TranslateInfoBarBase(owner, delegate), label_(NULL), button_(NULL) { } diff --git a/chrome/browser/ui/views/infobars/translate_message_infobar.h b/chrome/browser/ui/views/infobars/translate_message_infobar.h index c6a27fe..a70fd8d 100644 --- a/chrome/browser/ui/views/infobars/translate_message_infobar.h +++ b/chrome/browser/ui/views/infobars/translate_message_infobar.h @@ -10,7 +10,8 @@ class TranslateMessageInfoBar : public TranslateInfoBarBase { public: - explicit TranslateMessageInfoBar(TranslateInfoBarDelegate* delegate); + TranslateMessageInfoBar(TabContentsWrapper* owner, + TranslateInfoBarDelegate* delegate); private: virtual ~TranslateMessageInfoBar(); |