Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(51)

Side by Side Diff: chrome/browser/importer/external_process_importer_client.cc

Issue 18064002: The browser importer code which runs in the utility process should not depend on chrome\browser dat… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/bookmarks/imported_bookmark_entry.h" 9 #include "chrome/browser/bookmarks/imported_bookmark_entry.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
11 #include "chrome/browser/importer/external_process_importer_host.h" 11 #include "chrome/browser/importer/external_process_importer_host.h"
12 #include "chrome/browser/importer/firefox_importer_utils.h" 12 #include "chrome/browser/importer/firefox_importer_utils.h"
13 #include "chrome/browser/importer/importer_host.h" 13 #include "chrome/browser/importer/importer_host.h"
14 #include "chrome/browser/importer/in_process_importer_bridge.h" 14 #include "chrome/browser/importer/in_process_importer_bridge.h"
15 #include "chrome/browser/importer/profile_import_process_messages.h" 15 #include "chrome/browser/importer/profile_import_process_messages.h"
16 #include "chrome/browser/search_engines/template_url.h"
17 #include "chrome/browser/search_engines/template_url_service.h"
18 #include "content/public/browser/browser_thread.h" 16 #include "content/public/browser/browser_thread.h"
19 #include "content/public/browser/utility_process_host.h" 17 #include "content/public/browser/utility_process_host.h"
20 #include "grit/generated_resources.h" 18 #include "grit/generated_resources.h"
21 #include "ui/base/l10n/l10n_util.h" 19 #include "ui/base/l10n/l10n_util.h"
22 20
23 using content::BrowserThread; 21 using content::BrowserThread;
24 using content::UtilityProcessHost; 22 using content::UtilityProcessHost;
25 23
26 ExternalProcessImporterClient::ExternalProcessImporterClient( 24 ExternalProcessImporterClient::ExternalProcessImporterClient(
27 ExternalProcessImporterHost* importer_host, 25 ExternalProcessImporterHost* importer_host,
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 IPC_MESSAGE_HANDLER(ProfileImportProcessHostMsg_NotifyBookmarksImportGroup, 94 IPC_MESSAGE_HANDLER(ProfileImportProcessHostMsg_NotifyBookmarksImportGroup,
97 OnBookmarksImportGroup) 95 OnBookmarksImportGroup)
98 IPC_MESSAGE_HANDLER(ProfileImportProcessHostMsg_NotifyFaviconsImportStart, 96 IPC_MESSAGE_HANDLER(ProfileImportProcessHostMsg_NotifyFaviconsImportStart,
99 OnFaviconsImportStart) 97 OnFaviconsImportStart)
100 IPC_MESSAGE_HANDLER(ProfileImportProcessHostMsg_NotifyFaviconsImportGroup, 98 IPC_MESSAGE_HANDLER(ProfileImportProcessHostMsg_NotifyFaviconsImportGroup,
101 OnFaviconsImportGroup) 99 OnFaviconsImportGroup)
102 IPC_MESSAGE_HANDLER(ProfileImportProcessHostMsg_NotifyPasswordFormReady, 100 IPC_MESSAGE_HANDLER(ProfileImportProcessHostMsg_NotifyPasswordFormReady,
103 OnPasswordFormImportReady) 101 OnPasswordFormImportReady)
104 IPC_MESSAGE_HANDLER(ProfileImportProcessHostMsg_NotifyKeywordsReady, 102 IPC_MESSAGE_HANDLER(ProfileImportProcessHostMsg_NotifyKeywordsReady,
105 OnKeywordsImportReady) 103 OnKeywordsImportReady)
104 IPC_MESSAGE_HANDLER(
105 ProfileImportProcessHostMsg_NotifyFirefoxSearchEngineData,
106 OnFirefoxSearchEngineDataReceived)
scottmg 2013/06/27 15:47:21 nit; make indent match other messages
ananta 2013/06/27 15:56:49 Changed the IPC name to ProfileImportProcessHostMs
106 IPC_MESSAGE_UNHANDLED(handled = false) 107 IPC_MESSAGE_UNHANDLED(handled = false)
107 IPC_END_MESSAGE_MAP() 108 IPC_END_MESSAGE_MAP()
108 return handled; 109 return handled;
109 } 110 }
110 111
111 void ExternalProcessImporterClient::OnImportStart() { 112 void ExternalProcessImporterClient::OnImportStart() {
112 if (cancelled_) 113 if (cancelled_)
113 return; 114 return;
114 115
115 bridge_->NotifyStarted(); 116 bridge_->NotifyStarted();
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 223
223 void ExternalProcessImporterClient::OnPasswordFormImportReady( 224 void ExternalProcessImporterClient::OnPasswordFormImportReady(
224 const content::PasswordForm& form) { 225 const content::PasswordForm& form) {
225 if (cancelled_) 226 if (cancelled_)
226 return; 227 return;
227 228
228 bridge_->SetPasswordForm(form); 229 bridge_->SetPasswordForm(form);
229 } 230 }
230 231
231 void ExternalProcessImporterClient::OnKeywordsImportReady( 232 void ExternalProcessImporterClient::OnKeywordsImportReady(
232 const std::vector<TemplateURL*>& template_urls, 233 const std::vector<importer::URLKeywordInfo>& url_keywords,
233 bool unique_on_host_and_path) { 234 bool unique_on_host_and_path) {
234 if (cancelled_) 235 if (cancelled_)
235 return; 236 return;
237 bridge_->SetKeywords(url_keywords, unique_on_host_and_path);
238 }
236 239
237 bridge_->SetKeywords(template_urls, unique_on_host_and_path); 240 void ExternalProcessImporterClient::OnFirefoxSearchEngineDataReceived(
238 // The pointers in |template_urls| have now been deleted. 241 const std::vector<std::string> search_engine_data) {
242 if (cancelled_)
243 return;
244 bridge_->SetFirefoxSearchEnginesXMLData(search_engine_data);
239 } 245 }
240 246
241 ExternalProcessImporterClient::~ExternalProcessImporterClient() {} 247 ExternalProcessImporterClient::~ExternalProcessImporterClient() {}
242 248
243 void ExternalProcessImporterClient::Cleanup() { 249 void ExternalProcessImporterClient::Cleanup() {
244 if (cancelled_) 250 if (cancelled_)
245 return; 251 return;
246 252
247 if (process_importer_host_) 253 if (process_importer_host_)
248 process_importer_host_->NotifyImportEnded(); 254 process_importer_host_->NotifyImportEnded();
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 localized_strings.SetString( 299 localized_strings.SetString(
294 base::IntToString(IDS_IMPORT_FROM_SAFARI), 300 base::IntToString(IDS_IMPORT_FROM_SAFARI),
295 l10n_util::GetStringUTF8(IDS_IMPORT_FROM_SAFARI)); 301 l10n_util::GetStringUTF8(IDS_IMPORT_FROM_SAFARI));
296 localized_strings.SetString( 302 localized_strings.SetString(
297 base::IntToString(IDS_BOOKMARK_BAR_FOLDER_NAME), 303 base::IntToString(IDS_BOOKMARK_BAR_FOLDER_NAME),
298 l10n_util::GetStringUTF8(IDS_BOOKMARK_BAR_FOLDER_NAME)); 304 l10n_util::GetStringUTF8(IDS_BOOKMARK_BAR_FOLDER_NAME));
299 305
300 utility_process_host_->Send(new ProfileImportProcessMsg_StartImport( 306 utility_process_host_->Send(new ProfileImportProcessMsg_StartImport(
301 source_profile_, items_, localized_strings)); 307 source_profile_, items_, localized_strings));
302 } 308 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698