Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(369)

Side by Side Diff: chrome/browser/views/infobars/translate_infobar_base.h

Issue 2602003: Refactored the translate infobars. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Synced Created 10 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_VIEWS_INFOBARS_TRANSLATE_INFOBAR_BASE_H_
6 #define CHROME_BROWSER_VIEWS_INFOBARS_TRANSLATE_INFOBAR_BASE_H_
7
8 #include "chrome/browser/translate/translate_infobar_view.h"
9 #include "chrome/browser/views/infobars/infobars.h"
10
11 class TranslateInfoBarDelegate2;
12
13 namespace views {
14 class MenuButton;
15 class ViewMenuDelegate;
16 }
17
18 // This class contains some of the base functionality that translate infobars
19 // use.
20 class TranslateInfoBarBase : public TranslateInfoBarView,
21 public InfoBar {
22 public:
23 explicit TranslateInfoBarBase(TranslateInfoBarDelegate2* delegate);
24 virtual ~TranslateInfoBarBase();
25
26 // TranslateInfoBarView implementation:
27 virtual void OriginalLanguageChanged() {}
28 virtual void TargetLanguageChanged() {}
29
30 // Overridden from views::View:
31 virtual void Layout();
32 virtual void PaintBackground(gfx::Canvas* canvas);
33
34 protected:
35 // Overridden from AnimationDelegate:
36 virtual void AnimationProgressed(const Animation* animation);
37
38 // Creates a label with the appropriate font and color for the translate
39 // infobars.
40 views::Label* CreateLabel(const string16& text);
41
42 // Creates a menu-button with a custom appearance for the translate infobars.
43 views::MenuButton* CreateMenuButton(const string16& text,
44 bool normal_has_border,
45 views::ViewMenuDelegate* menu_delegate);
46
47 // Returns the location at which the menu triggered by |menu_button| should be
48 // positioned.
49 gfx::Point DetermineMenuPosition(views::MenuButton* menu_button);
50
51 // Convenience to retrieve the TranslateInfoBarDelegate2 for this infobar.
52 TranslateInfoBarDelegate2* GetDelegate() const;
53
54 // The translate icon.
55 views::ImageView* icon_;
56
57 InfoBarBackground normal_background_;
58 InfoBarBackground error_background_;
59 scoped_ptr<SlideAnimation> background_color_animation_;
60
61 private:
62 // Returns the background that should be displayed when not animating.
63 const InfoBarBackground& GetBackground() const;
64
65 // Paints |background| to |canvas| with the opacity level based on
66 // |animation_value|.
67 void FadeBackground(gfx::Canvas* canvas,
68 double animation_value,
69 const InfoBarBackground& background);
70
71 DISALLOW_COPY_AND_ASSIGN(TranslateInfoBarBase);
72 };
73
74 #endif // CHROME_BROWSER_VIEWS_INFOBARS_TRANSLATE_INFOBAR_BASE_H_
75
76
OLDNEW
« no previous file with comments | « chrome/browser/views/infobars/infobars.cc ('k') | chrome/browser/views/infobars/translate_infobar_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698