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/browser/importer/external_process_importer_client.h" | 5 #include "chrome/browser/importer/external_process_importer_client.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/importer/external_process_importer_host.h" | 10 #include "chrome/browser/importer/external_process_importer_host.h" |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 IPC_MESSAGE_HANDLER(ProfileImportProcessHostMsg_NotifyFaviconsImportStart, | 99 IPC_MESSAGE_HANDLER(ProfileImportProcessHostMsg_NotifyFaviconsImportStart, |
100 OnFaviconsImportStart) | 100 OnFaviconsImportStart) |
101 IPC_MESSAGE_HANDLER(ProfileImportProcessHostMsg_NotifyFaviconsImportGroup, | 101 IPC_MESSAGE_HANDLER(ProfileImportProcessHostMsg_NotifyFaviconsImportGroup, |
102 OnFaviconsImportGroup) | 102 OnFaviconsImportGroup) |
103 IPC_MESSAGE_HANDLER(ProfileImportProcessHostMsg_NotifyPasswordFormReady, | 103 IPC_MESSAGE_HANDLER(ProfileImportProcessHostMsg_NotifyPasswordFormReady, |
104 OnPasswordFormImportReady) | 104 OnPasswordFormImportReady) |
105 IPC_MESSAGE_HANDLER(ProfileImportProcessHostMsg_NotifyKeywordsReady, | 105 IPC_MESSAGE_HANDLER(ProfileImportProcessHostMsg_NotifyKeywordsReady, |
106 OnKeywordsImportReady) | 106 OnKeywordsImportReady) |
107 IPC_MESSAGE_HANDLER(ProfileImportProcessHostMsg_NotifyFirefoxSearchEngData, | 107 IPC_MESSAGE_HANDLER(ProfileImportProcessHostMsg_NotifyFirefoxSearchEngData, |
108 OnFirefoxSearchEngineDataReceived) | 108 OnFirefoxSearchEngineDataReceived) |
| 109 IPC_MESSAGE_HANDLER(ProfileImportProcessHostMsg_AutofillFormDataImportStart, |
| 110 OnAutofillFormDataImportStart) |
| 111 IPC_MESSAGE_HANDLER(ProfileImportProcessHostMsg_AutofillFormDataImportGroup, |
| 112 OnAutofillFormDataImportGroup) |
109 #if defined(OS_WIN) | 113 #if defined(OS_WIN) |
110 IPC_MESSAGE_HANDLER(ProfileImportProcessHostMsg_NotifyIE7PasswordInfo, | 114 IPC_MESSAGE_HANDLER(ProfileImportProcessHostMsg_NotifyIE7PasswordInfo, |
111 OnIE7PasswordReceived) | 115 OnIE7PasswordReceived) |
112 #endif | 116 #endif |
113 IPC_MESSAGE_UNHANDLED(handled = false) | 117 IPC_MESSAGE_UNHANDLED(handled = false) |
114 IPC_END_MESSAGE_MAP() | 118 IPC_END_MESSAGE_MAP() |
115 return handled; | 119 return handled; |
116 } | 120 } |
117 | 121 |
118 void ExternalProcessImporterClient::OnImportStart() { | 122 void ExternalProcessImporterClient::OnImportStart() { |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 bridge_->SetKeywords(url_keywords, unique_on_host_and_path); | 247 bridge_->SetKeywords(url_keywords, unique_on_host_and_path); |
244 } | 248 } |
245 | 249 |
246 void ExternalProcessImporterClient::OnFirefoxSearchEngineDataReceived( | 250 void ExternalProcessImporterClient::OnFirefoxSearchEngineDataReceived( |
247 const std::vector<std::string> search_engine_data) { | 251 const std::vector<std::string> search_engine_data) { |
248 if (cancelled_) | 252 if (cancelled_) |
249 return; | 253 return; |
250 bridge_->SetFirefoxSearchEnginesXMLData(search_engine_data); | 254 bridge_->SetFirefoxSearchEnginesXMLData(search_engine_data); |
251 } | 255 } |
252 | 256 |
| 257 void ExternalProcessImporterClient::OnAutofillFormDataImportStart( |
| 258 size_t total_autofill_form_data_entry_count) { |
| 259 if (cancelled_) |
| 260 return; |
| 261 |
| 262 total_autofill_form_data_entry_count_ = total_autofill_form_data_entry_count; |
| 263 autofill_form_data_.reserve(total_autofill_form_data_entry_count); |
| 264 } |
| 265 |
| 266 void ExternalProcessImporterClient::OnAutofillFormDataImportGroup( |
| 267 const std::vector<ImporterAutofillFormDataEntry>& |
| 268 autofill_form_data_entry_group) { |
| 269 if (cancelled_) |
| 270 return; |
| 271 |
| 272 autofill_form_data_.insert(autofill_form_data_.end(), |
| 273 autofill_form_data_entry_group.begin(), |
| 274 autofill_form_data_entry_group.end()); |
| 275 if (autofill_form_data_.size() == total_autofill_form_data_entry_count_) |
| 276 bridge_->SetAutofillFormData(autofill_form_data_); |
| 277 } |
| 278 |
253 #if defined(OS_WIN) | 279 #if defined(OS_WIN) |
254 void ExternalProcessImporterClient::OnIE7PasswordReceived( | 280 void ExternalProcessImporterClient::OnIE7PasswordReceived( |
255 const importer::ImporterIE7PasswordInfo& importer_password_info) { | 281 const importer::ImporterIE7PasswordInfo& importer_password_info) { |
256 if (cancelled_) | 282 if (cancelled_) |
257 return; | 283 return; |
258 bridge_->AddIE7PasswordInfo(importer_password_info); | 284 bridge_->AddIE7PasswordInfo(importer_password_info); |
259 } | 285 } |
260 #endif | 286 #endif |
261 | 287 |
262 ExternalProcessImporterClient::~ExternalProcessImporterClient() {} | 288 ExternalProcessImporterClient::~ExternalProcessImporterClient() {} |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 localized_strings.SetString( | 343 localized_strings.SetString( |
318 base::IntToString(IDS_IMPORT_FROM_SAFARI), | 344 base::IntToString(IDS_IMPORT_FROM_SAFARI), |
319 l10n_util::GetStringUTF8(IDS_IMPORT_FROM_SAFARI)); | 345 l10n_util::GetStringUTF8(IDS_IMPORT_FROM_SAFARI)); |
320 localized_strings.SetString( | 346 localized_strings.SetString( |
321 base::IntToString(IDS_BOOKMARK_BAR_FOLDER_NAME), | 347 base::IntToString(IDS_BOOKMARK_BAR_FOLDER_NAME), |
322 l10n_util::GetStringUTF8(IDS_BOOKMARK_BAR_FOLDER_NAME)); | 348 l10n_util::GetStringUTF8(IDS_BOOKMARK_BAR_FOLDER_NAME)); |
323 | 349 |
324 utility_process_host_->Send(new ProfileImportProcessMsg_StartImport( | 350 utility_process_host_->Send(new ProfileImportProcessMsg_StartImport( |
325 source_profile_, items_, localized_strings)); | 351 source_profile_, items_, localized_strings)); |
326 } | 352 } |
OLD | NEW |