Chromium Code Reviews| 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/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "chrome/browser/ui/content_settings/content_setting_image_model.h" | 10 #include "chrome/browser/ui/content_settings/content_setting_image_model.h" |
| 11 #include "chrome/browser/ui/views/location_bar/icon_label_bubble_view.h" | 11 #include "chrome/browser/ui/views/location_bar/icon_label_bubble_view.h" |
| 12 #include "components/content_settings/core/common/content_settings_types.h" | 12 #include "components/content_settings/core/common/content_settings_types.h" |
| 13 #include "ui/gfx/animation/animation_delegate.h" | 13 #include "ui/gfx/animation/animation_delegate.h" |
| 14 #include "ui/gfx/animation/slide_animation.h" | 14 #include "ui/gfx/animation/slide_animation.h" |
| 15 #include "ui/views/animation/ink_drop_host.h" | |
| 15 #include "ui/views/painter.h" | 16 #include "ui/views/painter.h" |
| 16 #include "ui/views/view.h" | 17 #include "ui/views/view.h" |
| 17 #include "ui/views/widget/widget_observer.h" | 18 #include "ui/views/widget/widget_observer.h" |
| 18 | 19 |
| 19 class ContentSettingImageModel; | 20 class ContentSettingImageModel; |
| 20 class LocationBarView; | 21 class LocationBarView; |
| 21 | 22 |
| 22 namespace content { | 23 namespace content { |
| 23 class WebContents; | 24 class WebContents; |
| 24 } | 25 } |
| 25 | 26 |
| 26 namespace gfx { | 27 namespace gfx { |
| 27 class FontList; | 28 class FontList; |
| 28 } | 29 } |
| 29 | 30 |
| 30 namespace views { | 31 namespace views { |
| 32 class BubbleDelegateView; | |
| 31 class ImageView; | 33 class ImageView; |
| 34 class InkDropDelegate; | |
| 32 class Label; | 35 class Label; |
| 33 } | 36 } |
| 34 | 37 |
| 35 // The ContentSettingImageView displays an icon and optional text label for | 38 // The ContentSettingImageView displays an icon and optional text label for |
| 36 // various content settings affordances in the location bar (i.e. plugin | 39 // various content settings affordances in the location bar (i.e. plugin |
| 37 // blocking, geolocation). | 40 // blocking, geolocation). |
| 38 class ContentSettingImageView : public IconLabelBubbleView, | 41 class ContentSettingImageView : public IconLabelBubbleView, |
| 39 public gfx::AnimationDelegate, | 42 public gfx::AnimationDelegate, |
| 43 public views::InkDropHost, | |
|
varkha
2016/01/29 00:22:35
I have noticed that this class controls more views
| |
| 40 public views::WidgetObserver { | 44 public views::WidgetObserver { |
| 41 public: | 45 public: |
| 42 // ContentSettingImageView takes ownership of its |image_model|. | 46 // ContentSettingImageView takes ownership of its |image_model|. |
| 43 ContentSettingImageView(ContentSettingImageModel* image_model, | 47 ContentSettingImageView(ContentSettingImageModel* image_model, |
| 44 LocationBarView* parent, | 48 LocationBarView* parent, |
| 45 const gfx::FontList& font_list, | 49 const gfx::FontList& font_list, |
| 46 SkColor parent_background_color); | 50 SkColor parent_background_color); |
| 47 ~ContentSettingImageView() override; | 51 ~ContentSettingImageView() override; |
| 48 | 52 |
| 49 // Updates the decoration from the shown WebContents. | 53 // Updates the decoration from the shown WebContents. |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 64 bool ShouldShowBackground() const override; | 68 bool ShouldShowBackground() const override; |
| 65 double WidthMultiplier() const override; | 69 double WidthMultiplier() const override; |
| 66 | 70 |
| 67 // gfx::AnimationDelegate: | 71 // gfx::AnimationDelegate: |
| 68 void AnimationEnded(const gfx::Animation* animation) override; | 72 void AnimationEnded(const gfx::Animation* animation) override; |
| 69 void AnimationProgressed(const gfx::Animation* animation) override; | 73 void AnimationProgressed(const gfx::Animation* animation) override; |
| 70 void AnimationCanceled(const gfx::Animation* animation) override; | 74 void AnimationCanceled(const gfx::Animation* animation) override; |
| 71 | 75 |
| 72 // views::View: | 76 // views::View: |
| 73 const char* GetClassName() const override; | 77 const char* GetClassName() const override; |
| 78 void Layout() override; | |
| 79 void OnBoundsChanged(const gfx::Rect& previous_bounds) override; | |
| 74 bool OnMousePressed(const ui::MouseEvent& event) override; | 80 bool OnMousePressed(const ui::MouseEvent& event) override; |
| 75 void OnMouseReleased(const ui::MouseEvent& event) override; | 81 void OnMouseReleased(const ui::MouseEvent& event) override; |
| 76 void OnGestureEvent(ui::GestureEvent* event) override; | 82 void OnGestureEvent(ui::GestureEvent* event) override; |
| 77 void OnNativeThemeChanged(const ui::NativeTheme* native_theme) override; | 83 void OnNativeThemeChanged(const ui::NativeTheme* native_theme) override; |
| 78 | 84 |
| 85 // views::InkDropHost: | |
| 86 void AddInkDropLayer(ui::Layer* ink_drop_layer) override; | |
| 87 void RemoveInkDropLayer(ui::Layer* ink_drop_layer) override; | |
| 88 gfx::Point CalculateInkDropCenter() const override; | |
| 89 bool ShouldShowInkDropHover() const override; | |
| 90 | |
| 79 // views::WidgetObserver: | 91 // views::WidgetObserver: |
| 80 void OnWidgetDestroying(views::Widget* widget) override; | 92 void OnWidgetDestroying(views::Widget* widget) override; |
| 93 void OnWidgetVisibilityChanged(views::Widget* widget, bool visible) override; | |
| 81 | 94 |
| 82 void OnClick(); | 95 void OnClick(); |
| 83 | 96 |
| 84 void UpdateImage(); | 97 void UpdateImage(); |
| 85 | 98 |
| 99 // Returns true if a related bubble is showing. | |
| 100 bool IsBubbleShowing() const; | |
| 101 | |
| 86 LocationBarView* parent_; // Weak, owns us. | 102 LocationBarView* parent_; // Weak, owns us. |
| 87 scoped_ptr<ContentSettingImageModel> content_setting_image_model_; | 103 scoped_ptr<ContentSettingImageModel> content_setting_image_model_; |
| 88 gfx::SlideAnimation slide_animator_; | 104 gfx::SlideAnimation slide_animator_; |
| 89 bool pause_animation_; | 105 bool pause_animation_; |
| 90 double pause_animation_state_; | 106 double pause_animation_state_; |
| 91 views::Widget* bubble_widget_; | 107 views::Widget* bubble_widget_; |
| 108 views::BubbleDelegateView* bubble_view_; | |
| 109 | |
| 110 // This is used to check if the bubble was showing during the mouse pressed | |
| 111 // event. If this is true then the mouse released event is ignored to prevent | |
| 112 // the bubble from reshowing. | |
| 113 bool suppress_mouse_released_action_; | |
| 114 | |
| 115 // Animation delegate for the ink drop ripple effect. | |
| 116 scoped_ptr<views::InkDropDelegate> ink_drop_delegate_; | |
| 92 | 117 |
| 93 DISALLOW_COPY_AND_ASSIGN(ContentSettingImageView); | 118 DISALLOW_COPY_AND_ASSIGN(ContentSettingImageView); |
| 94 }; | 119 }; |
| 95 | 120 |
| 96 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_CONTENT_SETTING_IMAGE_VIEW_H_ | 121 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_CONTENT_SETTING_IMAGE_VIEW_H_ |
| OLD | NEW |