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

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

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

Powered by Google App Engine
This is Rietveld 408576698