Chromium Code Reviews| 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 75 OnUnpackWebResource) | 75 OnUnpackWebResource) |
| 76 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_ParseUpdateManifest, | 76 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_ParseUpdateManifest, |
| 77 OnParseUpdateManifest) | 77 OnParseUpdateManifest) |
| 78 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_DecodeImage, OnDecodeImage) | 78 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_DecodeImage, OnDecodeImage) |
| 79 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_DecodeImageBase64, OnDecodeImageBase64) | 79 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_DecodeImageBase64, OnDecodeImageBase64) |
| 80 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_RenderPDFPagesToMetafile, | 80 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_RenderPDFPagesToMetafile, |
| 81 OnRenderPDFPagesToMetafile) | 81 OnRenderPDFPagesToMetafile) |
| 82 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_ParseJSON, OnParseJSON) | 82 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_ParseJSON, OnParseJSON) |
| 83 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_GetPrinterCapsAndDefaults, | 83 IPC_MESSAGE_HANDLER(ChromeUtilityMsg_GetPrinterCapsAndDefaults, |
| 84 OnGetPrinterCapsAndDefaults) | 84 OnGetPrinterCapsAndDefaults) |
| 85 #if !defined(OS_ANDROID) | |
| 85 IPC_MESSAGE_HANDLER(ProfileImportProcessMsg_StartImport, | 86 IPC_MESSAGE_HANDLER(ProfileImportProcessMsg_StartImport, |
| 86 OnImportStart) | 87 OnImportStart) |
| 87 IPC_MESSAGE_HANDLER(ProfileImportProcessMsg_CancelImport, | 88 IPC_MESSAGE_HANDLER(ProfileImportProcessMsg_CancelImport, |
| 88 OnImportCancel) | 89 OnImportCancel) |
| 89 IPC_MESSAGE_HANDLER(ProfileImportProcessMsg_ReportImportItemFinished, | 90 IPC_MESSAGE_HANDLER(ProfileImportProcessMsg_ReportImportItemFinished, |
| 90 OnImportItemFinished) | 91 OnImportItemFinished) |
| 92 #endif | |
| 91 IPC_MESSAGE_UNHANDLED(handled = false) | 93 IPC_MESSAGE_UNHANDLED(handled = false) |
| 92 IPC_END_MESSAGE_MAP() | 94 IPC_END_MESSAGE_MAP() |
| 93 return handled; | 95 return handled; |
| 94 } | 96 } |
| 95 | 97 |
| 96 bool ChromeContentUtilityClient::Send(IPC::Message* message) { | 98 bool ChromeContentUtilityClient::Send(IPC::Message* message) { |
| 97 return content::UtilityThread::Get()->Send(message); | 99 return content::UtilityThread::Get()->Send(message); |
| 98 } | 100 } |
| 99 | 101 |
| 100 void ChromeContentUtilityClient::OnUnpackExtension( | 102 void ChromeContentUtilityClient::OnUnpackExtension( |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 384 printer_name, printer_info)); | 386 printer_name, printer_info)); |
| 385 } else | 387 } else |
| 386 #endif | 388 #endif |
| 387 { | 389 { |
| 388 Send(new ChromeUtilityHostMsg_GetPrinterCapsAndDefaults_Failed( | 390 Send(new ChromeUtilityHostMsg_GetPrinterCapsAndDefaults_Failed( |
| 389 printer_name)); | 391 printer_name)); |
| 390 } | 392 } |
| 391 content::UtilityThread::Get()->ReleaseProcessIfNeeded(); | 393 content::UtilityThread::Get()->ReleaseProcessIfNeeded(); |
| 392 } | 394 } |
| 393 | 395 |
| 396 #if !defined(OS_ANDROID) | |
| 394 void ChromeContentUtilityClient::OnImportStart( | 397 void ChromeContentUtilityClient::OnImportStart( |
|
Yaron
2012/07/16 19:33:39
Does any of this logic actually intermix with the
Philippe
2012/07/17 09:48:27
Done. Good idea!
| |
| 395 const importer::SourceProfile& source_profile, | 398 const importer::SourceProfile& source_profile, |
| 396 uint16 items, | 399 uint16 items, |
| 397 const DictionaryValue& localized_strings) { | 400 const DictionaryValue& localized_strings) { |
| 398 bridge_ = new ExternalProcessImporterBridge( | 401 bridge_ = new ExternalProcessImporterBridge( |
| 399 localized_strings, content::UtilityThread::Get(), | 402 localized_strings, content::UtilityThread::Get(), |
| 400 base::MessageLoopProxy::current()); | 403 base::MessageLoopProxy::current()); |
| 401 importer_ = importer::CreateImporterByType(source_profile.importer_type); | 404 importer_ = importer::CreateImporterByType(source_profile.importer_type); |
| 402 if (!importer_) { | 405 if (!importer_) { |
| 403 Send(new ProfileImportProcessHostMsg_Import_Finished(false, | 406 Send(new ProfileImportProcessHostMsg_Import_Finished(false, |
| 404 "Importer could not be created.")); | 407 "Importer could not be created.")); |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 433 } | 436 } |
| 434 } | 437 } |
| 435 | 438 |
| 436 void ChromeContentUtilityClient::ImporterCleanup() { | 439 void ChromeContentUtilityClient::ImporterCleanup() { |
| 437 importer_->Cancel(); | 440 importer_->Cancel(); |
| 438 importer_ = NULL; | 441 importer_ = NULL; |
| 439 bridge_ = NULL; | 442 bridge_ = NULL; |
| 440 import_thread_.reset(); | 443 import_thread_.reset(); |
| 441 content::UtilityThread::Get()->ReleaseProcessIfNeeded(); | 444 content::UtilityThread::Get()->ReleaseProcessIfNeeded(); |
| 442 } | 445 } |
| 446 #endif | |
| 443 | 447 |
| 444 } // namespace chrome | 448 } // namespace chrome |
| OLD | NEW |