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_LOCATION_BAR_CONTENT_SETTING_IMAGE_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_CONTENT_SETTING_IMAGE_VIEW_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_CONTENT_SETTING_IMAGE_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_CONTENT_SETTING_IMAGE_VIEW_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "app/linear_animation.h" | |
10 #include "base/scoped_ptr.h" | 9 #include "base/scoped_ptr.h" |
11 #include "base/string16.h" | 10 #include "base/string16.h" |
12 #include "chrome/browser/views/info_bubble.h" | 11 #include "chrome/browser/views/info_bubble.h" |
13 #include "chrome/common/content_settings_types.h" | 12 #include "chrome/common/content_settings_types.h" |
| 13 #include "ui/base/animation/linear_animation.h" |
14 #include "views/controls/image_view.h" | 14 #include "views/controls/image_view.h" |
15 | 15 |
16 class ContentSettingImageModel; | 16 class ContentSettingImageModel; |
17 class InfoBubble; | 17 class InfoBubble; |
18 class LocationBarView; | 18 class LocationBarView; |
19 class Profile; | 19 class Profile; |
20 class TabContents; | 20 class TabContents; |
21 | 21 |
22 namespace views { | 22 namespace views { |
23 class MouseEvent; | 23 class MouseEvent; |
24 } | 24 } |
25 | 25 |
26 class ContentSettingImageView : public views::ImageView, | 26 class ContentSettingImageView : public views::ImageView, |
27 public InfoBubbleDelegate, | 27 public InfoBubbleDelegate, |
28 public LinearAnimation { | 28 public ui::LinearAnimation { |
29 public: | 29 public: |
30 ContentSettingImageView(ContentSettingsType content_type, | 30 ContentSettingImageView(ContentSettingsType content_type, |
31 LocationBarView* parent, | 31 LocationBarView* parent, |
32 Profile* profile); | 32 Profile* profile); |
33 virtual ~ContentSettingImageView(); | 33 virtual ~ContentSettingImageView(); |
34 | 34 |
35 void set_profile(Profile* profile) { profile_ = profile; } | 35 void set_profile(Profile* profile) { profile_ = profile; } |
36 // |new_navigation| true if this is a new navigation, false if the tab was | 36 // |new_navigation| true if this is a new navigation, false if the tab was |
37 // just switched to. | 37 // just switched to. |
38 void UpdateFromTabContents(TabContents* tab_contents); | 38 void UpdateFromTabContents(TabContents* tab_contents); |
39 | 39 |
40 // views::View overrides: | 40 // views::View overrides: |
41 virtual gfx::Size GetPreferredSize(); | 41 virtual gfx::Size GetPreferredSize(); |
42 | 42 |
43 private: | 43 private: |
44 // views::ImageView overrides: | 44 // views::ImageView overrides: |
45 virtual bool OnMousePressed(const views::MouseEvent& event); | 45 virtual bool OnMousePressed(const views::MouseEvent& event); |
46 virtual void OnMouseReleased(const views::MouseEvent& event, bool canceled); | 46 virtual void OnMouseReleased(const views::MouseEvent& event, bool canceled); |
47 virtual void VisibilityChanged(View* starting_from, bool is_visible); | 47 virtual void VisibilityChanged(View* starting_from, bool is_visible); |
48 virtual void Paint(gfx::Canvas* canvas); | 48 virtual void Paint(gfx::Canvas* canvas); |
49 virtual void PaintBackground(gfx::Canvas* canvas); | 49 virtual void PaintBackground(gfx::Canvas* canvas); |
50 | 50 |
51 // InfoBubbleDelegate overrides: | 51 // InfoBubbleDelegate overrides: |
52 virtual void InfoBubbleClosing(InfoBubble* info_bubble, | 52 virtual void InfoBubbleClosing(InfoBubble* info_bubble, |
53 bool closed_by_escape); | 53 bool closed_by_escape); |
54 virtual bool CloseOnEscape(); | 54 virtual bool CloseOnEscape(); |
55 virtual bool FadeInOnShow() { return false; } | 55 virtual bool FadeInOnShow() { return false; } |
56 | 56 |
57 // LinearAnimation override: | 57 // ui::LinearAnimation override: |
58 virtual void AnimateToState(double state); | 58 virtual void AnimateToState(double state); |
59 | 59 |
60 scoped_ptr<ContentSettingImageModel> content_setting_image_model_; | 60 scoped_ptr<ContentSettingImageModel> content_setting_image_model_; |
61 | 61 |
62 // The owning LocationBarView. | 62 // The owning LocationBarView. |
63 LocationBarView* parent_; | 63 LocationBarView* parent_; |
64 | 64 |
65 // The currently active profile. | 65 // The currently active profile. |
66 Profile* profile_; | 66 Profile* profile_; |
67 | 67 |
68 // The currently shown info bubble if any. | 68 // The currently shown info bubble if any. |
69 InfoBubble* info_bubble_; | 69 InfoBubble* info_bubble_; |
70 | 70 |
71 string16 animated_text_; | 71 string16 animated_text_; |
72 bool animation_in_progress_; | 72 bool animation_in_progress_; |
73 int text_size_; | 73 int text_size_; |
74 int visible_text_size_; | 74 int visible_text_size_; |
75 gfx::Insets saved_insets_; | 75 gfx::Insets saved_insets_; |
76 | 76 |
77 DISALLOW_IMPLICIT_CONSTRUCTORS(ContentSettingImageView); | 77 DISALLOW_IMPLICIT_CONSTRUCTORS(ContentSettingImageView); |
78 }; | 78 }; |
79 | 79 |
80 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_CONTENT_SETTING_IMAGE_VIEW_H_ | 80 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_CONTENT_SETTING_IMAGE_VIEW_H_ |
OLD | NEW |