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

Side by Side Diff: chrome/browser/ui/webui/print_preview/print_preview_handler.cc

Issue 2086763002: Don't use deprecated ListValue::Append(Value*) overload. (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/ui/webui/print_preview/print_preview_handler.h" 5 #include "chrome/browser/ui/webui/print_preview/print_preview_handler.h"
6 6
7 #include <ctype.h> 7 #include <ctype.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 DCHECK(BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); 411 DCHECK(BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread());
412 412
413 scoped_refptr<printing::PrintBackend> print_backend( 413 scoped_refptr<printing::PrintBackend> print_backend(
414 printing::PrintBackend::CreateInstance(nullptr)); 414 printing::PrintBackend::CreateInstance(nullptr));
415 415
416 VLOG(1) << "Enumerate printers start"; 416 VLOG(1) << "Enumerate printers start";
417 printing::PrinterList printer_list; 417 printing::PrinterList printer_list;
418 print_backend->EnumeratePrinters(&printer_list); 418 print_backend->EnumeratePrinters(&printer_list);
419 419
420 for (const printing::PrinterBasicInfo& printer : printer_list) { 420 for (const printing::PrinterBasicInfo& printer : printer_list) {
421 base::DictionaryValue* printer_info = new base::DictionaryValue; 421 std::unique_ptr<base::DictionaryValue> printer_info(
422 printers->Append(printer_info); 422 new base::DictionaryValue);
423
424 const auto printer_name_description = GetPrinterNameAndDescription(printer); 423 const auto printer_name_description = GetPrinterNameAndDescription(printer);
425 const std::string& printer_name = printer_name_description.first; 424 const std::string& printer_name = printer_name_description.first;
426 const std::string& printer_description = printer_name_description.second; 425 const std::string& printer_description = printer_name_description.second;
427 printer_info->SetString(printing::kSettingDeviceName, printer.printer_name); 426 printer_info->SetString(printing::kSettingDeviceName, printer.printer_name);
428 printer_info->SetString(printing::kSettingPrinterName, printer_name); 427 printer_info->SetString(printing::kSettingPrinterName, printer_name);
429 printer_info->SetString(printing::kSettingPrinterDescription, 428 printer_info->SetString(printing::kSettingPrinterDescription,
430 printer_description); 429 printer_description);
431 430
432 base::DictionaryValue* options = new base::DictionaryValue; 431 base::DictionaryValue* options = new base::DictionaryValue;
433 printer_info->Set(printing::kSettingPrinterOptions, options); 432 printer_info->Set(printing::kSettingPrinterOptions, options);
434 for (const auto opt_it : printer.options) 433 for (const auto opt_it : printer.options)
435 options->SetString(opt_it.first, opt_it.second); 434 options->SetString(opt_it.first, opt_it.second);
436 435
436 printers->Append(std::move(printer_info));
437
437 VLOG(1) << "Found printer " << printer_name << " with device name " 438 VLOG(1) << "Found printer " << printer_name << " with device name "
438 << printer.printer_name; 439 << printer.printer_name;
439 } 440 }
440 VLOG(1) << "Enumerate printers finished, found " << printers->GetSize() 441 VLOG(1) << "Enumerate printers finished, found " << printers->GetSize()
441 << " printers"; 442 << " printers";
442 } 443 }
443 444
444 std::unique_ptr<base::DictionaryValue> 445 std::unique_ptr<base::DictionaryValue>
445 GetPrinterCapabilitiesOnBlockingPoolThread(const std::string& device_name) { 446 GetPrinterCapabilitiesOnBlockingPoolThread(const std::string& device_name) {
446 DCHECK(BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); 447 DCHECK(BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread());
(...skipping 1346 matching lines...) Expand 10 before | Expand all | Expand 10 after
1793 1794
1794 void PrintPreviewHandler::UnregisterForGaiaCookieChanges() { 1795 void PrintPreviewHandler::UnregisterForGaiaCookieChanges() {
1795 if (gaia_cookie_manager_service_) 1796 if (gaia_cookie_manager_service_)
1796 gaia_cookie_manager_service_->RemoveObserver(this); 1797 gaia_cookie_manager_service_->RemoveObserver(this);
1797 } 1798 }
1798 1799
1799 void PrintPreviewHandler::SetPdfSavedClosureForTesting( 1800 void PrintPreviewHandler::SetPdfSavedClosureForTesting(
1800 const base::Closure& closure) { 1801 const base::Closure& closure) {
1801 pdf_file_saved_closure_ = closure; 1802 pdf_file_saved_closure_ = closure;
1802 } 1803 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698