OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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/languages_menu_model.h" | 9 #include "chrome/browser/translate/languages_menu_model.h" |
10 #include "chrome/browser/translate/translate_infobar_view.h" | 10 #include "chrome/browser/translate/translate_infobar_view.h" |
11 #include "chrome/browser/ui/views/infobars/infobar_background.h" | 11 #include "chrome/browser/ui/views/infobars/infobar_background.h" |
12 #include "chrome/browser/ui/views/infobars/infobar_view.h" | 12 #include "chrome/browser/ui/views/infobars/infobar_view.h" |
13 | 13 |
14 class TranslateInfoBarDelegate; | 14 class TranslateInfoBarDelegate; |
15 | 15 |
16 namespace views { | 16 namespace views { |
| 17 class ImageView; |
17 class MenuButton; | 18 class MenuButton; |
18 class ViewMenuDelegate; | |
19 } | 19 } |
20 | 20 |
21 // This class contains some of the base functionality that translate infobars | 21 // This class contains some of the base functionality that translate infobars |
22 // use. | 22 // use. |
23 class TranslateInfoBarBase : public TranslateInfoBarView, | 23 class TranslateInfoBarBase : public TranslateInfoBarView, |
24 public InfoBarView { | 24 public InfoBarView { |
25 public: | 25 public: |
26 explicit TranslateInfoBarBase(TranslateInfoBarDelegate* delegate); | 26 explicit TranslateInfoBarBase(TranslateInfoBarDelegate* delegate); |
27 virtual ~TranslateInfoBarBase(); | 27 virtual ~TranslateInfoBarBase(); |
28 | 28 |
29 protected: | 29 protected: |
30 static const int kButtonInLabelSpacing; | 30 static const int kButtonInLabelSpacing; |
31 | 31 |
32 // Creates a label with the appropriate font and color for the translate | |
33 // infobars. | |
34 static views::Label* CreateLabel(const string16& text); | |
35 | |
36 // Creates a menu-button with a custom appearance for the translate infobars. | |
37 static views::MenuButton* CreateMenuButton( | |
38 const string16& text, | |
39 bool normal_has_border, | |
40 views::ViewMenuDelegate* menu_delegate); | |
41 | |
42 // InfoBarView: | 32 // InfoBarView: |
43 virtual void Layout(); | 33 virtual void Layout(); |
44 | 34 |
45 // Sets the text of the provided language menu button to reflect the current | 35 // Sets the text of the provided language menu button to reflect the current |
46 // value from the delegate. | 36 // value from the delegate. |
47 void UpdateLanguageButtonText(views::MenuButton* button, | 37 void UpdateLanguageButtonText(views::MenuButton* button, |
48 LanguagesMenuModel::LanguageType language); | 38 LanguagesMenuModel::LanguageType language); |
49 | 39 |
50 // Convenience to retrieve the TranslateInfoBarDelegate for this infobar. | 40 // Convenience to retrieve the TranslateInfoBarDelegate for this infobar. |
51 TranslateInfoBarDelegate* GetDelegate(); | 41 TranslateInfoBarDelegate* GetDelegate(); |
(...skipping 16 matching lines...) Expand all Loading... |
68 const views::Background& background); | 58 const views::Background& background); |
69 | 59 |
70 InfoBarBackground normal_background_; | 60 InfoBarBackground normal_background_; |
71 InfoBarBackground error_background_; | 61 InfoBarBackground error_background_; |
72 scoped_ptr<ui::SlideAnimation> background_color_animation_; | 62 scoped_ptr<ui::SlideAnimation> background_color_animation_; |
73 | 63 |
74 DISALLOW_COPY_AND_ASSIGN(TranslateInfoBarBase); | 64 DISALLOW_COPY_AND_ASSIGN(TranslateInfoBarBase); |
75 }; | 65 }; |
76 | 66 |
77 #endif // CHROME_BROWSER_UI_VIEWS_INFOBARS_TRANSLATE_INFOBAR_BASE_H_ | 67 #endif // CHROME_BROWSER_UI_VIEWS_INFOBARS_TRANSLATE_INFOBAR_BASE_H_ |
OLD | NEW |