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