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

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(ProfileImportProcessHostMsg_NotifyFirefoxSearchEngData,
105 OnFirefoxSearchEngineDataReceived)
106 IPC_MESSAGE_UNHANDLED(handled = false) 106 IPC_MESSAGE_UNHANDLED(handled = false)
107 IPC_END_MESSAGE_MAP() 107 IPC_END_MESSAGE_MAP()
108 return handled; 108 return handled;
109 } 109 }
110 110
111 void ExternalProcessImporterClient::OnImportStart() { 111 void ExternalProcessImporterClient::OnImportStart() {
112 if (cancelled_) 112 if (cancelled_)
113 return; 113 return;
114 114
115 bridge_->NotifyStarted(); 115 bridge_->NotifyStarted();
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 222
223 void ExternalProcessImporterClient::OnPasswordFormImportReady( 223 void ExternalProcessImporterClient::OnPasswordFormImportReady(
224 const content::PasswordForm& form) { 224 const content::PasswordForm& form) {
225 if (cancelled_) 225 if (cancelled_)
226 return; 226 return;
227 227
228 bridge_->SetPasswordForm(form); 228 bridge_->SetPasswordForm(form);
229 } 229 }
230 230
231 void ExternalProcessImporterClient::OnKeywordsImportReady( 231 void ExternalProcessImporterClient::OnKeywordsImportReady(
232 const std::vector<TemplateURL*>& template_urls, 232 const std::vector<importer::URLKeywordInfo>& url_keywords,
233 bool unique_on_host_and_path) { 233 bool unique_on_host_and_path) {
234 if (cancelled_) 234 if (cancelled_)
235 return; 235 return;
236 bridge_->SetKeywords(url_keywords, unique_on_host_and_path);
237 }
236 238
237 bridge_->SetKeywords(template_urls, unique_on_host_and_path); 239 void ExternalProcessImporterClient::OnFirefoxSearchEngineDataReceived(
238 // The pointers in |template_urls| have now been deleted. 240 const std::vector<std::string> search_engine_data) {
241 if (cancelled_)
242 return;
243 bridge_->SetFirefoxSearchEnginesXMLData(search_engine_data);
239 } 244 }
240 245
241 ExternalProcessImporterClient::~ExternalProcessImporterClient() {} 246 ExternalProcessImporterClient::~ExternalProcessImporterClient() {}
242 247
243 void ExternalProcessImporterClient::Cleanup() { 248 void ExternalProcessImporterClient::Cleanup() {
244 if (cancelled_) 249 if (cancelled_)
245 return; 250 return;
246 251
247 if (process_importer_host_) 252 if (process_importer_host_)
248 process_importer_host_->NotifyImportEnded(); 253 process_importer_host_->NotifyImportEnded();
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 localized_strings.SetString( 298 localized_strings.SetString(
294 base::IntToString(IDS_IMPORT_FROM_SAFARI), 299 base::IntToString(IDS_IMPORT_FROM_SAFARI),
295 l10n_util::GetStringUTF8(IDS_IMPORT_FROM_SAFARI)); 300 l10n_util::GetStringUTF8(IDS_IMPORT_FROM_SAFARI));
296 localized_strings.SetString( 301 localized_strings.SetString(
297 base::IntToString(IDS_BOOKMARK_BAR_FOLDER_NAME), 302 base::IntToString(IDS_BOOKMARK_BAR_FOLDER_NAME),
298 l10n_util::GetStringUTF8(IDS_BOOKMARK_BAR_FOLDER_NAME)); 303 l10n_util::GetStringUTF8(IDS_BOOKMARK_BAR_FOLDER_NAME));
299 304
300 utility_process_host_->Send(new ProfileImportProcessMsg_StartImport( 305 utility_process_host_->Send(new ProfileImportProcessMsg_StartImport(
301 source_profile_, items_, localized_strings)); 306 source_profile_, items_, localized_strings));
302 } 307 }
OLDNEW
« no previous file with comments | « chrome/browser/importer/external_process_importer_client.h ('k') | chrome/browser/importer/firefox3_importer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698