Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(30)

Side by Side Diff: chrome/browser/ui/views/toolbar/site_chip_view.h

Issue 92073003: [SiteChip] Draw site chip icon and site title. Drag support. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Unused var Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_TOOLBAR_SITE_CHIP_VIEW_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_TOOLBAR_SITE_CHIP_VIEW_H_
6 #define CHROME_BROWSER_UI_VIEWS_TOOLBAR_SITE_CHIP_VIEW_H_ 6 #define CHROME_BROWSER_UI_VIEWS_TOOLBAR_SITE_CHIP_VIEW_H_
7 7
8 #include "chrome/browser/ui/toolbar/toolbar_model.h"
8 #include "chrome/browser/ui/views/location_bar/location_icon_view.h" 9 #include "chrome/browser/ui/views/location_bar/location_icon_view.h"
9 #include "chrome/browser/ui/views/toolbar/toolbar_button.h" 10 #include "chrome/browser/ui/views/toolbar/toolbar_button.h"
10 #include "ui/views/controls/button/button.h" 11 #include "ui/views/controls/button/button.h"
12 #include "ui/views/drag_controller.h"
11 13
14 class SiteChipExtensionIcon;
12 class ToolbarView; 15 class ToolbarView;
13 16
14 namespace content { 17 namespace content {
15 class WebContents; 18 class WebContents;
16 } 19 }
17 20
18 namespace gfx { 21 namespace gfx {
19 class Canvas; 22 class Canvas;
20 } 23 }
21 24
22 namespace views { 25 namespace views {
23 class Button; 26 class Button;
24 class Label; 27 class Label;
25 } 28 }
26 29
27 class SiteChipView : public ToolbarButton, 30 class SiteChipView : public ToolbarButton,
28 public views::ButtonListener { 31 public views::ButtonListener,
32 public views::DragController {
29 public: 33 public:
30 explicit SiteChipView(ToolbarView* toolbar_view); 34 explicit SiteChipView(ToolbarView* toolbar_view);
31 virtual ~SiteChipView(); 35 virtual ~SiteChipView();
32 36
33 void Init(); 37 void Init();
34 38
35 // Returns true if the site chip experiment is enabled and thus the site chip 39 // Returns true if the site chip experiment is enabled and thus the site chip
36 // should be shown in the toolbar. 40 // should be shown in the toolbar.
37 bool ShouldShow(); 41 bool ShouldShow();
38 42
39 // Recalculates the contents of the Site Chip based on the displayed tab. 43 // Recalculates the contents of the Site Chip based on the displayed tab.
40 void Update(content::WebContents* tab); 44 void Update(content::WebContents* tab);
41 45
42 views::ImageView* location_icon_view() { return location_icon_view_; } 46 void OnChanged();
msw 2013/12/11 21:54:44 nit: Add a comment.
Greg Billock 2013/12/11 22:34:08 Done.
47
48 views::ImageView* location_icon_view() {
49 return location_icon_view_;
50 }
51 const views::ImageView* location_icon_view() const {
52 return location_icon_view_;
53 }
43 54
44 // ToolbarButton: 55 // ToolbarButton:
45 virtual gfx::Size GetPreferredSize() OVERRIDE; 56 virtual gfx::Size GetPreferredSize() OVERRIDE;
46 virtual void Layout() OVERRIDE; 57 virtual void Layout() OVERRIDE;
47 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; 58 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
48 59
49 // views::ButtonListener: 60 // views::ButtonListener:
50 virtual void ButtonPressed(views::Button* sender, 61 virtual void ButtonPressed(views::Button* sender,
51 const ui::Event& event) OVERRIDE; 62 const ui::Event& event) OVERRIDE;
52 63
64 // views::DragController:
65 virtual void WriteDragDataForView(View* sender,
66 const gfx::Point& press_pt,
67 OSExchangeData* data) OVERRIDE;
68 virtual int GetDragOperationsForView(View* sender,
69 const gfx::Point& p) OVERRIDE;
70 virtual bool CanStartDragForView(View* sender,
71 const gfx::Point& press_pt,
72 const gfx::Point& p) OVERRIDE;
73
53 private: 74 private:
75 string16 SiteLabelFromURL(const GURL& url);
76
54 ToolbarView* toolbar_view_; 77 ToolbarView* toolbar_view_;
55 views::Label* host_label_; 78 views::Label* host_label_;
56 LocationIconView* location_icon_view_; 79 LocationIconView* location_icon_view_;
57 scoped_ptr<views::Painter> background_painter_; 80 scoped_ptr<views::Painter> ev_background_painter_;
81 scoped_ptr<views::Painter> broken_ssl_background_painter_;
82 // Will point to one of the background painters, or NULL if the state of the
83 // chip has no background.
84 views::Painter* painter_;
85 bool showing_16x16_icon_;
86 scoped_ptr<SiteChipExtensionIcon> extension_icon_;
87 GURL url_displayed_;
88 string16 host_;
89 ToolbarModel::SecurityLevel security_level_;
58 90
59 DISALLOW_COPY_AND_ASSIGN(SiteChipView); 91 DISALLOW_COPY_AND_ASSIGN(SiteChipView);
60 }; 92 };
61 93
62 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_SITE_CHIP_VIEW_H_ 94 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_SITE_CHIP_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698