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_LOCATION_ICON_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_ICON_VIEW_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_ICON_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_ICON_VIEW_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.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 "ui/gfx/animation/animation_delegate.h" | |
11 #include "ui/gfx/animation/slide_animation.h" | |
10 | 12 |
11 class LocationBarView; | 13 class LocationBarView; |
12 | 14 |
13 namespace ui { | 15 namespace ui { |
14 class KeyEvent; | 16 class KeyEvent; |
15 class LocatedEvent; | 17 class LocatedEvent; |
16 } | 18 } |
17 | 19 |
18 // Use a LocationIconView to display an icon on the leading side of the edit | 20 // Use a LocationIconView to display an icon on the leading side of the edit |
19 // field. It shows the user's current action (while the user is editing), or the | 21 // field. It shows the user's current action (while the user is editing), or the |
20 // page security status (after navigation has completed). | 22 // page security status (after navigation has completed). |
21 class LocationIconView : public IconLabelBubbleView { | 23 class LocationIconView : public IconLabelBubbleView, |
24 public gfx::AnimationDelegate { | |
22 public: | 25 public: |
23 LocationIconView(const gfx::FontList& font_list, | 26 LocationIconView(const gfx::FontList& font_list, |
24 SkColor parent_background_color, | 27 SkColor parent_background_color, |
25 LocationBarView* location_bar); | 28 LocationBarView* location_bar); |
26 ~LocationIconView() override; | 29 ~LocationIconView() override; |
27 | 30 |
28 // IconLabelBubbleView: | 31 // IconLabelBubbleView: |
29 gfx::Size GetMinimumSize() const override; | 32 gfx::Size GetMinimumSize() const override; |
30 bool OnMousePressed(const ui::MouseEvent& event) override; | 33 bool OnMousePressed(const ui::MouseEvent& event) override; |
31 bool OnMouseDragged(const ui::MouseEvent& event) override; | 34 bool OnMouseDragged(const ui::MouseEvent& event) override; |
(...skipping 10 matching lines...) Expand all Loading... | |
42 | 45 |
43 // Returns what the minimum size would be if the label text were |text|. | 46 // Returns what the minimum size would be if the label text were |text|. |
44 gfx::Size GetMinimumSizeForLabelText(const base::string16& text) const; | 47 gfx::Size GetMinimumSizeForLabelText(const base::string16& text) const; |
45 | 48 |
46 const gfx::FontList& GetFontList() const { return font_list(); } | 49 const gfx::FontList& GetFontList() const { return font_list(); } |
47 | 50 |
48 // Set the background image. Pass false for |should_show_ev| for all non-EV | 51 // Set the background image. Pass false for |should_show_ev| for all non-EV |
49 // HTTPS contexts. | 52 // HTTPS contexts. |
50 void SetBackground(bool should_show_ev); | 53 void SetBackground(bool should_show_ev); |
51 | 54 |
55 void AnimateSecurityChip(); | |
56 // Immediately show full security chip. | |
57 void ShowSecurityChip(); | |
58 // Immediately hide security chip. | |
59 void HideSecurityChip(); | |
60 bool IsAnimatingSecurityChip(); | |
61 | |
52 private: | 62 private: |
53 void ProcessLocatedEvent(const ui::LocatedEvent& event); | 63 void ProcessLocatedEvent(const ui::LocatedEvent& event); |
54 | 64 |
55 // Returns what the minimum size would be if the preferred size were |size|. | 65 // Returns what the minimum size would be if the preferred size were |size|. |
56 gfx::Size GetMinimumSizeForPreferredSize(gfx::Size size) const; | 66 gfx::Size GetMinimumSizeForPreferredSize(gfx::Size size) const; |
57 | 67 |
58 // Handles both click and gesture events by delegating to the page info | 68 // Handles both click and gesture events by delegating to the page info |
59 // helper in the appropriate circumstances. | 69 // helper in the appropriate circumstances. |
60 void OnClickOrTap(const ui::LocatedEvent& event); | 70 void OnClickOrTap(const ui::LocatedEvent& event); |
61 | 71 |
72 // gfx::AnimationDelegate: | |
Peter Kasting
2016/08/20 01:16:43
Nit: The public section puts overrides above non-v
Kevin Bailey
2016/08/22 15:58:57
I moved them up and added an annotation.
| |
73 void AnimationProgressed(const gfx::Animation*) override; | |
74 | |
Peter Kasting
2016/08/20 01:16:43
Nit: No blank line
Kevin Bailey
2016/08/22 15:58:57
Might be ok after latest change.
| |
75 double WidthMultiplier() const override; | |
76 | |
62 // Set to true when the bubble is already showing at the time the icon is | 77 // Set to true when the bubble is already showing at the time the icon is |
63 // clicked. This suppresses re-showing the bubble on mouse release, so that | 78 // clicked. This suppresses re-showing the bubble on mouse release, so that |
64 // clicking the icon repeatedly will appear to toggle the bubble on and off. | 79 // clicking the icon repeatedly will appear to toggle the bubble on and off. |
65 bool suppress_mouse_released_action_; | 80 bool suppress_mouse_released_action_; |
66 | 81 |
67 // True if hovering this view should display a tooltip. | 82 // True if hovering this view should display a tooltip. |
68 bool show_tooltip_; | 83 bool show_tooltip_; |
69 | 84 |
70 LocationBarView* location_bar_; | 85 LocationBarView* location_bar_; |
71 | 86 |
Peter Kasting
2016/08/20 01:16:43
Nit: No blank line
Kevin Bailey
2016/08/22 15:58:57
Done.
| |
87 gfx::SlideAnimation animation_; | |
88 | |
72 DISALLOW_COPY_AND_ASSIGN(LocationIconView); | 89 DISALLOW_COPY_AND_ASSIGN(LocationIconView); |
73 }; | 90 }; |
74 | 91 |
75 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_ICON_VIEW_H_ | 92 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_ICON_VIEW_H_ |
OLD | NEW |