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_action_api.h" | 5 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
520 return RespondNow(Error(kInvalidColorError)); | 520 return RespondNow(Error(kInvalidColorError)); |
521 } | 521 } |
522 | 522 |
523 extension_action_->SetBadgeBackgroundColor(tab_id_, color); | 523 extension_action_->SetBadgeBackgroundColor(tab_id_, color); |
524 NotifyChange(); | 524 NotifyChange(); |
525 return RespondNow(NoArguments()); | 525 return RespondNow(NoArguments()); |
526 } | 526 } |
527 | 527 |
528 ExtensionFunction::ResponseAction | 528 ExtensionFunction::ResponseAction |
529 ExtensionActionGetTitleFunction::RunExtensionAction() { | 529 ExtensionActionGetTitleFunction::RunExtensionAction() { |
530 return RespondNow(OneArgument(base::MakeUnique<base::StringValue>( | 530 return RespondNow(OneArgument( |
531 extension_action_->GetTitle(tab_id_)))); | 531 base::MakeUnique<base::Value>(extension_action_->GetTitle(tab_id_)))); |
532 } | 532 } |
533 | 533 |
534 ExtensionFunction::ResponseAction | 534 ExtensionFunction::ResponseAction |
535 ExtensionActionGetPopupFunction::RunExtensionAction() { | 535 ExtensionActionGetPopupFunction::RunExtensionAction() { |
536 return RespondNow(OneArgument(base::MakeUnique<base::StringValue>( | 536 return RespondNow(OneArgument(base::MakeUnique<base::Value>( |
537 extension_action_->GetPopupUrl(tab_id_).spec()))); | 537 extension_action_->GetPopupUrl(tab_id_).spec()))); |
538 } | 538 } |
539 | 539 |
540 ExtensionFunction::ResponseAction | 540 ExtensionFunction::ResponseAction |
541 ExtensionActionGetBadgeTextFunction::RunExtensionAction() { | 541 ExtensionActionGetBadgeTextFunction::RunExtensionAction() { |
542 return RespondNow(OneArgument(base::MakeUnique<base::StringValue>( | 542 return RespondNow(OneArgument( |
543 extension_action_->GetBadgeText(tab_id_)))); | 543 base::MakeUnique<base::Value>(extension_action_->GetBadgeText(tab_id_)))); |
544 } | 544 } |
545 | 545 |
546 ExtensionFunction::ResponseAction | 546 ExtensionFunction::ResponseAction |
547 ExtensionActionGetBadgeBackgroundColorFunction::RunExtensionAction() { | 547 ExtensionActionGetBadgeBackgroundColorFunction::RunExtensionAction() { |
548 std::unique_ptr<base::ListValue> list(new base::ListValue()); | 548 std::unique_ptr<base::ListValue> list(new base::ListValue()); |
549 SkColor color = extension_action_->GetBadgeBackgroundColor(tab_id_); | 549 SkColor color = extension_action_->GetBadgeBackgroundColor(tab_id_); |
550 list->AppendInteger(static_cast<int>(SkColorGetR(color))); | 550 list->AppendInteger(static_cast<int>(SkColorGetR(color))); |
551 list->AppendInteger(static_cast<int>(SkColorGetG(color))); | 551 list->AppendInteger(static_cast<int>(SkColorGetG(color))); |
552 list->AppendInteger(static_cast<int>(SkColorGetB(color))); | 552 list->AppendInteger(static_cast<int>(SkColorGetB(color))); |
553 list->AppendInteger(static_cast<int>(SkColorGetA(color))); | 553 list->AppendInteger(static_cast<int>(SkColorGetA(color))); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
626 if (host->extension_host_type() != VIEW_TYPE_EXTENSION_POPUP || | 626 if (host->extension_host_type() != VIEW_TYPE_EXTENSION_POPUP || |
627 host->extension()->id() != extension_->id()) | 627 host->extension()->id() != extension_->id()) |
628 return; | 628 return; |
629 | 629 |
630 SendResponse(true); | 630 SendResponse(true); |
631 response_sent_ = true; | 631 response_sent_ = true; |
632 registrar_.RemoveAll(); | 632 registrar_.RemoveAll(); |
633 } | 633 } |
634 | 634 |
635 } // namespace extensions | 635 } // namespace extensions |
OLD | NEW |