Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(319)

Side by Side Diff: chrome/browser/ui/views/location_bar/content_setting_image_view.h

Issue 1518543002: Adds MD ink ripple animations to buttons within location bar (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adds MD ink ripple animations to buttons within location bar (missing member init) Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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,
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
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::BubbleDelegateView* bubble_view_;
108
109 // This is used to check if the bubble was showing during the mouse pressed
110 // event. If this is true then the mouse released event is ignored to prevent
111 // the bubble from reshowing.
112 bool suppress_mouse_released_action_;
113
114 // Animation delegate for the ink drop ripple effect.
115 scoped_ptr<views::InkDropDelegate> ink_drop_delegate_;
92 116
93 DISALLOW_COPY_AND_ASSIGN(ContentSettingImageView); 117 DISALLOW_COPY_AND_ASSIGN(ContentSettingImageView);
94 }; 118 };
95 119
96 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_CONTENT_SETTING_IMAGE_VIEW_H_ 120 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_CONTENT_SETTING_IMAGE_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698