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

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

Issue 1423263004: [MD] Use programmatic rendering for omnibox chips (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: self review Created 5 years, 1 month 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/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "chrome/browser/ui/views/location_bar/icon_label_bubble_view.h" 9 #include "chrome/browser/ui/views/location_bar/icon_label_bubble_view.h"
10 #include "components/content_settings/core/common/content_settings_types.h" 10 #include "components/content_settings/core/common/content_settings_types.h"
(...skipping 19 matching lines...) Expand all
30 class Label; 30 class Label;
31 } 31 }
32 32
33 // The ContentSettingImageView displays an icon and optional text label for 33 // The ContentSettingImageView displays an icon and optional text label for
34 // various content settings affordances in the location bar (i.e. plugin 34 // various content settings affordances in the location bar (i.e. plugin
35 // blocking, geolocation). 35 // blocking, geolocation).
36 class ContentSettingImageView : public IconLabelBubbleView, 36 class ContentSettingImageView : public IconLabelBubbleView,
37 public gfx::AnimationDelegate, 37 public gfx::AnimationDelegate,
38 public views::WidgetObserver { 38 public views::WidgetObserver {
39 public: 39 public:
40 // TODO(estade): remove |text_color| because it isn't necessary for MD.
40 ContentSettingImageView(ContentSettingsType content_type, 41 ContentSettingImageView(ContentSettingsType content_type,
41 LocationBarView* parent, 42 LocationBarView* parent,
42 const gfx::FontList& font_list, 43 const gfx::FontList& font_list,
43 SkColor text_color, 44 SkColor text_color,
44 SkColor parent_background_color); 45 SkColor parent_background_color);
45 ~ContentSettingImageView() override; 46 ~ContentSettingImageView() override;
46 47
47 // Updates the decoration from the shown WebContents. 48 // Updates the decoration from the shown WebContents.
48 void Update(content::WebContents* web_contents); 49 void Update(content::WebContents* web_contents);
49 50
50 private: 51 private:
51 // Number of milliseconds spent animating open; also the time spent animating 52 // Number of milliseconds spent animating open; also the time spent animating
52 // closed. 53 // closed.
53 static const int kOpenTimeMS; 54 static const int kOpenTimeMS;
54 55
55 // The total animation time, including open and close as well as an 56 // The total animation time, including open and close as well as an
56 // intervening "stay open" period. 57 // intervening "stay open" period.
57 static const int kAnimationDurationMS; 58 static const int kAnimationDurationMS;
58 59
59 // IconLabelBubbleView:: 60 // IconLabelBubbleView:
60 bool ShouldShowBackground() const override; 61 bool ShouldShowBackground() const override;
61 double WidthMultiplier() const override; 62 double WidthMultiplier() const override;
63 SkColor GetTextColor() const override;
64 SkColor GetBorderColor() const override;
Peter Kasting 2015/11/05 06:22:11 Nit: List overrides in the same order they appear
Evan Stade 2015/11/05 23:59:06 Done.
62 65
63 // gfx::AnimationDelegate: 66 // gfx::AnimationDelegate:
64 void AnimationEnded(const gfx::Animation* animation) override; 67 void AnimationEnded(const gfx::Animation* animation) override;
65 void AnimationProgressed(const gfx::Animation* animation) override; 68 void AnimationProgressed(const gfx::Animation* animation) override;
66 void AnimationCanceled(const gfx::Animation* animation) override; 69 void AnimationCanceled(const gfx::Animation* animation) override;
67 70
68 // views::View: 71 // views::View:
69 const char* GetClassName() const override; 72 const char* GetClassName() const override;
70 bool OnMousePressed(const ui::MouseEvent& event) override; 73 bool OnMousePressed(const ui::MouseEvent& event) override;
71 void OnMouseReleased(const ui::MouseEvent& event) override; 74 void OnMouseReleased(const ui::MouseEvent& event) override;
72 void OnGestureEvent(ui::GestureEvent* event) override; 75 void OnGestureEvent(ui::GestureEvent* event) override;
73 76
74 // views::WidgetObserver: 77 // views::WidgetObserver:
75 void OnWidgetDestroying(views::Widget* widget) override; 78 void OnWidgetDestroying(views::Widget* widget) override;
76 79
77 void OnClick(); 80 void OnClick();
78 81
79 LocationBarView* parent_; // Weak, owns us. 82 LocationBarView* parent_; // Weak, owns us.
80 scoped_ptr<ContentSettingImageModel> content_setting_image_model_; 83 scoped_ptr<ContentSettingImageModel> content_setting_image_model_;
81 gfx::SlideAnimation slide_animator_; 84 gfx::SlideAnimation slide_animator_;
82 bool pause_animation_; 85 bool pause_animation_;
83 double pause_animation_state_; 86 double pause_animation_state_;
84 views::Widget* bubble_widget_; 87 views::Widget* bubble_widget_;
85 88
86 DISALLOW_COPY_AND_ASSIGN(ContentSettingImageView); 89 DISALLOW_COPY_AND_ASSIGN(ContentSettingImageView);
87 }; 90 };
88 91
89 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_CONTENT_SETTING_IMAGE_VIEW_H_ 92 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_CONTENT_SETTING_IMAGE_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698