| 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 | 10 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 ~LocationIconView() override; | 26 ~LocationIconView() override; |
| 27 | 27 |
| 28 // IconLabelBubbleView: | 28 // IconLabelBubbleView: |
| 29 gfx::Size GetMinimumSize() const override; | 29 gfx::Size GetMinimumSize() const override; |
| 30 bool OnMousePressed(const ui::MouseEvent& event) override; | 30 bool OnMousePressed(const ui::MouseEvent& event) override; |
| 31 bool OnMouseDragged(const ui::MouseEvent& event) override; | 31 bool OnMouseDragged(const ui::MouseEvent& event) override; |
| 32 void OnMouseReleased(const ui::MouseEvent& event) override; | 32 void OnMouseReleased(const ui::MouseEvent& event) override; |
| 33 bool OnKeyPressed(const ui::KeyEvent& event) override; | 33 bool OnKeyPressed(const ui::KeyEvent& event) override; |
| 34 bool OnKeyReleased(const ui::KeyEvent& event) override; | 34 bool OnKeyReleased(const ui::KeyEvent& event) override; |
| 35 void OnGestureEvent(ui::GestureEvent* event) override; | 35 void OnGestureEvent(ui::GestureEvent* event) override; |
| 36 bool GetTooltipText(const gfx::Point& p, |
| 37 base::string16* tooltip) const override; |
| 36 SkColor GetTextColor() const override; | 38 SkColor GetTextColor() const override; |
| 37 SkColor GetBorderColor() const override; | 39 SkColor GetBorderColor() const override; |
| 38 | 40 |
| 39 // Whether we should show the tooltip for this icon or not. | 41 // Whether we should show the tooltip for this icon or not. |
| 40 void ShowTooltip(bool show); | 42 void set_show_tooltip(bool show_tooltip) { show_tooltip_ = show_tooltip; } |
| 41 | 43 |
| 42 // 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|. |
| 43 gfx::Size GetMinimumSizeForLabelText(const base::string16& text) const; | 45 gfx::Size GetMinimumSizeForLabelText(const base::string16& text) const; |
| 44 | 46 |
| 45 const gfx::FontList& GetFontList() const { return font_list(); } | 47 const gfx::FontList& GetFontList() const { return font_list(); } |
| 46 | 48 |
| 47 // Set the background image. Pass false for |should_show_ev| for all non-EV | 49 // Set the background image. Pass false for |should_show_ev| for all non-EV |
| 48 // HTTPS contexts. | 50 // HTTPS contexts. |
| 49 void SetBackground(bool should_show_ev); | 51 void SetBackground(bool should_show_ev); |
| 50 | 52 |
| 51 private: | 53 private: |
| 52 void ProcessEvent(const ui::LocatedEvent& event); | 54 void ProcessEvent(const ui::LocatedEvent& event); |
| 53 void ProcessEvent(const ui::KeyEvent& event); | 55 void ProcessEvent(const ui::KeyEvent& event); |
| 54 | 56 |
| 55 // Returns what the minimum size would be if the preferred size were |size|. | 57 // Returns what the minimum size would be if the preferred size were |size|. |
| 56 gfx::Size GetMinimumSizeForPreferredSize(gfx::Size size) const; | 58 gfx::Size GetMinimumSizeForPreferredSize(gfx::Size size) const; |
| 57 | 59 |
| 58 // Handles both click and gesture events by delegating to the page info | 60 // Handles both click and gesture events by delegating to the page info |
| 59 // helper in the appropriate circumstances. | 61 // helper in the appropriate circumstances. |
| 60 void OnClickOrTap(const ui::LocatedEvent& event); | 62 void OnClickOrTap(const ui::LocatedEvent& event); |
| 61 | 63 |
| 62 // Set to true when the bubble is already showing at the time the icon is | 64 // 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 | 65 // 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. | 66 // clicking the icon repeatedly will appear to toggle the bubble on and off. |
| 65 bool suppress_mouse_released_action_; | 67 bool suppress_mouse_released_action_; |
| 66 | 68 |
| 69 // True if hovering this view should display a tooltip. |
| 70 bool show_tooltip_; |
| 71 |
| 67 LocationBarView* location_bar_; | 72 LocationBarView* location_bar_; |
| 68 | 73 |
| 69 DISALLOW_COPY_AND_ASSIGN(LocationIconView); | 74 DISALLOW_COPY_AND_ASSIGN(LocationIconView); |
| 70 }; | 75 }; |
| 71 | 76 |
| 72 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_ICON_VIEW_H_ | 77 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_LOCATION_ICON_VIEW_H_ |
| OLD | NEW |