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 SetResult(Value::CreateStringValue(extension_action_->GetTitle(tab_id_))); |
285 return true; | 285 return true; |
286 } | 286 } |
287 | 287 |
288 bool ExtensionActionGetPopupFunction::RunExtensionAction() { | 288 bool ExtensionActionGetPopupFunction::RunExtensionAction() { |
289 result_.reset(Value::CreateStringValue( | 289 SetResult( |
290 extension_action_->GetPopupUrl(tab_id_).spec())); | 290 Value::CreateStringValue(extension_action_->GetPopupUrl(tab_id_).spec())); |
291 return true; | 291 return true; |
292 } | 292 } |
293 | 293 |
294 bool ExtensionActionGetBadgeTextFunction::RunExtensionAction() { | 294 bool ExtensionActionGetBadgeTextFunction::RunExtensionAction() { |
295 result_.reset(Value::CreateStringValue( | 295 SetResult(Value::CreateStringValue(extension_action_->GetBadgeText(tab_id_))); |
296 extension_action_->GetBadgeText(tab_id_))); | |
297 return true; | 296 return true; |
298 } | 297 } |
299 | 298 |
300 bool ExtensionActionGetBadgeBackgroundColorFunction::RunExtensionAction() { | 299 bool ExtensionActionGetBadgeBackgroundColorFunction::RunExtensionAction() { |
301 ListValue* list = new ListValue(); | 300 ListValue* list = new ListValue(); |
302 SkColor color = extension_action_->GetBadgeBackgroundColor(tab_id_); | 301 SkColor color = extension_action_->GetBadgeBackgroundColor(tab_id_); |
303 list->Append(Value::CreateIntegerValue(SkColorGetR(color))); | 302 list->Append(Value::CreateIntegerValue(SkColorGetR(color))); |
304 list->Append(Value::CreateIntegerValue(SkColorGetG(color))); | 303 list->Append(Value::CreateIntegerValue(SkColorGetG(color))); |
305 list->Append(Value::CreateIntegerValue(SkColorGetB(color))); | 304 list->Append(Value::CreateIntegerValue(SkColorGetB(color))); |
306 list->Append(Value::CreateIntegerValue(SkColorGetA(color))); | 305 list->Append(Value::CreateIntegerValue(SkColorGetA(color))); |
307 result_.reset(list); | 306 SetResult(list); |
308 return true; | 307 return true; |
309 } | 308 } |
OLD | NEW |