| 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/profile_import_handler.h" | 5 #include "chrome/utility/profile_import_handler.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/message_loop/message_loop_proxy.h" | 9 #include "base/message_loop/message_loop_proxy.h" |
| 10 #include "base/threading/thread.h" | 10 #include "base/threading/thread.h" |
| 11 #include "chrome/common/importer/profile_import_process_messages.h" | 11 #include "chrome/common/importer/profile_import_process_messages.h" |
| 12 #include "chrome/utility/importer/external_process_importer_bridge.h" | 12 #include "chrome/utility/importer/external_process_importer_bridge.h" |
| 13 #include "chrome/utility/importer/importer.h" | 13 #include "chrome/utility/importer/importer.h" |
| 14 #include "chrome/utility/importer/importer_creator.h" | 14 #include "chrome/utility/importer/importer_creator.h" |
| 15 #include "content/public/utility/utility_thread.h" | 15 #include "content/public/utility/utility_thread.h" |
| 16 | 16 |
| 17 namespace chrome { | 17 namespace { |
| 18 |
| 19 bool Send(IPC::Message* message) { |
| 20 return content::UtilityThread::Get()->Send(message); |
| 21 } |
| 22 |
| 23 } // namespace |
| 18 | 24 |
| 19 ProfileImportHandler::ProfileImportHandler() : items_to_import_(0) {} | 25 ProfileImportHandler::ProfileImportHandler() : items_to_import_(0) {} |
| 20 | 26 |
| 21 ProfileImportHandler::~ProfileImportHandler() {} | 27 ProfileImportHandler::~ProfileImportHandler() {} |
| 22 | 28 |
| 23 bool ProfileImportHandler::OnMessageReceived(const IPC::Message& message) { | 29 bool ProfileImportHandler::OnMessageReceived(const IPC::Message& message) { |
| 24 bool handled = true; | 30 bool handled = true; |
| 25 IPC_BEGIN_MESSAGE_MAP(ProfileImportHandler, message) | 31 IPC_BEGIN_MESSAGE_MAP(ProfileImportHandler, message) |
| 26 IPC_MESSAGE_HANDLER(ProfileImportProcessMsg_StartImport, OnImportStart) | 32 IPC_MESSAGE_HANDLER(ProfileImportProcessMsg_StartImport, OnImportStart) |
| 27 IPC_MESSAGE_HANDLER(ProfileImportProcessMsg_CancelImport, OnImportCancel) | 33 IPC_MESSAGE_HANDLER(ProfileImportProcessMsg_CancelImport, OnImportCancel) |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 } | 82 } |
| 77 } | 83 } |
| 78 | 84 |
| 79 void ProfileImportHandler::ImporterCleanup() { | 85 void ProfileImportHandler::ImporterCleanup() { |
| 80 importer_->Cancel(); | 86 importer_->Cancel(); |
| 81 importer_ = NULL; | 87 importer_ = NULL; |
| 82 bridge_ = NULL; | 88 bridge_ = NULL; |
| 83 import_thread_.reset(); | 89 import_thread_.reset(); |
| 84 content::UtilityThread::Get()->ReleaseProcessIfNeeded(); | 90 content::UtilityThread::Get()->ReleaseProcessIfNeeded(); |
| 85 } | 91 } |
| 86 | |
| 87 // static | |
| 88 bool ProfileImportHandler::Send(IPC::Message* message) { | |
| 89 return content::UtilityThread::Get()->Send(message); | |
| 90 } | |
| 91 | |
| 92 } // namespace chrome | |
| OLD | NEW |