OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/string16.h" | 10 #include "base/string16.h" |
11 #include "chrome/browser/ui/views/location_bar/touchable_location_bar_view.h" | 11 #include "chrome/browser/ui/views/location_bar/touchable_location_bar_view.h" |
12 #include "chrome/common/content_settings_types.h" | 12 #include "chrome/common/content_settings_types.h" |
13 #include "ui/base/animation/animation_delegate.h" | 13 #include "ui/base/animation/animation_delegate.h" |
14 #include "ui/views/controls/image_view.h" | 14 #include "ui/views/controls/image_view.h" |
15 #include "ui/views/widget/widget.h" | 15 #include "ui/views/widget/widget_observer.h" |
16 | 16 |
17 class ContentSettingImageModel; | 17 class ContentSettingImageModel; |
18 class ContentSettingBubbleContents; | 18 class ContentSettingBubbleContents; |
19 class LocationBarView; | 19 class LocationBarView; |
20 | 20 |
21 namespace content { | 21 namespace content { |
22 class WebContents; | 22 class WebContents; |
23 } | 23 } |
24 | 24 |
25 namespace views { | 25 namespace views { |
26 class MouseEvent; | 26 class MouseEvent; |
27 } | 27 } |
28 | 28 |
29 namespace ui { | 29 namespace ui { |
30 class SlideAnimation; | 30 class SlideAnimation; |
31 } | 31 } |
32 | 32 |
33 class ContentSettingsDelegateView; | 33 class ContentSettingsDelegateView; |
34 | 34 |
35 class ContentSettingImageView | 35 class ContentSettingImageView : public views::ImageView, |
36 : public views::ImageView, | 36 public ui::AnimationDelegate, |
37 public ui::AnimationDelegate, | 37 public views::WidgetObserver, |
38 public views::Widget::Observer, | 38 public TouchableLocationBarView { |
39 public TouchableLocationBarView { | |
40 public: | 39 public: |
41 ContentSettingImageView(ContentSettingsType content_type, | 40 ContentSettingImageView(ContentSettingsType content_type, |
42 LocationBarView* parent); | 41 LocationBarView* parent); |
43 virtual ~ContentSettingImageView(); | 42 virtual ~ContentSettingImageView(); |
44 | 43 |
45 // |new_navigation| true if this is a new navigation, false if the tab was | 44 // |new_navigation| true if this is a new navigation, false if the tab was |
46 // just switched to. | 45 // just switched to. |
47 void UpdateFromWebContents(content::WebContents* web_contents); | 46 void UpdateFromWebContents(content::WebContents* web_contents); |
48 | 47 |
49 // views::View overrides: | 48 // views::View overrides: |
50 virtual gfx::Size GetPreferredSize() OVERRIDE; | 49 virtual gfx::Size GetPreferredSize() OVERRIDE; |
51 | 50 |
52 // ui::AnimationDelegate overrides: | 51 // ui::AnimationDelegate overrides: |
53 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; | 52 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; |
54 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; | 53 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; |
55 virtual void AnimationCanceled(const ui::Animation* animation) OVERRIDE; | 54 virtual void AnimationCanceled(const ui::Animation* animation) OVERRIDE; |
56 | 55 |
57 // views::Widget::Observer override: | 56 // views::WidgetObserver override: |
58 virtual void OnWidgetClosing(views::Widget* widget) OVERRIDE; | 57 virtual void OnWidgetClosing(views::Widget* widget) OVERRIDE; |
59 | 58 |
60 // TouchableLocationBarView. | 59 // TouchableLocationBarView. |
61 virtual int GetBuiltInHorizontalPadding() const OVERRIDE; | 60 virtual int GetBuiltInHorizontalPadding() const OVERRIDE; |
62 | 61 |
63 private: | 62 private: |
64 // views::ImageView overrides: | 63 // views::ImageView overrides: |
65 virtual bool OnMousePressed(const views::MouseEvent& event) OVERRIDE; | 64 virtual bool OnMousePressed(const views::MouseEvent& event) OVERRIDE; |
66 virtual void OnMouseReleased(const views::MouseEvent& event) OVERRIDE; | 65 virtual void OnMouseReleased(const views::MouseEvent& event) OVERRIDE; |
67 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | 66 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; |
(...skipping 10 matching lines...) Expand all Loading... |
78 string16 animated_text_; | 77 string16 animated_text_; |
79 bool pause_animation_; | 78 bool pause_animation_; |
80 int text_size_; | 79 int text_size_; |
81 int visible_text_size_; | 80 int visible_text_size_; |
82 gfx::Insets saved_insets_; | 81 gfx::Insets saved_insets_; |
83 | 82 |
84 DISALLOW_IMPLICIT_CONSTRUCTORS(ContentSettingImageView); | 83 DISALLOW_IMPLICIT_CONSTRUCTORS(ContentSettingImageView); |
85 }; | 84 }; |
86 | 85 |
87 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_CONTENT_SETTING_IMAGE_VIEW_H_ | 86 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_CONTENT_SETTING_IMAGE_VIEW_H_ |
OLD | NEW |