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_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(); | |
|
Peter Kasting
2016/08/26 20:59:12
This method seems to be unused.
Kevin Bailey
2016/08/29 13:38:10
Done.
| |
| 61 | |
| 52 private: | 62 private: |
| 63 // IconLabelBubbleView: | |
| 64 double WidthMultiplier() const override; | |
| 65 | |
| 66 // gfx::AnimationDelegate: | |
| 67 void AnimationProgressed(const gfx::Animation*) override; | |
| 68 | |
| 53 void ProcessLocatedEvent(const ui::LocatedEvent& event); | 69 void ProcessLocatedEvent(const ui::LocatedEvent& event); |
| 54 | 70 |
| 55 // Returns what the minimum size would be if the preferred size were |size|. | 71 // Returns what the minimum size would be if the preferred size were |size|. |
| 56 gfx::Size GetMinimumSizeForPreferredSize(gfx::Size size) const; | 72 gfx::Size GetMinimumSizeForPreferredSize(gfx::Size size) const; |
| 57 | 73 |
| 58 // Handles both click and gesture events by delegating to the page info | 74 // Handles both click and gesture events by delegating to the page info |
| 59 // helper in the appropriate circumstances. | 75 // helper in the appropriate circumstances. |
| 60 void OnClickOrTap(const ui::LocatedEvent& event); | 76 void OnClickOrTap(const ui::LocatedEvent& event); |
| 61 | 77 |
| 62 // Set to true when the bubble is already showing at the time the icon is | 78 // 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 | 79 // 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. | 80 // clicking the icon repeatedly will appear to toggle the bubble on and off. |
| 65 bool suppress_mouse_released_action_; | 81 bool suppress_mouse_released_action_; |
| 66 | 82 |
| 67 // True if hovering this view should display a tooltip. | 83 // True if hovering this view should display a tooltip. |
| 68 bool show_tooltip_; | 84 bool show_tooltip_; |
| 69 | 85 |
| 70 LocationBarView* location_bar_; | 86 LocationBarView* location_bar_; |
| 87 gfx::SlideAnimation animation_; | |
| 71 | 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 |