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

Side by Side Diff: chrome/browser/ui/views/location_bar/page_action_image_view.h

Issue 661493004: Add infrastructure for Chrome Actions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months 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
OLDNEW
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_PAGE_ACTION_IMAGE_VIEW_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_PAGE_ACTION_IMAGE_VIEW_H_
6 #define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_PAGE_ACTION_IMAGE_VIEW_H_ 6 #define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_PAGE_ACTION_IMAGE_VIEW_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "chrome/browser/ui/views/extensions/extension_action_view_controller.h" 11 #include "chrome/browser/ui/views/extensions/extension_action_view_controller.h"
12 #include "chrome/browser/ui/views/extensions/extension_action_view_delegate.h" 12 #include "chrome/browser/ui/views/toolbar/toolbar_action_view_delegate.h"
13 #include "ui/views/controls/image_view.h" 13 #include "ui/views/controls/image_view.h"
14 14
15 class Browser; 15 class Browser;
16 class ExtensionAction; 16 class ExtensionAction;
17 class LocationBarView; 17 class LocationBarView;
18 18
19 namespace content { 19 namespace content {
20 class WebContents; 20 class WebContents;
21 } 21 }
22 22
23 // PageActionImageView is used by the LocationBarView to display the icon for a 23 // PageActionImageView is used by the LocationBarView to display the icon for a
24 // given PageAction and notify the extension when the icon is clicked. 24 // given PageAction and notify the extension when the icon is clicked.
25 class PageActionImageView : public ExtensionActionViewDelegate, 25 class PageActionImageView : public ToolbarActionViewDelegate,
26 public views::ImageView { 26 public views::ImageView {
27 public: 27 public:
28 PageActionImageView(LocationBarView* owner, 28 PageActionImageView(LocationBarView* owner,
29 ExtensionAction* page_action, 29 ExtensionAction* page_action,
30 Browser* browser); 30 Browser* browser);
31 virtual ~PageActionImageView(); 31 virtual ~PageActionImageView();
32 32
33 void set_preview_enabled(bool preview_enabled) { 33 void set_preview_enabled(bool preview_enabled) {
34 preview_enabled_ = preview_enabled; 34 preview_enabled_ = preview_enabled;
35 } 35 }
(...skipping 16 matching lines...) Expand all
52 // visible or hidden. |contents| is the WebContents that is active. 52 // visible or hidden. |contents| is the WebContents that is active.
53 void UpdateVisibility(content::WebContents* contents); 53 void UpdateVisibility(content::WebContents* contents);
54 54
55 private: 55 private:
56 static const char kViewClassName[]; 56 static const char kViewClassName[];
57 57
58 // Overridden from View. 58 // Overridden from View.
59 virtual void PaintChildren(gfx::Canvas* canvas, 59 virtual void PaintChildren(gfx::Canvas* canvas,
60 const views::CullSet& cull_set) override; 60 const views::CullSet& cull_set) override;
61 61
62 // Overridden from ExtensionActionViewDelegate: 62 // ToolbarActionViewDelegate:
63 virtual void OnIconUpdated() override; 63 virtual void OnIconUpdated() override;
64 virtual views::View* GetAsView() override; 64 virtual views::View* GetAsView() override;
65 virtual bool IsShownInMenu() override; 65 virtual bool IsShownInMenu() override;
66 virtual views::FocusManager* GetFocusManagerForAccelerator() override; 66 virtual views::FocusManager* GetFocusManagerForAccelerator() override;
67 virtual views::Widget* GetParentForContextMenu() override; 67 virtual views::Widget* GetParentForContextMenu() override;
68 virtual ExtensionActionViewController* GetPreferredPopupViewController() 68 virtual ExtensionActionViewController* GetPreferredPopupViewController()
69 override; 69 override;
70 virtual views::View* GetReferenceViewForPopup() override; 70 virtual views::View* GetReferenceViewForPopup() override;
71 virtual views::MenuButton* GetContextMenuButton() override; 71 virtual views::MenuButton* GetContextMenuButton() override;
72 virtual content::WebContents* GetCurrentWebContents() override; 72 virtual content::WebContents* GetCurrentWebContents() const override;
73 virtual void HideActivePopup() override; 73 virtual void HideActivePopup() override;
74 74
75 // The controller for this ExtensionAction view. 75 // The controller for this ExtensionAction view.
76 scoped_ptr<ExtensionActionViewController> view_controller_; 76 scoped_ptr<ExtensionActionViewController> view_controller_;
77 77
78 // The location bar view that owns us. 78 // The location bar view that owns us.
79 LocationBarView* owner_; 79 LocationBarView* owner_;
80 80
81 // The string to show for a tooltip; 81 // The string to show for a tooltip;
82 std::string tooltip_; 82 std::string tooltip_;
83 83
84 // This is used for post-install visual feedback. The page_action icon is 84 // This is used for post-install visual feedback. The page_action icon is
85 // briefly shown even if it hasn't been enabled by its extension. 85 // briefly shown even if it hasn't been enabled by its extension.
86 bool preview_enabled_; 86 bool preview_enabled_;
87 87
88 DISALLOW_IMPLICIT_CONSTRUCTORS(PageActionImageView); 88 DISALLOW_IMPLICIT_CONSTRUCTORS(PageActionImageView);
89 }; 89 };
90 90
91 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_PAGE_ACTION_IMAGE_VIEW_H_ 91 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_PAGE_ACTION_IMAGE_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698