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

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

Issue 2030013003: Remove ListValue::Append(new {Fundamental,String}Value(...)) pattern in //chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
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_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 533 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 544
545 bool ExtensionActionGetBadgeTextFunction::RunExtensionAction() { 545 bool ExtensionActionGetBadgeTextFunction::RunExtensionAction() {
546 SetResult(base::MakeUnique<base::StringValue>( 546 SetResult(base::MakeUnique<base::StringValue>(
547 extension_action_->GetBadgeText(tab_id_))); 547 extension_action_->GetBadgeText(tab_id_)));
548 return true; 548 return true;
549 } 549 }
550 550
551 bool ExtensionActionGetBadgeBackgroundColorFunction::RunExtensionAction() { 551 bool ExtensionActionGetBadgeBackgroundColorFunction::RunExtensionAction() {
552 std::unique_ptr<base::ListValue> list(new base::ListValue()); 552 std::unique_ptr<base::ListValue> list(new base::ListValue());
553 SkColor color = extension_action_->GetBadgeBackgroundColor(tab_id_); 553 SkColor color = extension_action_->GetBadgeBackgroundColor(tab_id_);
554 list->Append( 554 list->AppendInteger(static_cast<int>(SkColorGetR(color)));
555 new base::FundamentalValue(static_cast<int>(SkColorGetR(color)))); 555 list->AppendInteger(static_cast<int>(SkColorGetG(color)));
556 list->Append( 556 list->AppendInteger(static_cast<int>(SkColorGetB(color)));
557 new base::FundamentalValue(static_cast<int>(SkColorGetG(color)))); 557 list->AppendInteger(static_cast<int>(SkColorGetA(color)));
558 list->Append(
559 new base::FundamentalValue(static_cast<int>(SkColorGetB(color))));
560 list->Append(
561 new base::FundamentalValue(static_cast<int>(SkColorGetA(color))));
562 SetResult(std::move(list)); 558 SetResult(std::move(list));
563 return true; 559 return true;
564 } 560 }
565 561
566 BrowserActionOpenPopupFunction::BrowserActionOpenPopupFunction() 562 BrowserActionOpenPopupFunction::BrowserActionOpenPopupFunction()
567 : response_sent_(false) { 563 : response_sent_(false) {
568 } 564 }
569 565
570 bool BrowserActionOpenPopupFunction::RunAsync() { 566 bool BrowserActionOpenPopupFunction::RunAsync() {
571 // We only allow the popup in the active window. 567 // We only allow the popup in the active window.
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
635 if (host->extension_host_type() != VIEW_TYPE_EXTENSION_POPUP || 631 if (host->extension_host_type() != VIEW_TYPE_EXTENSION_POPUP ||
636 host->extension()->id() != extension_->id()) 632 host->extension()->id() != extension_->id())
637 return; 633 return;
638 634
639 SendResponse(true); 635 SendResponse(true);
640 response_sent_ = true; 636 response_sent_ = true;
641 registrar_.RemoveAll(); 637 registrar_.RemoveAll();
642 } 638 }
643 639
644 } // namespace extensions 640 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/downloads/downloads_api.cc ('k') | chrome/browser/extensions/api/idltest/idltest_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698