| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/profile_import/profile_import_thread.h" | 5 #include "chrome/profile_import/profile_import_thread.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "chrome/browser/importer/importer.h" | 10 #include "chrome/browser/importer/importer.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 ProfileImportThread::ProfileImportThread() | 27 ProfileImportThread::ProfileImportThread() |
| 28 : bridge_(NULL), | 28 : bridge_(NULL), |
| 29 browser_type_(0), | 29 browser_type_(0), |
| 30 items_to_import_(0), | 30 items_to_import_(0), |
| 31 importer_(NULL) { | 31 importer_(NULL) { |
| 32 ChildProcess::current()->AddRefProcess(); // Balanced in Cleanup(). | 32 ChildProcess::current()->AddRefProcess(); // Balanced in Cleanup(). |
| 33 } | 33 } |
| 34 | 34 |
| 35 ProfileImportThread::~ProfileImportThread() {} | 35 ProfileImportThread::~ProfileImportThread() {} |
| 36 | 36 |
| 37 void ProfileImportThread::OnControlMessageReceived(const IPC::Message& msg) { | 37 bool ProfileImportThread::OnControlMessageReceived(const IPC::Message& msg) { |
| 38 bool handled = true; |
| 38 IPC_BEGIN_MESSAGE_MAP(ProfileImportThread, msg) | 39 IPC_BEGIN_MESSAGE_MAP(ProfileImportThread, msg) |
| 39 IPC_MESSAGE_HANDLER(ProfileImportProcessMsg_StartImport, | 40 IPC_MESSAGE_HANDLER(ProfileImportProcessMsg_StartImport, |
| 40 OnImportStart) | 41 OnImportStart) |
| 41 IPC_MESSAGE_HANDLER(ProfileImportProcessMsg_CancelImport, | 42 IPC_MESSAGE_HANDLER(ProfileImportProcessMsg_CancelImport, |
| 42 OnImportCancel) | 43 OnImportCancel) |
| 43 IPC_MESSAGE_HANDLER(ProfileImportProcessMsg_ReportImportItemFinished, | 44 IPC_MESSAGE_HANDLER(ProfileImportProcessMsg_ReportImportItemFinished, |
| 44 OnImportItemFinished) | 45 OnImportItemFinished) |
| 46 IPC_MESSAGE_UNHANDLED(handled = false) |
| 45 IPC_END_MESSAGE_MAP() | 47 IPC_END_MESSAGE_MAP() |
| 48 return handled; |
| 46 } | 49 } |
| 47 | 50 |
| 48 void ProfileImportThread::OnImportStart( | 51 void ProfileImportThread::OnImportStart( |
| 49 const ProfileInfo& profile_info, | 52 const ProfileInfo& profile_info, |
| 50 int items, | 53 int items, |
| 51 const DictionaryValue& localized_strings, | 54 const DictionaryValue& localized_strings, |
| 52 bool import_to_bookmark_bar) { | 55 bool import_to_bookmark_bar) { |
| 53 bridge_ = new ExternalProcessImporterBridge(this, localized_strings); | 56 bridge_ = new ExternalProcessImporterBridge(this, localized_strings); |
| 54 | 57 |
| 55 scoped_refptr<ImporterList> importer_list(new ImporterList); | 58 scoped_refptr<ImporterList> importer_list(new ImporterList); |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 Send(new ProfileImportProcessHostMsg_NotifyKeywordsReady(urls, | 189 Send(new ProfileImportProcessHostMsg_NotifyKeywordsReady(urls, |
| 187 default_keyword_index, unique_on_host_and_path)); | 190 default_keyword_index, unique_on_host_and_path)); |
| 188 } | 191 } |
| 189 | 192 |
| 190 void ProfileImportThread::Cleanup() { | 193 void ProfileImportThread::Cleanup() { |
| 191 importer_->Cancel(); | 194 importer_->Cancel(); |
| 192 importer_ = NULL; | 195 importer_ = NULL; |
| 193 bridge_ = NULL; | 196 bridge_ = NULL; |
| 194 ChildProcess::current()->ReleaseProcess(); | 197 ChildProcess::current()->ReleaseProcess(); |
| 195 } | 198 } |
| OLD | NEW |