| 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" | 10 #include "ui/gfx/animation/animation_delegate.h" |
| 11 #include "ui/gfx/animation/slide_animation.h" | 11 #include "ui/gfx/animation/slide_animation.h" |
| 12 | 12 |
| 13 class LocationBarView; | 13 class LocationBarView; |
| 14 | 14 |
| 15 namespace ui { | 15 namespace ui { |
| 16 class KeyEvent; | 16 class KeyEvent; |
| 17 class LocatedEvent; | 17 class LocatedEvent; |
| 18 } | 18 } |
| 19 | 19 |
| 20 // 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 |
| 21 // 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 |
| 22 // page security status (after navigation has completed). | 22 // page security status (after navigation has completed). |
| 23 class LocationIconView : public IconLabelBubbleView, | 23 class LocationIconView : public IconLabelBubbleView, |
| 24 public gfx::AnimationDelegate { | 24 public gfx::AnimationDelegate { |
| 25 public: | 25 public: |
| 26 LocationIconView(const gfx::FontList& font_list, | 26 LocationIconView(const gfx::FontList& font_list, |
| 27 SkColor parent_background_color, | |
| 28 LocationBarView* location_bar); | 27 LocationBarView* location_bar); |
| 29 ~LocationIconView() override; | 28 ~LocationIconView() override; |
| 30 | 29 |
| 31 // IconLabelBubbleView: | 30 // IconLabelBubbleView: |
| 32 gfx::Size GetMinimumSize() const override; | 31 gfx::Size GetMinimumSize() const override; |
| 33 bool OnMousePressed(const ui::MouseEvent& event) override; | 32 bool OnMousePressed(const ui::MouseEvent& event) override; |
| 34 bool OnMouseDragged(const ui::MouseEvent& event) override; | 33 bool OnMouseDragged(const ui::MouseEvent& event) override; |
| 35 void OnMouseReleased(const ui::MouseEvent& event) override; | 34 void OnMouseReleased(const ui::MouseEvent& event) override; |
| 36 void OnGestureEvent(ui::GestureEvent* event) override; | 35 void OnGestureEvent(ui::GestureEvent* event) override; |
| 37 bool GetTooltipText(const gfx::Point& p, | 36 bool GetTooltipText(const gfx::Point& p, |
| 38 base::string16* tooltip) const override; | 37 base::string16* tooltip) const override; |
| 39 SkColor GetTextColor() const override; | 38 SkColor GetTextColor() const override; |
| 40 SkColor GetBorderColor() const override; | |
| 41 bool OnActivate(const ui::Event& event) override; | 39 bool OnActivate(const ui::Event& event) override; |
| 42 | 40 |
| 43 // Whether we should show the tooltip for this icon or not. | 41 // Whether we should show the tooltip for this icon or not. |
| 44 void set_show_tooltip(bool show_tooltip) { show_tooltip_ = show_tooltip; } | 42 void set_show_tooltip(bool show_tooltip) { show_tooltip_ = show_tooltip; } |
| 45 | 43 |
| 46 // Returns what the minimum size would be if the label text were |text|. | 44 // Returns what the minimum size would be if the label text were |text|. |
| 47 gfx::Size GetMinimumSizeForLabelText(const base::string16& text) const; | 45 gfx::Size GetMinimumSizeForLabelText(const base::string16& text) const; |
| 48 | 46 |
| 49 const gfx::FontList& GetFontList() const { return font_list(); } | 47 const gfx::FontList& GetFontList() const { return font_list(); } |
| 50 | 48 |
| 51 // Set the background image. Pass false for |should_show_ev| for all non-EV | |
| 52 // HTTPS contexts. | |
| 53 void SetBackground(bool should_show_ev); | |
| 54 | |
| 55 // Sets whether the verbose security state text should be visible. | 49 // Sets whether the verbose security state text should be visible. |
| 56 // |should_animate| controls whether any necessary transition to this state | 50 // |should_animate| controls whether any necessary transition to this state |
| 57 // should be animated. | 51 // should be animated. |
| 58 void SetSecurityState(bool should_show, bool should_animate); | 52 void SetSecurityState(bool should_show, bool should_animate); |
| 59 | 53 |
| 60 private: | 54 private: |
| 61 // IconLabelBubbleView: | 55 // IconLabelBubbleView: |
| 62 double WidthMultiplier() const override; | 56 double WidthMultiplier() const override; |
| 63 | 57 |
| 64 // gfx::AnimationDelegate: | 58 // gfx::AnimationDelegate: |
| (...skipping 16 matching lines...) Expand all Loading... |
| 81 // True if hovering this view should display a tooltip. | 75 // True if hovering this view should display a tooltip. |
| 82 bool show_tooltip_; | 76 bool show_tooltip_; |
| 83 | 77 |
| 84 LocationBarView* location_bar_; | 78 LocationBarView* location_bar_; |
| 85 gfx::SlideAnimation animation_; | 79 gfx::SlideAnimation animation_; |
| 86 | 80 |
| 87 DISALLOW_COPY_AND_ASSIGN(LocationIconView); | 81 DISALLOW_COPY_AND_ASSIGN(LocationIconView); |
| 88 }; | 82 }; |
| 89 | 83 |
| 90 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_ICON_VIEW_H_ | 84 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_ICON_VIEW_H_ |
| OLD | NEW |