| 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/utility/chrome_content_utility_client.h" | 5 #include "chrome/utility/chrome_content_utility_client.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/base64.h" | 8 #include "base/base64.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 wrapper.Append(value); | 364 wrapper.Append(value); |
| 365 Send(new ChromeUtilityHostMsg_ParseJSON_Succeeded(wrapper)); | 365 Send(new ChromeUtilityHostMsg_ParseJSON_Succeeded(wrapper)); |
| 366 } else { | 366 } else { |
| 367 Send(new ChromeUtilityHostMsg_ParseJSON_Failed(error)); | 367 Send(new ChromeUtilityHostMsg_ParseJSON_Failed(error)); |
| 368 } | 368 } |
| 369 content::UtilityThread::Get()->ReleaseProcessIfNeeded(); | 369 content::UtilityThread::Get()->ReleaseProcessIfNeeded(); |
| 370 } | 370 } |
| 371 | 371 |
| 372 void ChromeContentUtilityClient::OnGetPrinterCapsAndDefaults( | 372 void ChromeContentUtilityClient::OnGetPrinterCapsAndDefaults( |
| 373 const std::string& printer_name) { | 373 const std::string& printer_name) { |
| 374 #if defined(ENABLE_PRINTING) |
| 374 scoped_refptr<printing::PrintBackend> print_backend = | 375 scoped_refptr<printing::PrintBackend> print_backend = |
| 375 printing::PrintBackend::CreateInstance(NULL); | 376 printing::PrintBackend::CreateInstance(NULL); |
| 376 printing::PrinterCapsAndDefaults printer_info; | 377 printing::PrinterCapsAndDefaults printer_info; |
| 377 | 378 |
| 378 child_process_logging::ScopedPrinterInfoSetter prn_info( | 379 child_process_logging::ScopedPrinterInfoSetter prn_info( |
| 379 print_backend->GetPrinterDriverInfo(printer_name)); | 380 print_backend->GetPrinterDriverInfo(printer_name)); |
| 380 | 381 |
| 381 if (print_backend->GetPrinterCapsAndDefaults(printer_name, &printer_info)) { | 382 if (print_backend->GetPrinterCapsAndDefaults(printer_name, &printer_info)) { |
| 382 Send(new ChromeUtilityHostMsg_GetPrinterCapsAndDefaults_Succeeded( | 383 Send(new ChromeUtilityHostMsg_GetPrinterCapsAndDefaults_Succeeded( |
| 383 printer_name, printer_info)); | 384 printer_name, printer_info)); |
| 384 } else { | 385 } else |
| 386 #endif |
| 387 { |
| 385 Send(new ChromeUtilityHostMsg_GetPrinterCapsAndDefaults_Failed( | 388 Send(new ChromeUtilityHostMsg_GetPrinterCapsAndDefaults_Failed( |
| 386 printer_name)); | 389 printer_name)); |
| 387 } | 390 } |
| 388 content::UtilityThread::Get()->ReleaseProcessIfNeeded(); | 391 content::UtilityThread::Get()->ReleaseProcessIfNeeded(); |
| 389 } | 392 } |
| 390 | 393 |
| 391 void ChromeContentUtilityClient::OnImportStart( | 394 void ChromeContentUtilityClient::OnImportStart( |
| 392 const importer::SourceProfile& source_profile, | 395 const importer::SourceProfile& source_profile, |
| 393 uint16 items, | 396 uint16 items, |
| 394 const DictionaryValue& localized_strings) { | 397 const DictionaryValue& localized_strings) { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 | 435 |
| 433 void ChromeContentUtilityClient::ImporterCleanup() { | 436 void ChromeContentUtilityClient::ImporterCleanup() { |
| 434 importer_->Cancel(); | 437 importer_->Cancel(); |
| 435 importer_ = NULL; | 438 importer_ = NULL; |
| 436 bridge_ = NULL; | 439 bridge_ = NULL; |
| 437 import_thread_.reset(); | 440 import_thread_.reset(); |
| 438 content::UtilityThread::Get()->ReleaseProcessIfNeeded(); | 441 content::UtilityThread::Get()->ReleaseProcessIfNeeded(); |
| 439 } | 442 } |
| 440 | 443 |
| 441 } // namespace chrome | 444 } // namespace chrome |
| OLD | NEW |