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

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

Issue 9703099: Revert 126959 - Re-factor location bar/toolbar code to get rid of the browser dependency. This CL i… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 9 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 | Annotate | Revision Log
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 #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/extension_context_menu_model.h" 13 #include "chrome/browser/extensions/extension_context_menu_model.h"
14 #include "chrome/browser/extensions/image_loading_tracker.h" 14 #include "chrome/browser/extensions/image_loading_tracker.h"
15 #include "chrome/browser/ui/views/extensions/extension_popup.h" 15 #include "chrome/browser/ui/views/extensions/extension_popup.h"
16 #include "ui/views/controls/image_view.h" 16 #include "ui/views/controls/image_view.h"
17 17
18 class Browser;
19 class LocationBarView; 18 class LocationBarView;
20 19
21 namespace content { 20 namespace content {
22 class WebContents; 21 class WebContents;
23 } 22 }
24 namespace views { 23 namespace views {
25 class MenuRunner; 24 class MenuRunner;
26 } 25 }
27 26
28 // PageActionImageView is used by the LocationBarView to display the icon for a 27 // PageActionImageView is used by the LocationBarView to display the icon for a
29 // given PageAction and notify the extension when the icon is clicked. 28 // given PageAction and notify the extension when the icon is clicked.
30 class PageActionImageView : public views::ImageView, 29 class PageActionImageView : public views::ImageView,
31 public ImageLoadingTracker::Observer, 30 public ImageLoadingTracker::Observer,
32 public ExtensionContextMenuModel::PopupDelegate, 31 public ExtensionContextMenuModel::PopupDelegate,
33 public views::Widget::Observer, 32 public views::Widget::Observer,
34 public content::NotificationObserver { 33 public content::NotificationObserver {
35 public: 34 public:
36 PageActionImageView(LocationBarView* owner, 35 PageActionImageView(LocationBarView* owner,
37 ExtensionAction* page_action, 36 ExtensionAction* page_action);
38 Browser* browser);
39 virtual ~PageActionImageView(); 37 virtual ~PageActionImageView();
40 38
41 ExtensionAction* page_action() { return page_action_; } 39 ExtensionAction* page_action() { return page_action_; }
42 40
43 int current_tab_id() { return current_tab_id_; } 41 int current_tab_id() { return current_tab_id_; }
44 42
45 void set_preview_enabled(bool preview_enabled) { 43 void set_preview_enabled(bool preview_enabled) {
46 preview_enabled_ = preview_enabled; 44 preview_enabled_ = preview_enabled;
47 } 45 }
48 46
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 // Hides the active popup, if there is one. 84 // Hides the active popup, if there is one.
87 void HidePopup(); 85 void HidePopup();
88 86
89 // The location bar view that owns us. 87 // The location bar view that owns us.
90 LocationBarView* owner_; 88 LocationBarView* owner_;
91 89
92 // The PageAction that this view represents. The PageAction is not owned by 90 // The PageAction that this view represents. The PageAction is not owned by
93 // us, it resides in the extension of this particular profile. 91 // us, it resides in the extension of this particular profile.
94 ExtensionAction* page_action_; 92 ExtensionAction* page_action_;
95 93
96 // The corresponding browser.
97 Browser* browser_;
98
99 // A cache of bitmaps the page actions might need to show, mapped by path. 94 // A cache of bitmaps the page actions might need to show, mapped by path.
100 typedef std::map<std::string, SkBitmap> PageActionMap; 95 typedef std::map<std::string, SkBitmap> PageActionMap;
101 PageActionMap page_action_icons_; 96 PageActionMap page_action_icons_;
102 97
103 // The object that is waiting for the image loading to complete 98 // The object that is waiting for the image loading to complete
104 // asynchronously. 99 // asynchronously.
105 ImageLoadingTracker tracker_; 100 ImageLoadingTracker tracker_;
106 101
107 // The tab id we are currently showing the icon for. 102 // The tab id we are currently showing the icon for.
108 int current_tab_id_; 103 int current_tab_id_;
(...skipping 16 matching lines...) Expand all
125 // The extension keybinding accelerator this page action is listening for (to 120 // The extension keybinding accelerator this page action is listening for (to
126 // show the popup). 121 // show the popup).
127 scoped_ptr<ui::Accelerator> keybinding_; 122 scoped_ptr<ui::Accelerator> keybinding_;
128 123
129 scoped_ptr<views::MenuRunner> menu_runner_; 124 scoped_ptr<views::MenuRunner> menu_runner_;
130 125
131 DISALLOW_IMPLICIT_CONSTRUCTORS(PageActionImageView); 126 DISALLOW_IMPLICIT_CONSTRUCTORS(PageActionImageView);
132 }; 127 };
133 128
134 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_PAGE_ACTION_IMAGE_VIEW_H_ 129 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_PAGE_ACTION_IMAGE_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698