| 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/location.h" | 8 #include "base/location.h" |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 11 #include "base/single_thread_task_runner.h" | 11 #include "base/single_thread_task_runner.h" |
| 12 #include "base/threading/thread.h" | 12 #include "base/threading/thread.h" |
| 13 #include "base/threading/thread_task_runner_handle.h" | 13 #include "base/threading/thread_task_runner_handle.h" |
| 14 #include "build/build_config.h" | 14 #include "build/build_config.h" |
| 15 #include "chrome/utility/importer/external_process_importer_bridge.h" | 15 #include "chrome/utility/importer/external_process_importer_bridge.h" |
| 16 #include "chrome/utility/importer/importer.h" | 16 #include "chrome/utility/importer/importer.h" |
| 17 #include "chrome/utility/importer/importer_creator.h" | 17 #include "chrome/utility/importer/importer_creator.h" |
| 18 #include "content/public/utility/utility_thread.h" | 18 #include "content/public/utility/utility_thread.h" |
| 19 #include "mojo/public/cpp/bindings/strong_binding.h" | 19 #include "mojo/public/cpp/bindings/strong_binding.h" |
| 20 | 20 |
| 21 using chrome::mojom::ThreadSafeProfileImportObserverPtr; | 21 using chrome::mojom::ThreadSafeProfileImportObserverPtr; |
| 22 | 22 |
| 23 ProfileImportHandler::ProfileImportHandler() : items_to_import_(0) {} | 23 ProfileImportHandler::ProfileImportHandler() : items_to_import_(0) {} |
| 24 | 24 |
| 25 ProfileImportHandler::~ProfileImportHandler() {} | 25 ProfileImportHandler::~ProfileImportHandler() {} |
| 26 | 26 |
| 27 // static | 27 // static |
| 28 void ProfileImportHandler::Create( | 28 void ProfileImportHandler::Create( |
| 29 mojo::InterfaceRequest<chrome::mojom::ProfileImport> request) { | 29 const service_manager::BindSourceInfo& source_info, |
| 30 chrome::mojom::ProfileImportRequest request) { |
| 30 mojo::MakeStrongBinding(base::MakeUnique<ProfileImportHandler>(), | 31 mojo::MakeStrongBinding(base::MakeUnique<ProfileImportHandler>(), |
| 31 std::move(request)); | 32 std::move(request)); |
| 32 } | 33 } |
| 33 | 34 |
| 34 void ProfileImportHandler::StartImport( | 35 void ProfileImportHandler::StartImport( |
| 35 const importer::SourceProfile& source_profile, | 36 const importer::SourceProfile& source_profile, |
| 36 uint16_t items, | 37 uint16_t items, |
| 37 std::unique_ptr<base::DictionaryValue> localized_strings, | 38 std::unique_ptr<base::DictionaryValue> localized_strings, |
| 38 chrome::mojom::ProfileImportObserverPtr observer) { | 39 chrome::mojom::ProfileImportObserverPtr observer) { |
| 39 content::UtilityThread::Get()->EnsureBlinkInitialized(); | 40 content::UtilityThread::Get()->EnsureBlinkInitialized(); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 } | 74 } |
| 74 } | 75 } |
| 75 | 76 |
| 76 void ProfileImportHandler::ImporterCleanup() { | 77 void ProfileImportHandler::ImporterCleanup() { |
| 77 importer_->Cancel(); | 78 importer_->Cancel(); |
| 78 importer_ = NULL; | 79 importer_ = NULL; |
| 79 bridge_ = NULL; | 80 bridge_ = NULL; |
| 80 import_thread_.reset(); | 81 import_thread_.reset(); |
| 81 content::UtilityThread::Get()->ReleaseProcessIfNeeded(); | 82 content::UtilityThread::Get()->ReleaseProcessIfNeeded(); |
| 82 } | 83 } |
| OLD | NEW |