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

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

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
« no previous file with comments | « chrome/browser/tab_contents/tab_contents.h ('k') | chrome/browser/views/location_bar_view.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/tab_contents/tab_contents.cc
===================================================================
--- chrome/browser/tab_contents/tab_contents.cc (revision 19579)
+++ chrome/browser/tab_contents/tab_contents.cc (working copy)
@@ -569,24 +569,32 @@
}
void TabContents::SetPageActionEnabled(const PageAction* page_action,
- bool enable) {
+ bool enable,
+ const std::string& title,
+ int icon_id) {
DCHECK(page_action);
- if (enable == IsPageActionEnabled(page_action))
- return; // Don't need to do anything more.
+ if (!enable &&
+ enabled_page_actions_.end() == enabled_page_actions_.find(page_action)) {
+ return; // Don't need to disable twice.
+ }
- if (enable)
- enabled_page_actions_.insert(page_action);
- else
+ if (enable) {
+ enabled_page_actions_[page_action].reset(
+ new PageActionState(title, icon_id));
+ } else {
enabled_page_actions_.erase(page_action);
+ }
}
-bool TabContents::IsPageActionEnabled(const PageAction* page_action) {
- DCHECK(page_action);
- return enabled_page_actions_.end() != enabled_page_actions_.find(page_action);
+const PageActionState* TabContents::GetPageActionState(
+ const PageAction* page_action) {
+ if (enabled_page_actions_.end() == enabled_page_actions_.find(page_action))
+ return NULL;
+
+ return enabled_page_actions_[page_action].get();
}
-
void TabContents::NotifyNavigationStateChanged(unsigned changed_flags) {
if (delegate_)
delegate_->NavigationStateChanged(this, changed_flags);
« no previous file with comments | « chrome/browser/tab_contents/tab_contents.h ('k') | chrome/browser/views/location_bar_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698