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

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

Issue 7574021: Remove frontend code that allows for dynamic profile setting, and read the profile off the browse... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 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) 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 19
20 // 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
21 // given PageAction and notify the extension when the icon is clicked. 21 // given PageAction and notify the extension when the icon is clicked.
22 class PageActionImageView : public views::ImageView, 22 class PageActionImageView : public views::ImageView,
23 public ImageLoadingTracker::Observer, 23 public ImageLoadingTracker::Observer,
24 public ExtensionContextMenuModel::PopupDelegate, 24 public ExtensionContextMenuModel::PopupDelegate,
25 public ExtensionPopup::Observer { 25 public ExtensionPopup::Observer {
26 public: 26 public:
27 PageActionImageView(LocationBarView* owner, 27 PageActionImageView(LocationBarView* owner,
28 Profile* profile,
29 ExtensionAction* page_action); 28 ExtensionAction* page_action);
30 virtual ~PageActionImageView(); 29 virtual ~PageActionImageView();
31 30
32 ExtensionAction* page_action() { return page_action_; } 31 ExtensionAction* page_action() { return page_action_; }
33 32
34 int current_tab_id() { return current_tab_id_; } 33 int current_tab_id() { return current_tab_id_; }
35 34
36 void set_preview_enabled(bool preview_enabled) { 35 void set_preview_enabled(bool preview_enabled) {
37 preview_enabled_ = preview_enabled; 36 preview_enabled_ = preview_enabled;
38 } 37 }
(...skipping 25 matching lines...) Expand all
64 // Either notify listeners or show a popup depending on the page action. 63 // Either notify listeners or show a popup depending on the page action.
65 void ExecuteAction(int button, bool inspect_with_devtools); 64 void ExecuteAction(int button, bool inspect_with_devtools);
66 65
67 private: 66 private:
68 // Hides the active popup, if there is one. 67 // Hides the active popup, if there is one.
69 void HidePopup(); 68 void HidePopup();
70 69
71 // The location bar view that owns us. 70 // The location bar view that owns us.
72 LocationBarView* owner_; 71 LocationBarView* owner_;
73 72
74 // The current profile (not owned by us).
75 Profile* profile_;
76
77 // The PageAction that this view represents. The PageAction is not owned by 73 // The PageAction that this view represents. The PageAction is not owned by
78 // us, it resides in the extension of this particular profile. 74 // us, it resides in the extension of this particular profile.
79 ExtensionAction* page_action_; 75 ExtensionAction* page_action_;
80 76
81 // A cache of bitmaps the page actions might need to show, mapped by path. 77 // A cache of bitmaps the page actions might need to show, mapped by path.
82 typedef std::map<std::string, SkBitmap> PageActionMap; 78 typedef std::map<std::string, SkBitmap> PageActionMap;
83 PageActionMap page_action_icons_; 79 PageActionMap page_action_icons_;
84 80
85 // The object that is waiting for the image loading to complete 81 // The object that is waiting for the image loading to complete
86 // asynchronously. 82 // asynchronously.
(...skipping 12 matching lines...) Expand all
99 // briefly shown even if it hasn't been enabled by its extension. 95 // briefly shown even if it hasn't been enabled by its extension.
100 bool preview_enabled_; 96 bool preview_enabled_;
101 97
102 // The current popup and the button it came from. NULL if no popup. 98 // The current popup and the button it came from. NULL if no popup.
103 ExtensionPopup* popup_; 99 ExtensionPopup* popup_;
104 100
105 DISALLOW_IMPLICIT_CONSTRUCTORS(PageActionImageView); 101 DISALLOW_IMPLICIT_CONSTRUCTORS(PageActionImageView);
106 }; 102 };
107 103
108 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_PAGE_ACTION_IMAGE_VIEW_H_ 104 #endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_PAGE_ACTION_IMAGE_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698