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/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "chrome/browser/ui/views/location_bar/touchable_location_bar_view.h" | |
10 #include "chrome/common/content_settings_types.h" | 9 #include "chrome/common/content_settings_types.h" |
11 #include "ui/base/animation/animation_delegate.h" | 10 #include "ui/base/animation/animation_delegate.h" |
12 #include "ui/base/animation/slide_animation.h" | 11 #include "ui/base/animation/slide_animation.h" |
13 #include "ui/gfx/font.h" | 12 #include "ui/gfx/font.h" |
14 #include "ui/views/painter.h" | 13 #include "ui/views/painter.h" |
15 #include "ui/views/view.h" | 14 #include "ui/views/view.h" |
16 #include "ui/views/widget/widget_observer.h" | 15 #include "ui/views/widget/widget_observer.h" |
17 | 16 |
18 class ContentSettingImageModel; | 17 class ContentSettingImageModel; |
19 class LocationBarView; | 18 class LocationBarView; |
20 | 19 |
21 namespace content { | 20 namespace content { |
22 class WebContents; | 21 class WebContents; |
23 } | 22 } |
24 | 23 |
25 namespace views { | 24 namespace views { |
26 class ImageView; | 25 class ImageView; |
27 class Label; | 26 class Label; |
28 } | 27 } |
29 | 28 |
30 // The ContentSettingImageView displays an icon and optional text label for | 29 // The ContentSettingImageView displays an icon and optional text label for |
31 // various content settings affordances in the location bar (i.e. plugin | 30 // various content settings affordances in the location bar (i.e. plugin |
32 // blocking, geolocation). | 31 // blocking, geolocation). |
33 class ContentSettingImageView : public TouchableLocationBarView, | 32 class ContentSettingImageView : public ui::AnimationDelegate, |
34 public ui::AnimationDelegate, | |
35 public views::View, | 33 public views::View, |
36 public views::WidgetObserver { | 34 public views::WidgetObserver { |
37 public: | 35 public: |
38 ContentSettingImageView(ContentSettingsType content_type, | 36 ContentSettingImageView(ContentSettingsType content_type, |
39 LocationBarView* parent, | 37 LocationBarView* parent, |
40 const gfx::Font& font, | 38 const gfx::Font& font, |
41 int font_y_offset, | 39 int font_y_offset, |
42 SkColor text_color, | 40 SkColor text_color, |
43 SkColor parent_background_color); | 41 SkColor parent_background_color); |
44 virtual ~ContentSettingImageView(); | 42 virtual ~ContentSettingImageView(); |
45 | 43 |
46 // TouchableLocationBarView: | |
47 virtual int GetBuiltInHorizontalPadding() const OVERRIDE; | |
48 | |
49 // Update the decoration from the shown WebContents. | 44 // Update the decoration from the shown WebContents. |
50 void Update(content::WebContents* web_contents); | 45 void Update(content::WebContents* web_contents); |
51 | 46 |
52 private: | 47 private: |
53 // Number of milliseconds spent animating open; also the time spent animating | 48 // Number of milliseconds spent animating open; also the time spent animating |
54 // closed. | 49 // closed. |
55 static const int kOpenTimeMS; | 50 static const int kOpenTimeMS; |
56 | 51 |
57 // The total animation time, including open and close as well as an | 52 // The total animation time, including open and close as well as an |
58 // intervening "stay open" period. | 53 // intervening "stay open" period. |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 views::Label* text_label_; | 90 views::Label* text_label_; |
96 ui::SlideAnimation slide_animator_; | 91 ui::SlideAnimation slide_animator_; |
97 bool pause_animation_; | 92 bool pause_animation_; |
98 double pause_animation_state_; | 93 double pause_animation_state_; |
99 views::Widget* bubble_widget_; | 94 views::Widget* bubble_widget_; |
100 | 95 |
101 DISALLOW_COPY_AND_ASSIGN(ContentSettingImageView); | 96 DISALLOW_COPY_AND_ASSIGN(ContentSettingImageView); |
102 }; | 97 }; |
103 | 98 |
104 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_CONTENT_SETTING_IMAGE_VIEW_H_ | 99 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_CONTENT_SETTING_IMAGE_VIEW_H_ |
OLD | NEW |