OLD | NEW |
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 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 if (!ParseCSSColorString(color_string, &color)) | 274 if (!ParseCSSColorString(color_string, &color)) |
275 return false; | 275 return false; |
276 } | 276 } |
277 | 277 |
278 extension_action_->SetBadgeBackgroundColor(tab_id_, color); | 278 extension_action_->SetBadgeBackgroundColor(tab_id_, color); |
279 NotifyChange(); | 279 NotifyChange(); |
280 return true; | 280 return true; |
281 } | 281 } |
282 | 282 |
283 bool ExtensionActionGetTitleFunction::RunExtensionAction() { | 283 bool ExtensionActionGetTitleFunction::RunExtensionAction() { |
284 result_.reset(Value::CreateStringValue(extension_action_->GetTitle(tab_id_))); | 284 SetSingleResult( |
| 285 Value::CreateStringValue(extension_action_->GetTitle(tab_id_))); |
285 return true; | 286 return true; |
286 } | 287 } |
287 | 288 |
288 bool ExtensionActionGetPopupFunction::RunExtensionAction() { | 289 bool ExtensionActionGetPopupFunction::RunExtensionAction() { |
289 result_.reset(Value::CreateStringValue( | 290 SetSingleResult( |
290 extension_action_->GetPopupUrl(tab_id_).spec())); | 291 Value::CreateStringValue(extension_action_->GetPopupUrl(tab_id_).spec())); |
291 return true; | 292 return true; |
292 } | 293 } |
293 | 294 |
294 bool ExtensionActionGetBadgeTextFunction::RunExtensionAction() { | 295 bool ExtensionActionGetBadgeTextFunction::RunExtensionAction() { |
295 result_.reset(Value::CreateStringValue( | 296 SetSingleResult( |
296 extension_action_->GetBadgeText(tab_id_))); | 297 Value::CreateStringValue(extension_action_->GetBadgeText(tab_id_))); |
297 return true; | 298 return true; |
298 } | 299 } |
299 | 300 |
300 bool ExtensionActionGetBadgeBackgroundColorFunction::RunExtensionAction() { | 301 bool ExtensionActionGetBadgeBackgroundColorFunction::RunExtensionAction() { |
301 ListValue* list = new ListValue(); | 302 ListValue* list = new ListValue(); |
302 SkColor color = extension_action_->GetBadgeBackgroundColor(tab_id_); | 303 SkColor color = extension_action_->GetBadgeBackgroundColor(tab_id_); |
303 list->Append(Value::CreateIntegerValue(SkColorGetR(color))); | 304 list->Append(Value::CreateIntegerValue(SkColorGetR(color))); |
304 list->Append(Value::CreateIntegerValue(SkColorGetG(color))); | 305 list->Append(Value::CreateIntegerValue(SkColorGetG(color))); |
305 list->Append(Value::CreateIntegerValue(SkColorGetB(color))); | 306 list->Append(Value::CreateIntegerValue(SkColorGetB(color))); |
306 list->Append(Value::CreateIntegerValue(SkColorGetA(color))); | 307 list->Append(Value::CreateIntegerValue(SkColorGetA(color))); |
307 result_.reset(list); | 308 SetSingleResult(list); |
308 return true; | 309 return true; |
309 } | 310 } |
OLD | NEW |