| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 // intervening "stay open" period. | 60 // intervening "stay open" period. |
| 61 static const int kAnimationDurationMS; | 61 static const int kAnimationDurationMS; |
| 62 | 62 |
| 63 // ui::AnimationDelegate: | 63 // ui::AnimationDelegate: |
| 64 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; | 64 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; |
| 65 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; | 65 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; |
| 66 virtual void AnimationCanceled(const ui::Animation* animation) OVERRIDE; | 66 virtual void AnimationCanceled(const ui::Animation* animation) OVERRIDE; |
| 67 | 67 |
| 68 // views::View: | 68 // views::View: |
| 69 virtual gfx::Size GetPreferredSize() OVERRIDE; | 69 virtual gfx::Size GetPreferredSize() OVERRIDE; |
| 70 virtual void Layout() OVERRIDE; |
| 70 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; | 71 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE; |
| 71 virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE; | 72 virtual void OnMouseReleased(const ui::MouseEvent& event) OVERRIDE; |
| 72 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; | 73 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; |
| 73 virtual void OnPaintBackground(gfx::Canvas* canvas) OVERRIDE; | 74 virtual void OnPaintBackground(gfx::Canvas* canvas) OVERRIDE; |
| 74 | 75 |
| 75 // views::WidgetObserver: | 76 // views::WidgetObserver: |
| 76 virtual void OnWidgetDestroying(views::Widget* widget) OVERRIDE; | 77 virtual void OnWidgetDestroying(views::Widget* widget) OVERRIDE; |
| 77 | 78 |
| 78 bool background_showing() const { | 79 bool background_showing() const { |
| 79 return slide_animator_.is_animating() || pause_animation_; | 80 return slide_animator_.is_animating() || pause_animation_; |
| 80 } | 81 } |
| 81 | 82 |
| 82 // Invoked when the user clicks on the control. | 83 int GetTotalSpacingWhileAnimating() const; |
| 83 void OnClick(); | 84 void OnClick(); |
| 84 | 85 |
| 85 LocationBarView* parent_; // Weak, owns us. | 86 LocationBarView* parent_; // Weak, owns us. |
| 86 scoped_ptr<ContentSettingImageModel> content_setting_image_model_; | 87 scoped_ptr<ContentSettingImageModel> content_setting_image_model_; |
| 87 scoped_ptr<views::Painter> background_painter_; | 88 scoped_ptr<views::Painter> background_painter_; |
| 88 views::ImageView* icon_; | 89 views::ImageView* icon_; |
| 89 views::Label* text_label_; | 90 views::Label* text_label_; |
| 90 ui::SlideAnimation slide_animator_; | 91 ui::SlideAnimation slide_animator_; |
| 91 bool pause_animation_; | 92 bool pause_animation_; |
| 92 double pause_animation_state_; | 93 double pause_animation_state_; |
| 93 views::Widget* bubble_widget_; | 94 views::Widget* bubble_widget_; |
| 94 | 95 |
| 95 // TODO(pkasting): Eliminate these. | |
| 96 gfx::Font font_; | |
| 97 int text_size_; | |
| 98 | |
| 99 DISALLOW_COPY_AND_ASSIGN(ContentSettingImageView); | 96 DISALLOW_COPY_AND_ASSIGN(ContentSettingImageView); |
| 100 }; | 97 }; |
| 101 | 98 |
| 102 #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 |