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

Side by Side Diff: chrome/browser/extensions/api/extension_action/extension_page_actions_api.cc

Issue 10823143: Make the getAttention badge grey. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move the Grant/Appearance code into the switch Created 8 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) 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 #include "chrome/browser/extensions/api/extension_action/extension_page_actions_ api.h" 5 #include "chrome/browser/extensions/api/extension_action/extension_page_actions_ api.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/string_number_conversions.h" 9 #include "base/string_number_conversions.h"
10 #include "chrome/browser/extensions/api/extension_action/extension_page_actions_ api_constants.h" 10 #include "chrome/browser/extensions/api/extension_action/extension_page_actions_ api_constants.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 88
89 // Make sure the URL hasn't changed. 89 // Make sure the URL hasn't changed.
90 NavigationEntry* entry = 90 NavigationEntry* entry =
91 contents->web_contents()->GetController().GetActiveEntry(); 91 contents->web_contents()->GetController().GetActiveEntry();
92 if (!entry || url != entry->GetURL().spec()) { 92 if (!entry || url != entry->GetURL().spec()) {
93 error_ = ExtensionErrorUtils::FormatErrorMessage(kUrlNotActiveError, url); 93 error_ = ExtensionErrorUtils::FormatErrorMessage(kUrlNotActiveError, url);
94 return false; 94 return false;
95 } 95 }
96 96
97 // Set visibility and broadcast notifications that the UI should be updated. 97 // Set visibility and broadcast notifications that the UI should be updated.
98 page_action->SetIsVisible(tab_id, enable); 98 page_action->SetAppearance(
99 tab_id, enable ? ExtensionAction::ACTIVE : ExtensionAction::INVISIBLE);
99 page_action->SetTitle(tab_id, title); 100 page_action->SetTitle(tab_id, title);
100 page_action->SetIconIndex(tab_id, icon_id); 101 page_action->SetIconIndex(tab_id, icon_id);
101 contents->extension_tab_helper()->location_bar_controller()->NotifyChange(); 102 contents->extension_tab_helper()->location_bar_controller()->NotifyChange();
102 103
103 return true; 104 return true;
104 } 105 }
105 106
106 bool EnablePageActionsFunction::RunImpl() { 107 bool EnablePageActionsFunction::RunImpl() {
107 return SetPageActionEnabled(true); 108 return SetPageActionEnabled(true);
108 } 109 }
109 110
110 bool DisablePageActionsFunction::RunImpl() { 111 bool DisablePageActionsFunction::RunImpl() {
111 return SetPageActionEnabled(false); 112 return SetPageActionEnabled(false);
112 } 113 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698