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

Unified Diff: chrome/browser/tab_contents/tab_contents.h

Issue 149046: PageActions can now specify multiple icons and switch between them... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/tab_contents/tab_contents.h
===================================================================
--- chrome/browser/tab_contents/tab_contents.h (revision 19579)
+++ chrome/browser/tab_contents/tab_contents.h (working copy)
@@ -31,6 +31,7 @@
#include "chrome/common/gears_api.h"
#include "chrome/common/navigation_types.h"
#include "chrome/common/notification_registrar.h"
+#include "chrome/common/page_action.h"
#include "chrome/common/property_bag.h"
#include "chrome/common/renderer_preferences.h"
#include "net/base/load_states.h"
@@ -253,10 +254,17 @@
void SetIsCrashed(bool state);
// Adds/removes a page action to the list of page actions that are active in
+ // this tab. The parameter |title| (if not empty) can be used to override the
+ // page action title for this tab and |icon_id| specifies an icon index
+ // (defined in the manifest) to use instead of the first icon (for this tab).
+ void SetPageActionEnabled(const PageAction* page_action, bool enable,
+ const std::string& title, int icon_id);
+
+ // Returns the page action state for this tab. The pair returns contains
+ // the title (string) for the page action and the icon index to use (int).
+ // If this function returns NULL it means the page action is not enabled for
// this tab.
- void SetPageActionEnabled(const PageAction* page_action, bool enable);
- // Checks to see if the PageAction should be visible in this tab.
- bool IsPageActionEnabled(const PageAction* page_action);
+ const PageActionState* GetPageActionState(const PageAction* page_action);
// Whether the tab is in the process of being destroyed.
// Added as a tentative work-around for focus related bug #4633. This allows
@@ -1034,10 +1042,12 @@
// Data for Page Actions -----------------------------------------------------
- // A set of page actions that are enabled in this tab. This list is cleared
- // every time the mainframe navigates and populated by the PageAction
- // extension API.
- std::set<const PageAction*> enabled_page_actions_;
+ // A map of page actions that are enabled in this tab (and a state object
+ // that can be used to override the title and icon used for the page action).
+ // This map is cleared every time the mainframe navigates and populated by the
+ // PageAction extension API.
+ std::map<const PageAction*, linked_ptr<PageActionState>>
+ enabled_page_actions_;
// Data for misc internal state ----------------------------------------------
« no previous file with comments | « chrome/browser/extensions/extensions_service_unittest.cc ('k') | chrome/browser/tab_contents/tab_contents.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698