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

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

Issue 10695070: Implement scriptBadge.requestToAct. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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_actions_api.h " 5 #include "chrome/browser/extensions/api/extension_action/extension_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 "base/string_piece.h" 10 #include "base/string_piece.h"
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 bool ExtensionActionFunction::SetVisible(bool visible) { 176 bool ExtensionActionFunction::SetVisible(bool visible) {
177 // If --enable-script-badges is on there will be a browser_action here 177 // If --enable-script-badges is on there will be a browser_action here
178 // instead of a page action. Disable/renable the browser action perhaps? 178 // instead of a page action. Disable/renable the browser action perhaps?
179 if (!GetExtension()->page_action()) 179 if (!GetExtension()->page_action())
180 return true; 180 return true;
181 extension_action_->SetIsVisible(tab_id_, visible); 181 extension_action_->SetIsVisible(tab_id_, visible);
182 NotifyChange(); 182 NotifyChange();
183 return true; 183 return true;
184 } 184 }
185 185
186 ExtensionTabHelper& ExtensionActionFunction::tab_helper() const {
187 CHECK(contents_);
188 return *contents_->extension_tab_helper();
189 }
190
186 bool ExtensionActionShowFunction::RunExtensionAction() { 191 bool ExtensionActionShowFunction::RunExtensionAction() {
187 return SetVisible(true); 192 return SetVisible(true);
188 } 193 }
189 194
190 bool ExtensionActionHideFunction::RunExtensionAction() { 195 bool ExtensionActionHideFunction::RunExtensionAction() {
191 return SetVisible(false); 196 return SetVisible(false);
192 } 197 }
193 198
194 bool ExtensionActionSetIconFunction::RunExtensionAction() { 199 bool ExtensionActionSetIconFunction::RunExtensionAction() {
195 // setIcon can take a variant argument: either a canvas ImageData, or an 200 // setIcon can take a variant argument: either a canvas ImageData, or an
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 bool ExtensionActionGetBadgeBackgroundColorFunction::RunExtensionAction() { 305 bool ExtensionActionGetBadgeBackgroundColorFunction::RunExtensionAction() {
301 ListValue* list = new ListValue(); 306 ListValue* list = new ListValue();
302 SkColor color = extension_action_->GetBadgeBackgroundColor(tab_id_); 307 SkColor color = extension_action_->GetBadgeBackgroundColor(tab_id_);
303 list->Append(Value::CreateIntegerValue(SkColorGetR(color))); 308 list->Append(Value::CreateIntegerValue(SkColorGetR(color)));
304 list->Append(Value::CreateIntegerValue(SkColorGetG(color))); 309 list->Append(Value::CreateIntegerValue(SkColorGetG(color)));
305 list->Append(Value::CreateIntegerValue(SkColorGetB(color))); 310 list->Append(Value::CreateIntegerValue(SkColorGetB(color)));
306 list->Append(Value::CreateIntegerValue(SkColorGetA(color))); 311 list->Append(Value::CreateIntegerValue(SkColorGetA(color)));
307 result_.reset(list); 312 result_.reset(list);
308 return true; 313 return true;
309 } 314 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698