| 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" |
| 11 #include "base/threading/thread.h" | 11 #include "base/threading/thread.h" |
| 12 #include "chrome/browser/importer/external_process_importer_bridge.h" | 12 #include "chrome/browser/importer/external_process_importer_bridge.h" |
| 13 #include "chrome/browser/importer/importer.h" | 13 #include "chrome/browser/importer/importer.h" |
| 14 #include "chrome/browser/importer/profile_import_process_messages.h" | 14 #include "chrome/browser/importer/profile_import_process_messages.h" |
| 15 #include "chrome/common/child_process_logging.h" |
| 15 #include "chrome/common/chrome_paths.h" | 16 #include "chrome/common/chrome_paths.h" |
| 16 #include "chrome/common/chrome_utility_messages.h" | 17 #include "chrome/common/chrome_utility_messages.h" |
| 17 #include "chrome/common/extensions/extension.h" | 18 #include "chrome/common/extensions/extension.h" |
| 18 #include "chrome/common/extensions/extension_l10n_util.h" | 19 #include "chrome/common/extensions/extension_l10n_util.h" |
| 19 #include "chrome/common/extensions/extension_unpacker.h" | 20 #include "chrome/common/extensions/extension_unpacker.h" |
| 20 #include "chrome/common/extensions/update_manifest.h" | 21 #include "chrome/common/extensions/update_manifest.h" |
| 21 #include "chrome/common/web_resource/web_resource_unpacker.h" | 22 #include "chrome/common/web_resource/web_resource_unpacker.h" |
| 22 #include "content/public/utility/utility_thread.h" | 23 #include "content/public/utility/utility_thread.h" |
| 23 #include "printing/backend/print_backend.h" | 24 #include "printing/backend/print_backend.h" |
| 24 #include "printing/page_range.h" | 25 #include "printing/page_range.h" |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 Send(new ChromeUtilityHostMsg_ParseJSON_Failed(error)); | 366 Send(new ChromeUtilityHostMsg_ParseJSON_Failed(error)); |
| 366 } | 367 } |
| 367 content::UtilityThread::Get()->ReleaseProcessIfNeeded(); | 368 content::UtilityThread::Get()->ReleaseProcessIfNeeded(); |
| 368 } | 369 } |
| 369 | 370 |
| 370 void ChromeContentUtilityClient::OnGetPrinterCapsAndDefaults( | 371 void ChromeContentUtilityClient::OnGetPrinterCapsAndDefaults( |
| 371 const std::string& printer_name) { | 372 const std::string& printer_name) { |
| 372 scoped_refptr<printing::PrintBackend> print_backend = | 373 scoped_refptr<printing::PrintBackend> print_backend = |
| 373 printing::PrintBackend::CreateInstance(NULL); | 374 printing::PrintBackend::CreateInstance(NULL); |
| 374 printing::PrinterCapsAndDefaults printer_info; | 375 printing::PrinterCapsAndDefaults printer_info; |
| 376 |
| 377 child_process_logging::ScopedPrinterInfoSetter prn_info( |
| 378 print_backend->GetPrinterDriverInfo(printer_name)); |
| 379 |
| 375 if (print_backend->GetPrinterCapsAndDefaults(printer_name, &printer_info)) { | 380 if (print_backend->GetPrinterCapsAndDefaults(printer_name, &printer_info)) { |
| 376 Send(new ChromeUtilityHostMsg_GetPrinterCapsAndDefaults_Succeeded( | 381 Send(new ChromeUtilityHostMsg_GetPrinterCapsAndDefaults_Succeeded( |
| 377 printer_name, printer_info)); | 382 printer_name, printer_info)); |
| 378 } else { | 383 } else { |
| 379 Send(new ChromeUtilityHostMsg_GetPrinterCapsAndDefaults_Failed( | 384 Send(new ChromeUtilityHostMsg_GetPrinterCapsAndDefaults_Failed( |
| 380 printer_name)); | 385 printer_name)); |
| 381 } | 386 } |
| 382 content::UtilityThread::Get()->ReleaseProcessIfNeeded(); | 387 content::UtilityThread::Get()->ReleaseProcessIfNeeded(); |
| 383 } | 388 } |
| 384 | 389 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 425 | 430 |
| 426 void ChromeContentUtilityClient::ImporterCleanup() { | 431 void ChromeContentUtilityClient::ImporterCleanup() { |
| 427 importer_->Cancel(); | 432 importer_->Cancel(); |
| 428 importer_ = NULL; | 433 importer_ = NULL; |
| 429 bridge_ = NULL; | 434 bridge_ = NULL; |
| 430 import_thread_.reset(); | 435 import_thread_.reset(); |
| 431 content::UtilityThread::Get()->ReleaseProcessIfNeeded(); | 436 content::UtilityThread::Get()->ReleaseProcessIfNeeded(); |
| 432 } | 437 } |
| 433 | 438 |
| 434 } // namespace chrome | 439 } // namespace chrome |
| OLD | NEW |