| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/printing/print_system_task_proxy.h" | 5 #include "chrome/browser/printing/print_system_task_proxy.h" |
| 6 | 6 |
| 7 #include <ctype.h> | 7 #include <ctype.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 void PrintSystemTaskProxy::GetDefaultPrinter() { | 324 void PrintSystemTaskProxy::GetDefaultPrinter() { |
| 325 VLOG(1) << "Get default printer start"; | 325 VLOG(1) << "Get default printer start"; |
| 326 std::string* default_printer = NULL; | 326 std::string* default_printer = NULL; |
| 327 if (PrintPreviewHandler::last_used_printer_name_ == NULL) { | 327 if (PrintPreviewHandler::last_used_printer_name_ == NULL) { |
| 328 default_printer = new std::string(print_backend_->GetDefaultPrinterName()); | 328 default_printer = new std::string(print_backend_->GetDefaultPrinterName()); |
| 329 } else { | 329 } else { |
| 330 default_printer = new std::string( | 330 default_printer = new std::string( |
| 331 *PrintPreviewHandler::last_used_printer_name_); | 331 *PrintPreviewHandler::last_used_printer_name_); |
| 332 } | 332 } |
| 333 VLOG(1) << "Get default printer finished, found: " | 333 VLOG(1) << "Get default printer finished, found: " |
| 334 << default_printer; | 334 << *default_printer; |
| 335 | 335 |
| 336 std::string* cloud_print_data = NULL; | 336 std::string* cloud_print_data = NULL; |
| 337 if (PrintPreviewHandler::last_used_printer_cloud_print_data_ != NULL) { | 337 if (PrintPreviewHandler::last_used_printer_cloud_print_data_ != NULL) { |
| 338 cloud_print_data = new std::string( | 338 cloud_print_data = new std::string( |
| 339 *PrintPreviewHandler::last_used_printer_cloud_print_data_); | 339 *PrintPreviewHandler::last_used_printer_cloud_print_data_); |
| 340 } else { | 340 } else { |
| 341 cloud_print_data = new std::string; | 341 cloud_print_data = new std::string; |
| 342 } | 342 } |
| 343 | 343 |
| 344 BrowserThread::PostTask( | 344 BrowserThread::PostTask( |
| (...skipping 27 matching lines...) Expand all Loading... |
| 372 std::string printerName; | 372 std::string printerName; |
| 373 #if defined(OS_MACOSX) | 373 #if defined(OS_MACOSX) |
| 374 // On Mac, |iter->printer_description| specifies the printer name and | 374 // On Mac, |iter->printer_description| specifies the printer name and |
| 375 // |iter->printer_name| specifies the device name / printer queue name. | 375 // |iter->printer_name| specifies the device name / printer queue name. |
| 376 printerName = iter->printer_description; | 376 printerName = iter->printer_description; |
| 377 #else | 377 #else |
| 378 printerName = iter->printer_name; | 378 printerName = iter->printer_name; |
| 379 #endif | 379 #endif |
| 380 printer_info->SetString(printing::kSettingPrinterName, printerName); | 380 printer_info->SetString(printing::kSettingPrinterName, printerName); |
| 381 printer_info->SetString(printing::kSettingDeviceName, iter->printer_name); | 381 printer_info->SetString(printing::kSettingDeviceName, iter->printer_name); |
| 382 VLOG(1) << "Found printer " << printerName |
| 383 << " with device name " << iter->printer_name; |
| 382 printers->Append(printer_info); | 384 printers->Append(printer_info); |
| 383 } | 385 } |
| 384 VLOG(1) << "Enumerate printers finished, found " << i << " printers"; | 386 VLOG(1) << "Enumerate printers finished, found " << i << " printers"; |
| 385 | 387 |
| 386 BrowserThread::PostTask( | 388 BrowserThread::PostTask( |
| 387 BrowserThread::UI, FROM_HERE, | 389 BrowserThread::UI, FROM_HERE, |
| 388 base::Bind(&PrintSystemTaskProxy::SetupPrinterList, this, printers)); | 390 base::Bind(&PrintSystemTaskProxy::SetupPrinterList, this, printers)); |
| 389 } | 391 } |
| 390 | 392 |
| 391 void PrintSystemTaskProxy::SetupPrinterList(ListValue* printers) { | 393 void PrintSystemTaskProxy::SetupPrinterList(ListValue* printers) { |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 579 base::Bind(&PrintSystemTaskProxy::SendPrinterCapabilities, this, | 581 base::Bind(&PrintSystemTaskProxy::SendPrinterCapabilities, this, |
| 580 settings_info.DeepCopy())); | 582 settings_info.DeepCopy())); |
| 581 } | 583 } |
| 582 | 584 |
| 583 void PrintSystemTaskProxy::SendPrinterCapabilities( | 585 void PrintSystemTaskProxy::SendPrinterCapabilities( |
| 584 DictionaryValue* settings_info) { | 586 DictionaryValue* settings_info) { |
| 585 if (handler_) | 587 if (handler_) |
| 586 handler_->SendPrinterCapabilities(*settings_info); | 588 handler_->SendPrinterCapabilities(*settings_info); |
| 587 delete settings_info; | 589 delete settings_info; |
| 588 } | 590 } |
| OLD | NEW |