OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "chrome/browser/extensions/image_loading_tracker.h" | 13 #include "chrome/browser/extensions/image_loading_tracker.h" |
14 #include "chrome/browser/extensions/extension_context_menu_model.h" | 14 #include "chrome/browser/extensions/extension_context_menu_model.h" |
15 #include "chrome/browser/ui/views/extensions/extension_popup.h" | 15 #include "chrome/browser/ui/views/extensions/extension_popup.h" |
16 #include "views/controls/image_view.h" | 16 #include "views/controls/image_view.h" |
17 | 17 |
18 class LocationBarView; | 18 class LocationBarView; |
19 namespace views { | |
20 class Menu2; | |
21 }; | |
22 | 19 |
23 // PageActionImageView is used by the LocationBarView to display the icon for a | 20 // PageActionImageView is used by the LocationBarView to display the icon for a |
24 // given PageAction and notify the extension when the icon is clicked. | 21 // given PageAction and notify the extension when the icon is clicked. |
25 class PageActionImageView : public views::ImageView, | 22 class PageActionImageView : public views::ImageView, |
26 public ImageLoadingTracker::Observer, | 23 public ImageLoadingTracker::Observer, |
27 public ExtensionContextMenuModel::PopupDelegate, | 24 public ExtensionContextMenuModel::PopupDelegate, |
28 public ExtensionPopup::Observer { | 25 public ExtensionPopup::Observer { |
29 public: | 26 public: |
30 PageActionImageView(LocationBarView* owner, | 27 PageActionImageView(LocationBarView* owner, |
31 Profile* profile, | 28 Profile* profile, |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 Profile* profile_; | 75 Profile* profile_; |
79 | 76 |
80 // The PageAction that this view represents. The PageAction is not owned by | 77 // The PageAction that this view represents. The PageAction is not owned by |
81 // us, it resides in the extension of this particular profile. | 78 // us, it resides in the extension of this particular profile. |
82 ExtensionAction* page_action_; | 79 ExtensionAction* page_action_; |
83 | 80 |
84 // A cache of bitmaps the page actions might need to show, mapped by path. | 81 // A cache of bitmaps the page actions might need to show, mapped by path. |
85 typedef std::map<std::string, SkBitmap> PageActionMap; | 82 typedef std::map<std::string, SkBitmap> PageActionMap; |
86 PageActionMap page_action_icons_; | 83 PageActionMap page_action_icons_; |
87 | 84 |
88 // The context menu for this page action. | |
89 scoped_refptr<ExtensionContextMenuModel> context_menu_contents_; | |
90 scoped_ptr<views::Menu2> context_menu_menu_; | |
91 | |
92 // The object that is waiting for the image loading to complete | 85 // The object that is waiting for the image loading to complete |
93 // asynchronously. | 86 // asynchronously. |
94 ImageLoadingTracker tracker_; | 87 ImageLoadingTracker tracker_; |
95 | 88 |
96 // The tab id we are currently showing the icon for. | 89 // The tab id we are currently showing the icon for. |
97 int current_tab_id_; | 90 int current_tab_id_; |
98 | 91 |
99 // The URL we are currently showing the icon for. | 92 // The URL we are currently showing the icon for. |
100 GURL current_url_; | 93 GURL current_url_; |
101 | 94 |
102 // The string to show for a tooltip; | 95 // The string to show for a tooltip; |
103 std::string tooltip_; | 96 std::string tooltip_; |
104 | 97 |
105 // This is used for post-install visual feedback. The page_action icon is | 98 // This is used for post-install visual feedback. The page_action icon is |
106 // briefly shown even if it hasn't been enabled by its extension. | 99 // briefly shown even if it hasn't been enabled by its extension. |
107 bool preview_enabled_; | 100 bool preview_enabled_; |
108 | 101 |
109 // The current popup and the button it came from. NULL if no popup. | 102 // The current popup and the button it came from. NULL if no popup. |
110 ExtensionPopup* popup_; | 103 ExtensionPopup* popup_; |
111 | 104 |
112 DISALLOW_IMPLICIT_CONSTRUCTORS(PageActionImageView); | 105 DISALLOW_IMPLICIT_CONSTRUCTORS(PageActionImageView); |
113 }; | 106 }; |
114 | 107 |
115 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_PAGE_ACTION_IMAGE_VIEW_H_ | 108 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_PAGE_ACTION_IMAGE_VIEW_H_ |
OLD | NEW |