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" | 9 #include "chrome/browser/ui/views/location_bar/touchable_location_bar_view.h" |
10 #include "chrome/common/content_settings_types.h" | 10 #include "chrome/common/content_settings_types.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 SkColor font_color); | 45 SkColor font_color); |
46 virtual ~ContentSettingImageView(); | 46 virtual ~ContentSettingImageView(); |
47 | 47 |
48 // TouchableLocationBarView: | 48 // TouchableLocationBarView: |
49 virtual int GetBuiltInHorizontalPadding() const OVERRIDE; | 49 virtual int GetBuiltInHorizontalPadding() const OVERRIDE; |
50 | 50 |
51 // Update the decoration from the shown WebContents. | 51 // Update the decoration from the shown WebContents. |
52 void Update(content::WebContents* web_contents); | 52 void Update(content::WebContents* web_contents); |
53 | 53 |
54 private: | 54 private: |
| 55 // Number of milliseconds spent animating open; also the time spent animating |
| 56 // closed. |
| 57 static const int kOpenTimeMS; |
| 58 |
| 59 // The total animation time, including open and close as well as an |
| 60 // intervening "stay open" period. |
| 61 static const int kAnimationDurationMS; |
| 62 |
55 // ui::AnimationDelegate: | 63 // ui::AnimationDelegate: |
56 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; | 64 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; |
57 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; | 65 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; |
58 virtual void AnimationCanceled(const ui::Animation* animation) OVERRIDE; | 66 virtual void AnimationCanceled(const ui::Animation* animation) OVERRIDE; |
59 | 67 |
60 // views::View: | 68 // views::View: |
61 virtual gfx::Size GetPreferredSize() OVERRIDE; | 69 virtual gfx::Size GetPreferredSize() OVERRIDE; |
62 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; | 70 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; |
63 virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE; | 71 virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE; |
64 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; | 72 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; |
65 virtual void OnPaintBackground(gfx::Canvas* canvas) OVERRIDE; | 73 virtual void OnPaintBackground(gfx::Canvas* canvas) OVERRIDE; |
66 | 74 |
67 // views::WidgetObserver: | 75 // views::WidgetObserver: |
68 virtual void OnWidgetDestroying(views::Widget* widget) OVERRIDE; | 76 virtual void OnWidgetDestroying(views::Widget* widget) OVERRIDE; |
69 | 77 |
| 78 bool background_showing() const { |
| 79 return slide_animator_.is_animating() || pause_animation_; |
| 80 } |
| 81 |
70 // Invoked when the user clicks on the control. | 82 // Invoked when the user clicks on the control. |
71 void OnClick(LocationBarView* parent); | 83 void OnClick(); |
72 | |
73 int GetTextAnimationSize(double state, int text_size); | |
74 | 84 |
75 LocationBarView* parent_; // Weak, owns us. | 85 LocationBarView* parent_; // Weak, owns us. |
76 scoped_ptr<ContentSettingImageModel> content_setting_image_model_; | 86 scoped_ptr<ContentSettingImageModel> content_setting_image_model_; |
77 views::HorizontalPainter background_painter_; | 87 scoped_ptr<views::Painter> background_painter_; |
78 views::ImageView* icon_; | 88 views::ImageView* icon_; |
79 views::Label* text_label_; | 89 views::Label* text_label_; |
80 ui::SlideAnimation slide_animator_; | 90 ui::SlideAnimation slide_animator_; |
81 bool pause_animation_; | 91 bool pause_animation_; |
82 double pause_animation_state_; | 92 double pause_animation_state_; |
83 views::Widget* bubble_widget_; | 93 views::Widget* bubble_widget_; |
84 | 94 |
85 // TODO(pkasting): Eliminate these. | 95 // TODO(pkasting): Eliminate these. |
86 gfx::Font font_; | 96 gfx::Font font_; |
87 int text_size_; | 97 int text_size_; |
88 int visible_text_size_; | |
89 | 98 |
90 DISALLOW_COPY_AND_ASSIGN(ContentSettingImageView); | 99 DISALLOW_COPY_AND_ASSIGN(ContentSettingImageView); |
91 }; | 100 }; |
92 | 101 |
93 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_CONTENT_SETTING_IMAGE_VIEW_H_ | 102 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_CONTENT_SETTING_IMAGE_VIEW_H_ |
OLD | NEW |