OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_UI_VIEWS_TOOLBAR_SITE_CHIP_VIEW_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_TOOLBAR_SITE_CHIP_VIEW_H_ |
| 7 |
| 8 #include "chrome/browser/ui/views/location_bar/location_icon_view.h" |
| 9 #include "chrome/browser/ui/views/toolbar/toolbar_button.h" |
| 10 #include "ui/views/controls/button/button.h" |
| 11 |
| 12 class ToolbarView; |
| 13 |
| 14 namespace content { |
| 15 class WebContents; |
| 16 } |
| 17 |
| 18 namespace gfx { |
| 19 class Canvas; |
| 20 } |
| 21 |
| 22 namespace views { |
| 23 class Button; |
| 24 class Label; |
| 25 } |
| 26 |
| 27 class SiteChipView : public ToolbarButton, |
| 28 public views::ButtonListener { |
| 29 public: |
| 30 explicit SiteChipView(ToolbarView* toolbar_view); |
| 31 virtual ~SiteChipView(); |
| 32 |
| 33 void Init(); |
| 34 |
| 35 // Returns true if the site chip experiment is enabled and thus the site chip |
| 36 // should be shown in the toolbar. |
| 37 bool ShouldShow(); |
| 38 |
| 39 // Recalculates the contents of the Site Chip based on the displayed tab. |
| 40 void Update(content::WebContents* tab); |
| 41 |
| 42 views::ImageView* location_icon_view() { return location_icon_view_; } |
| 43 |
| 44 // ToolbarButton: |
| 45 virtual gfx::Size GetPreferredSize() OVERRIDE; |
| 46 virtual void Layout() OVERRIDE; |
| 47 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; |
| 48 |
| 49 // views::ButtonListener: |
| 50 virtual void ButtonPressed(views::Button* sender, |
| 51 const ui::Event& event) OVERRIDE; |
| 52 |
| 53 private: |
| 54 ToolbarView* toolbar_view_; |
| 55 views::Label* host_label_; |
| 56 LocationIconView* location_icon_view_; |
| 57 scoped_ptr<views::Painter> background_painter_; |
| 58 |
| 59 DISALLOW_COPY_AND_ASSIGN(SiteChipView); |
| 60 }; |
| 61 |
| 62 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_SITE_CHIP_VIEW_H_ |
OLD | NEW |