| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_UI_VIEWS_INFOBARS_TRANSLATE_INFOBAR_BASE_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_INFOBARS_TRANSLATE_INFOBAR_BASE_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_INFOBARS_TRANSLATE_INFOBAR_BASE_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_INFOBARS_TRANSLATE_INFOBAR_BASE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "chrome/browser/translate/translate_infobar_view.h" | 9 #include "chrome/browser/translate/translate_infobar_view.h" |
| 10 #include "chrome/browser/views/infobars/infobars.h" | 10 #include "chrome/browser/views/infobars/infobars.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 | 26 |
| 27 // TranslateInfoBarView implementation: | 27 // TranslateInfoBarView implementation: |
| 28 virtual void OriginalLanguageChanged() {} | 28 virtual void OriginalLanguageChanged() {} |
| 29 virtual void TargetLanguageChanged() {} | 29 virtual void TargetLanguageChanged() {} |
| 30 | 30 |
| 31 // Overridden from views::View: | 31 // Overridden from views::View: |
| 32 virtual void Layout(); | 32 virtual void Layout(); |
| 33 virtual void PaintBackground(gfx::Canvas* canvas); | 33 virtual void PaintBackground(gfx::Canvas* canvas); |
| 34 | 34 |
| 35 protected: | 35 protected: |
| 36 // Overridden from AnimationDelegate: | 36 // Overridden from ui::AnimationDelegate: |
| 37 virtual void AnimationProgressed(const Animation* animation); | 37 virtual void AnimationProgressed(const ui::Animation* animation); |
| 38 | 38 |
| 39 // Creates a label with the appropriate font and color for the translate | 39 // Creates a label with the appropriate font and color for the translate |
| 40 // infobars. | 40 // infobars. |
| 41 views::Label* CreateLabel(const string16& text); | 41 views::Label* CreateLabel(const string16& text); |
| 42 | 42 |
| 43 // Creates a menu-button with a custom appearance for the translate infobars. | 43 // Creates a menu-button with a custom appearance for the translate infobars. |
| 44 views::MenuButton* CreateMenuButton(const string16& text, | 44 views::MenuButton* CreateMenuButton(const string16& text, |
| 45 bool normal_has_border, | 45 bool normal_has_border, |
| 46 views::ViewMenuDelegate* menu_delegate); | 46 views::ViewMenuDelegate* menu_delegate); |
| 47 | 47 |
| 48 // Returns the location at which the menu triggered by |menu_button| should be | 48 // Returns the location at which the menu triggered by |menu_button| should be |
| 49 // positioned. | 49 // positioned. |
| 50 gfx::Point DetermineMenuPosition(views::MenuButton* menu_button); | 50 gfx::Point DetermineMenuPosition(views::MenuButton* menu_button); |
| 51 | 51 |
| 52 // Convenience to retrieve the TranslateInfoBarDelegate for this infobar. | 52 // Convenience to retrieve the TranslateInfoBarDelegate for this infobar. |
| 53 TranslateInfoBarDelegate* GetDelegate() const; | 53 TranslateInfoBarDelegate* GetDelegate() const; |
| 54 | 54 |
| 55 // The translate icon. | 55 // The translate icon. |
| 56 views::ImageView* icon_; | 56 views::ImageView* icon_; |
| 57 | 57 |
| 58 InfoBarBackground normal_background_; | 58 InfoBarBackground normal_background_; |
| 59 InfoBarBackground error_background_; | 59 InfoBarBackground error_background_; |
| 60 scoped_ptr<SlideAnimation> background_color_animation_; | 60 scoped_ptr<ui::SlideAnimation> background_color_animation_; |
| 61 | 61 |
| 62 private: | 62 private: |
| 63 // Returns the background that should be displayed when not animating. | 63 // Returns the background that should be displayed when not animating. |
| 64 const InfoBarBackground& GetBackground() const; | 64 const InfoBarBackground& GetBackground() const; |
| 65 | 65 |
| 66 // Paints |background| to |canvas| with the opacity level based on | 66 // Paints |background| to |canvas| with the opacity level based on |
| 67 // |animation_value|. | 67 // |animation_value|. |
| 68 void FadeBackground(gfx::Canvas* canvas, | 68 void FadeBackground(gfx::Canvas* canvas, |
| 69 double animation_value, | 69 double animation_value, |
| 70 const InfoBarBackground& background); | 70 const InfoBarBackground& background); |
| 71 | 71 |
| 72 DISALLOW_COPY_AND_ASSIGN(TranslateInfoBarBase); | 72 DISALLOW_COPY_AND_ASSIGN(TranslateInfoBarBase); |
| 73 }; | 73 }; |
| 74 | 74 |
| 75 #endif // CHROME_BROWSER_UI_VIEWS_INFOBARS_TRANSLATE_INFOBAR_BASE_H_ | 75 #endif // CHROME_BROWSER_UI_VIEWS_INFOBARS_TRANSLATE_INFOBAR_BASE_H_ |
| OLD | NEW |