| 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 <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 | 59 |
| 60 // The total animation time, including open and close as well as an | 60 // The total animation time, including open and close as well as an |
| 61 // intervening "stay open" period. | 61 // intervening "stay open" period. |
| 62 static const int kAnimationDurationMS; | 62 static const int kAnimationDurationMS; |
| 63 | 63 |
| 64 // IconLabelBubbleView: | 64 // IconLabelBubbleView: |
| 65 const char* GetClassName() const override; | 65 const char* GetClassName() const override; |
| 66 void OnBoundsChanged(const gfx::Rect& previous_bounds) override; | 66 void OnBoundsChanged(const gfx::Rect& previous_bounds) override; |
| 67 bool OnMousePressed(const ui::MouseEvent& event) override; | 67 bool OnMousePressed(const ui::MouseEvent& event) override; |
| 68 void OnMouseReleased(const ui::MouseEvent& event) override; | 68 void OnMouseReleased(const ui::MouseEvent& event) override; |
| 69 bool OnKeyPressed(const ui::KeyEvent& event) override; | |
| 70 void OnGestureEvent(ui::GestureEvent* event) override; | 69 void OnGestureEvent(ui::GestureEvent* event) override; |
| 71 void OnNativeThemeChanged(const ui::NativeTheme* native_theme) override; | 70 void OnNativeThemeChanged(const ui::NativeTheme* native_theme) override; |
| 72 SkColor GetTextColor() const override; | 71 SkColor GetTextColor() const override; |
| 73 SkColor GetBorderColor() const override; | 72 SkColor GetBorderColor() const override; |
| 74 bool ShouldShowBackground() const override; | 73 bool ShouldShowBackground() const override; |
| 75 double WidthMultiplier() const override; | 74 double WidthMultiplier() const override; |
| 76 bool IsShrinking() const override; | 75 bool IsShrinking() const override; |
| 76 bool OnActivate() override; |
| 77 | 77 |
| 78 // gfx::AnimationDelegate: | 78 // gfx::AnimationDelegate: |
| 79 void AnimationEnded(const gfx::Animation* animation) override; | 79 void AnimationEnded(const gfx::Animation* animation) override; |
| 80 void AnimationProgressed(const gfx::Animation* animation) override; | 80 void AnimationProgressed(const gfx::Animation* animation) override; |
| 81 void AnimationCanceled(const gfx::Animation* animation) override; | 81 void AnimationCanceled(const gfx::Animation* animation) override; |
| 82 | 82 |
| 83 // views::WidgetObserver: | 83 // views::WidgetObserver: |
| 84 void OnWidgetDestroying(views::Widget* widget) override; | 84 void OnWidgetDestroying(views::Widget* widget) override; |
| 85 void OnWidgetVisibilityChanged(views::Widget* widget, bool visible) override; | 85 void OnWidgetVisibilityChanged(views::Widget* widget, bool visible) override; |
| 86 | 86 |
| 87 // Called when the user clicks the view; this freezes the animation or snaps | |
| 88 // it to its end state as necessary and then opens a content setting bubble. | |
| 89 void OnClick(); | |
| 90 | |
| 91 // Updates the image and tooltip to match the current model state. | 87 // Updates the image and tooltip to match the current model state. |
| 92 void UpdateImage(); | 88 void UpdateImage(); |
| 93 | 89 |
| 94 LocationBarView* parent_; // Weak, owns us. | 90 LocationBarView* parent_; // Weak, owns us. |
| 95 std::unique_ptr<ContentSettingImageModel> content_setting_image_model_; | 91 std::unique_ptr<ContentSettingImageModel> content_setting_image_model_; |
| 96 gfx::SlideAnimation slide_animator_; | 92 gfx::SlideAnimation slide_animator_; |
| 97 bool pause_animation_; | 93 bool pause_animation_; |
| 98 double pause_animation_state_; | 94 double pause_animation_state_; |
| 99 views::BubbleDialogDelegateView* bubble_view_; | 95 views::BubbleDialogDelegateView* bubble_view_; |
| 100 | 96 |
| 101 // This is used to check if the bubble was showing during the mouse pressed | 97 // This is used to check if the bubble was showing during the mouse pressed |
| 102 // event. If this is true then the mouse released event is ignored to prevent | 98 // event. If this is true then the mouse released event is ignored to prevent |
| 103 // the bubble from reshowing. | 99 // the bubble from reshowing. |
| 104 bool suppress_mouse_released_action_; | 100 bool suppress_mouse_released_action_; |
| 105 | 101 |
| 106 // Animation delegate for the ink drop ripple effect. | 102 // Animation delegate for the ink drop ripple effect. |
| 107 std::unique_ptr<views::InkDropDelegate> ink_drop_delegate_; | 103 std::unique_ptr<views::InkDropDelegate> ink_drop_delegate_; |
| 108 | 104 |
| 109 DISALLOW_COPY_AND_ASSIGN(ContentSettingImageView); | 105 DISALLOW_COPY_AND_ASSIGN(ContentSettingImageView); |
| 110 }; | 106 }; |
| 111 | 107 |
| 112 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_CONTENT_SETTING_IMAGE_VIEW_H_ | 108 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_CONTENT_SETTING_IMAGE_VIEW_H_ |
| OLD | NEW |