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

Side by Side Diff: extensions/browser/api/printer_provider/printer_provider_api.cc

Issue 2051663003: base::ListValue::Append cleanup: pass unique_ptr instead of the released pointer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "extensions/browser/api/printer_provider/printer_provider_api.h" 5 #include "extensions/browser/api/printer_provider/printer_provider_api.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after
607 } 607 }
608 608
609 print_job.content_type = job.content_type; 609 print_job.content_type = job.content_type;
610 print_job.title = base::UTF16ToUTF8(job.job_title); 610 print_job.title = base::UTF16ToUTF8(job.job_title);
611 int request_id = pending_print_requests_[extension_id].Add(job, callback); 611 int request_id = pending_print_requests_[extension_id].Add(job, callback);
612 612
613 std::unique_ptr<base::ListValue> internal_args(new base::ListValue); 613 std::unique_ptr<base::ListValue> internal_args(new base::ListValue);
614 // Request id is not part of the public API and it will be massaged out in 614 // Request id is not part of the public API and it will be massaged out in
615 // custom bindings. 615 // custom bindings.
616 internal_args->AppendInteger(request_id); 616 internal_args->AppendInteger(request_id);
617 internal_args->Append(print_job.ToValue().release()); 617 internal_args->Append(print_job.ToValue());
618 std::unique_ptr<Event> event( 618 std::unique_ptr<Event> event(
619 new Event(events::PRINTER_PROVIDER_ON_PRINT_REQUESTED, 619 new Event(events::PRINTER_PROVIDER_ON_PRINT_REQUESTED,
620 api::printer_provider::OnPrintRequested::kEventName, 620 api::printer_provider::OnPrintRequested::kEventName,
621 std::move(internal_args))); 621 std::move(internal_args)));
622 event_router->DispatchEventToExtension(extension_id, std::move(event)); 622 event_router->DispatchEventToExtension(extension_id, std::move(event));
623 } 623 }
624 624
625 const PrinterProviderPrintJob* PrinterProviderAPIImpl::GetPrintJob( 625 const PrinterProviderPrintJob* PrinterProviderAPIImpl::GetPrintJob(
626 const Extension* extension, 626 const Extension* extension,
627 int request_id) const { 627 int request_id) const {
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
764 return new PrinterProviderAPIImpl(context); 764 return new PrinterProviderAPIImpl(context);
765 } 765 }
766 766
767 // static 767 // static
768 std::string PrinterProviderAPI::GetDefaultPrintError() { 768 std::string PrinterProviderAPI::GetDefaultPrintError() {
769 return api::printer_provider_internal::ToString( 769 return api::printer_provider_internal::ToString(
770 api::printer_provider_internal::PRINT_ERROR_FAILED); 770 api::printer_provider_internal::PRINT_ERROR_FAILED);
771 } 771 }
772 772
773 } // namespace extensions 773 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698