| OLD | NEW |
| (Empty) |
| 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. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_UI_VIEWS_INFOBARS_TRANSLATE_INFOBAR_BASE_H_ | |
| 6 #define CHROME_BROWSER_UI_VIEWS_INFOBARS_TRANSLATE_INFOBAR_BASE_H_ | |
| 7 | |
| 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" | |
| 11 | |
| 12 class TranslateInfoBarDelegate; | |
| 13 | |
| 14 namespace views { | |
| 15 class MenuButton; | |
| 16 } | |
| 17 | |
| 18 // This class contains some of the base functionality that translate infobars | |
| 19 // use. | |
| 20 class TranslateInfoBarBase : public InfoBarView { | |
| 21 public: | |
| 22 // Sets the text of the provided language menu button. | |
| 23 void UpdateLanguageButtonText(views::MenuButton* button, | |
| 24 const base::string16& text); | |
| 25 | |
| 26 protected: | |
| 27 explicit TranslateInfoBarBase(scoped_ptr<TranslateInfoBarDelegate> delegate); | |
| 28 virtual ~TranslateInfoBarBase(); | |
| 29 | |
| 30 // InfoBarView: | |
| 31 virtual void ViewHierarchyChanged( | |
| 32 const ViewHierarchyChangedDetails& details) OVERRIDE; | |
| 33 | |
| 34 // Convenience to retrieve the TranslateInfoBarDelegate for this infobar. | |
| 35 TranslateInfoBarDelegate* GetDelegate(); | |
| 36 | |
| 37 static const int kButtonInLabelSpacing; | |
| 38 | |
| 39 private: | |
| 40 // InfoBarView: | |
| 41 virtual void OnPaintBackground(gfx::Canvas* canvas) OVERRIDE; | |
| 42 virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE; | |
| 43 | |
| 44 // Returns the background that should be displayed when not animating. | |
| 45 const views::Background& GetBackground(); | |
| 46 | |
| 47 // Paints |background| to |canvas| with the opacity level based on | |
| 48 // |animation_value|. | |
| 49 void FadeBackground(gfx::Canvas* canvas, | |
| 50 double animation_value, | |
| 51 const views::Background& background); | |
| 52 | |
| 53 InfoBarBackground error_background_; | |
| 54 scoped_ptr<gfx::SlideAnimation> background_color_animation_; | |
| 55 | |
| 56 DISALLOW_COPY_AND_ASSIGN(TranslateInfoBarBase); | |
| 57 }; | |
| 58 | |
| 59 #endif // CHROME_BROWSER_UI_VIEWS_INFOBARS_TRANSLATE_INFOBAR_BASE_H_ | |
| OLD | NEW |