1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_VIEWS_INFOBARS_TRANSLATE_INFOBAR_BASE_H_
6 #define CHROME_BROWSER_UI_VIEWS_INFOBARS_TRANSLATE_INFOBAR_BASE_H_
8 #include "base/compiler_specific.h"
9 #include "chrome/browser/ui/views/infobars/infobar_background.h"
10 #include "chrome/browser/ui/views/infobars/infobar_view.h"
12 class TranslateInfoBarDelegate;
18 // This class contains some of the base functionality that translate infobars
20 class TranslateInfoBarBase : public InfoBarView {
22 // Sets the text of the provided language menu button.
23 void UpdateLanguageButtonText(views::MenuButton* button,
24 const string16& text);
27 TranslateInfoBarBase(InfoBarService* owner,
28 TranslateInfoBarDelegate* delegate);
29 virtual ~TranslateInfoBarBase();
32 virtual void ViewHierarchyChanged(
33 const ViewHierarchyChangedDetails& details) OVERRIDE;
35 // Convenience to retrieve the TranslateInfoBarDelegate for this infobar.
36 TranslateInfoBarDelegate* GetDelegate();
38 static const int kButtonInLabelSpacing;
42 virtual void OnPaintBackground(gfx::Canvas* canvas) OVERRIDE;
43 virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE;
45 // Returns the background that should be displayed when not animating.
46 const views::Background& GetBackground();
48 // Paints |background| to |canvas| with the opacity level based on
50 void FadeBackground(gfx::Canvas* canvas,
51 double animation_value,
52 const views::Background& background);
54 InfoBarBackground error_background_;
55 scoped_ptr<gfx::SlideAnimation> background_color_animation_;
57 DISALLOW_COPY_AND_ASSIGN(TranslateInfoBarBase);
60 #endif // CHROME_BROWSER_UI_VIEWS_INFOBARS_TRANSLATE_INFOBAR_BASE_H_