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

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

Issue 2470283002: Convert profile import IPCs to Mojo (Closed)
Patch Set: Use enum instead of int in mojom where possible Created 4 years, 1 month 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
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 "build/build_config.h" 9 #include "build/build_config.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/in_process_importer_bridge.h" 12 #include "chrome/browser/importer/in_process_importer_bridge.h"
13 #include "chrome/common/importer/firefox_importer_utils.h" 13 #include "chrome/common/importer/firefox_importer_utils.h"
14 #include "chrome/common/importer/imported_bookmark_entry.h" 14 #include "chrome/common/importer/imported_bookmark_entry.h"
15 #include "chrome/common/importer/profile_import_process_messages.h"
16 #include "chrome/grit/generated_resources.h" 15 #include "chrome/grit/generated_resources.h"
17 #include "components/strings/grit/components_strings.h" 16 #include "components/strings/grit/components_strings.h"
18 #include "content/public/browser/browser_thread.h" 17 #include "content/public/browser/browser_thread.h"
19 #include "content/public/browser/utility_process_host.h" 18 #include "content/public/browser/utility_process_host.h"
19 #include "services/service_manager/public/cpp/interface_provider.h"
20 #include "ui/base/l10n/l10n_util.h" 20 #include "ui/base/l10n/l10n_util.h"
21 21
22 using content::BrowserThread; 22 using content::BrowserThread;
23 using content::UtilityProcessHost; 23 using content::UtilityProcessHost;
24 24
25 ExternalProcessImporterClient::ExternalProcessImporterClient( 25 ExternalProcessImporterClient::ExternalProcessImporterClient(
26 base::WeakPtr<ExternalProcessImporterHost> importer_host, 26 base::WeakPtr<ExternalProcessImporterHost> importer_host,
27 const importer::SourceProfile& source_profile, 27 const importer::SourceProfile& source_profile,
28 uint16_t items, 28 uint16_t items,
29 InProcessImporterBridge* bridge) 29 InProcessImporterBridge* bridge)
30 : total_bookmarks_count_(0), 30 : total_bookmarks_count_(0),
31 total_history_rows_count_(0), 31 total_history_rows_count_(0),
32 total_favicons_count_(0), 32 total_favicons_count_(0),
33 process_importer_host_(importer_host), 33 process_importer_host_(importer_host),
34 source_profile_(source_profile), 34 source_profile_(source_profile),
35 items_(items), 35 items_(items),
36 bridge_(bridge), 36 bridge_(bridge),
37 cancelled_(false) { 37 cancelled_(false),
38 binding_(this) {
38 process_importer_host_->NotifyImportStarted(); 39 process_importer_host_->NotifyImportStarted();
39 } 40 }
40 41
41 void ExternalProcessImporterClient::Start() { 42 void ExternalProcessImporterClient::Start() {
42 AddRef(); // balanced in Cleanup. 43 AddRef(); // balanced in Cleanup.
43 BrowserThread::ID thread_id; 44 BrowserThread::ID thread_id;
44 CHECK(BrowserThread::GetCurrentThreadIdentifier(&thread_id)); 45 CHECK(BrowserThread::GetCurrentThreadIdentifier(&thread_id));
45 BrowserThread::PostTask( 46 BrowserThread::PostTask(
46 BrowserThread::IO, FROM_HERE, 47 BrowserThread::IO, FROM_HERE,
47 base::Bind(&ExternalProcessImporterClient::StartProcessOnIOThread, 48 base::Bind(&ExternalProcessImporterClient::StartProcessOnIOThread,
48 this, 49 this,
49 thread_id)); 50 thread_id));
50 } 51 }
51 52
52 void ExternalProcessImporterClient::Cancel() { 53 void ExternalProcessImporterClient::Cancel() {
53 if (cancelled_) 54 if (cancelled_)
54 return; 55 return;
55 56
56 cancelled_ = true; 57 cancelled_ = true;
57 BrowserThread::PostTask( 58 if (utility_process_host_.get())
58 BrowserThread::IO, FROM_HERE, 59 profile_import_->CancelImport();
59 base::Bind( 60 CloseMojoHandles();
60 &ExternalProcessImporterClient::CancelImportProcessOnIOThread,
61 this));
62 Release(); 61 Release();
63 } 62 }
64 63
65 void ExternalProcessImporterClient::OnProcessCrashed(int exit_code) { 64 void ExternalProcessImporterClient::OnProcessCrashed(int exit_code) {
66 DLOG(ERROR) << __func__; 65 DLOG(ERROR) << __func__;
67 if (cancelled_) 66 if (cancelled_)
68 return; 67 return;
69 68
70 // If the host is still around, cancel the import; otherwise it means the 69 // If the host is still around, cancel the import; otherwise it means the
71 // import was already cancelled or completed and this message can be dropped. 70 // import was already cancelled or completed and this message can be dropped.
72 if (process_importer_host_.get()) 71 if (process_importer_host_.get())
73 process_importer_host_->Cancel(); 72 process_importer_host_->Cancel();
74 } 73 }
75 74
76 bool ExternalProcessImporterClient::OnMessageReceived( 75 bool ExternalProcessImporterClient::OnMessageReceived(
77 const IPC::Message& message) { 76 const IPC::Message& message) {
78 bool handled = true; 77 return false;
gab 2016/11/07 20:07:31 Why is this method still needed?
tibell 2016/11/07 23:34:23 It's a (unfortunately) a pure virtual method in co
gab 2016/11/08 13:34:24 I see, does every mojo host need this to get OnPro
79 IPC_BEGIN_MESSAGE_MAP(ExternalProcessImporterClient, message)
80 // Notification messages about the state of the import process.
81 IPC_MESSAGE_HANDLER(ProfileImportProcessHostMsg_Import_Started,
82 OnImportStart)
83 IPC_MESSAGE_HANDLER(ProfileImportProcessHostMsg_Import_Finished,
84 OnImportFinished)
85 IPC_MESSAGE_HANDLER(ProfileImportProcessHostMsg_ImportItem_Started,
86 OnImportItemStart)
87 IPC_MESSAGE_HANDLER(ProfileImportProcessHostMsg_ImportItem_Finished,
88 OnImportItemFinished)
89 // Data messages containing items to be written to the user profile.
90 IPC_MESSAGE_HANDLER(ProfileImportProcessHostMsg_NotifyHistoryImportStart,
91 OnHistoryImportStart)
92 IPC_MESSAGE_HANDLER(ProfileImportProcessHostMsg_NotifyHistoryImportGroup,
93 OnHistoryImportGroup)
94 IPC_MESSAGE_HANDLER(ProfileImportProcessHostMsg_NotifyHomePageImportReady,
95 OnHomePageImportReady)
96 IPC_MESSAGE_HANDLER(ProfileImportProcessHostMsg_NotifyBookmarksImportStart,
97 OnBookmarksImportStart)
98 IPC_MESSAGE_HANDLER(ProfileImportProcessHostMsg_NotifyBookmarksImportGroup,
99 OnBookmarksImportGroup)
100 IPC_MESSAGE_HANDLER(ProfileImportProcessHostMsg_NotifyFaviconsImportStart,
101 OnFaviconsImportStart)
102 IPC_MESSAGE_HANDLER(ProfileImportProcessHostMsg_NotifyFaviconsImportGroup,
103 OnFaviconsImportGroup)
104 IPC_MESSAGE_HANDLER(ProfileImportProcessHostMsg_NotifyPasswordFormReady,
105 OnPasswordFormImportReady)
106 IPC_MESSAGE_HANDLER(ProfileImportProcessHostMsg_NotifyKeywordsReady,
107 OnKeywordsImportReady)
108 IPC_MESSAGE_HANDLER(ProfileImportProcessHostMsg_NotifyFirefoxSearchEngData,
109 OnFirefoxSearchEngineDataReceived)
110 IPC_MESSAGE_HANDLER(ProfileImportProcessHostMsg_AutofillFormDataImportStart,
111 OnAutofillFormDataImportStart)
112 IPC_MESSAGE_HANDLER(ProfileImportProcessHostMsg_AutofillFormDataImportGroup,
113 OnAutofillFormDataImportGroup)
114 #if defined(OS_WIN)
115 IPC_MESSAGE_HANDLER(ProfileImportProcessHostMsg_NotifyIE7PasswordInfo,
116 OnIE7PasswordReceived)
117 #endif
118 IPC_MESSAGE_UNHANDLED(handled = false)
119 IPC_END_MESSAGE_MAP()
120 return handled;
121 } 78 }
122 79
123 void ExternalProcessImporterClient::OnImportStart() { 80 void ExternalProcessImporterClient::OnImportStart() {
124 if (cancelled_) 81 if (cancelled_)
125 return; 82 return;
126 83
127 bridge_->NotifyStarted(); 84 bridge_->NotifyStarted();
128 } 85 }
129 86
130 void ExternalProcessImporterClient::OnImportFinished( 87 void ExternalProcessImporterClient::OnImportFinished(
131 bool succeeded, const std::string& error_msg) { 88 bool succeeded, const std::string& error_msg) {
132 if (cancelled_) 89 if (cancelled_)
133 return; 90 return;
134 91
135 if (!succeeded) 92 if (!succeeded)
136 LOG(WARNING) << "Import failed. Error: " << error_msg; 93 LOG(WARNING) << "Import failed. Error: " << error_msg;
137 Cleanup(); 94 Cleanup();
138 } 95 }
139 96
140 void ExternalProcessImporterClient::OnImportItemStart(int item_data) { 97 void ExternalProcessImporterClient::OnImportItemStart(
98 importer::ImportItem item_data) {
141 if (cancelled_) 99 if (cancelled_)
142 return; 100 return;
143 101
144 bridge_->NotifyItemStarted(static_cast<importer::ImportItem>(item_data)); 102 bridge_->NotifyItemStarted(static_cast<importer::ImportItem>(item_data));
Sam McNally 2016/11/07 06:31:07 Remove the cast.
gab 2016/11/07 20:07:31 and also rename the parameter to |import_item| sin
tibell 2016/11/07 23:34:23 Done.
tibell 2016/11/07 23:34:23 Done.
145 } 103 }
146 104
147 void ExternalProcessImporterClient::OnImportItemFinished(int item_data) { 105 void ExternalProcessImporterClient::OnImportItemFinished(
106 importer::ImportItem item_data) {
148 if (cancelled_) 107 if (cancelled_)
149 return; 108 return;
150 109
151 importer::ImportItem import_item = 110 importer::ImportItem import_item =
152 static_cast<importer::ImportItem>(item_data); 111 static_cast<importer::ImportItem>(item_data);
gab 2016/11/07 20:07:32 no cast here too and rename param
tibell 2016/11/07 23:34:23 Done.
153 bridge_->NotifyItemEnded(import_item); 112 bridge_->NotifyItemEnded(import_item);
154 BrowserThread::PostTask( 113 profile_import_->ReportImportItemFinished(import_item);
155 BrowserThread::IO, FROM_HERE,
156 base::Bind(&ExternalProcessImporterClient::NotifyItemFinishedOnIOThread,
157 this,
158 import_item));
159 } 114 }
160 115
161 void ExternalProcessImporterClient::OnHistoryImportStart( 116 void ExternalProcessImporterClient::OnHistoryImportStart(
162 size_t total_history_rows_count) { 117 int total_history_rows_count) {
163 if (cancelled_) 118 if (cancelled_)
164 return; 119 return;
165 120
166 total_history_rows_count_ = total_history_rows_count; 121 total_history_rows_count_ = total_history_rows_count;
167 history_rows_.reserve(total_history_rows_count); 122 history_rows_.reserve(total_history_rows_count);
168 } 123 }
169 124
170 void ExternalProcessImporterClient::OnHistoryImportGroup( 125 void ExternalProcessImporterClient::OnHistoryImportGroup(
171 const std::vector<ImporterURLRow>& history_rows_group, 126 const std::vector<ImporterURLRow>& history_rows_group,
172 int visit_source) { 127 int visit_source) {
(...skipping 10 matching lines...) Expand all
183 void ExternalProcessImporterClient::OnHomePageImportReady( 138 void ExternalProcessImporterClient::OnHomePageImportReady(
184 const GURL& home_page) { 139 const GURL& home_page) {
185 if (cancelled_) 140 if (cancelled_)
186 return; 141 return;
187 142
188 bridge_->AddHomePage(home_page); 143 bridge_->AddHomePage(home_page);
189 } 144 }
190 145
191 void ExternalProcessImporterClient::OnBookmarksImportStart( 146 void ExternalProcessImporterClient::OnBookmarksImportStart(
192 const base::string16& first_folder_name, 147 const base::string16& first_folder_name,
193 size_t total_bookmarks_count) { 148 int total_bookmarks_count) {
194 if (cancelled_) 149 if (cancelled_)
195 return; 150 return;
196 151
197 bookmarks_first_folder_name_ = first_folder_name; 152 bookmarks_first_folder_name_ = first_folder_name;
198 total_bookmarks_count_ = total_bookmarks_count; 153 total_bookmarks_count_ = total_bookmarks_count;
199 bookmarks_.reserve(total_bookmarks_count); 154 bookmarks_.reserve(total_bookmarks_count);
200 } 155 }
201 156
202 void ExternalProcessImporterClient::OnBookmarksImportGroup( 157 void ExternalProcessImporterClient::OnBookmarksImportGroup(
203 const std::vector<ImportedBookmarkEntry>& bookmarks_group) { 158 const std::vector<ImportedBookmarkEntry>& bookmarks_group) {
204 if (cancelled_) 159 if (cancelled_)
205 return; 160 return;
206 161
207 // Collect sets of bookmarks from importer process until we have reached 162 // Collect sets of bookmarks from importer process until we have reached
208 // total_bookmarks_count_: 163 // total_bookmarks_count_:
209 bookmarks_.insert(bookmarks_.end(), bookmarks_group.begin(), 164 bookmarks_.insert(bookmarks_.end(), bookmarks_group.begin(),
210 bookmarks_group.end()); 165 bookmarks_group.end());
211 if (bookmarks_.size() >= total_bookmarks_count_) 166 if (bookmarks_.size() >= total_bookmarks_count_)
212 bridge_->AddBookmarks(bookmarks_, bookmarks_first_folder_name_); 167 bridge_->AddBookmarks(bookmarks_, bookmarks_first_folder_name_);
213 } 168 }
214 169
215 void ExternalProcessImporterClient::OnFaviconsImportStart( 170 void ExternalProcessImporterClient::OnFaviconsImportStart(
216 size_t total_favicons_count) { 171 int total_favicons_count) {
217 if (cancelled_) 172 if (cancelled_)
218 return; 173 return;
219 174
220 total_favicons_count_ = total_favicons_count; 175 total_favicons_count_ = total_favicons_count;
221 favicons_.reserve(total_favicons_count); 176 favicons_.reserve(total_favicons_count);
222 } 177 }
223 178
224 void ExternalProcessImporterClient::OnFaviconsImportGroup( 179 void ExternalProcessImporterClient::OnFaviconsImportGroup(
225 const favicon_base::FaviconUsageDataList& favicons_group) { 180 const favicon_base::FaviconUsageDataList& favicons_group) {
226 if (cancelled_) 181 if (cancelled_)
(...skipping 15 matching lines...) Expand all
242 197
243 void ExternalProcessImporterClient::OnKeywordsImportReady( 198 void ExternalProcessImporterClient::OnKeywordsImportReady(
244 const std::vector<importer::SearchEngineInfo>& search_engines, 199 const std::vector<importer::SearchEngineInfo>& search_engines,
245 bool unique_on_host_and_path) { 200 bool unique_on_host_and_path) {
246 if (cancelled_) 201 if (cancelled_)
247 return; 202 return;
248 bridge_->SetKeywords(search_engines, unique_on_host_and_path); 203 bridge_->SetKeywords(search_engines, unique_on_host_and_path);
249 } 204 }
250 205
251 void ExternalProcessImporterClient::OnFirefoxSearchEngineDataReceived( 206 void ExternalProcessImporterClient::OnFirefoxSearchEngineDataReceived(
252 const std::vector<std::string> search_engine_data) { 207 const std::vector<std::string>& search_engine_data) {
253 if (cancelled_) 208 if (cancelled_)
254 return; 209 return;
255 bridge_->SetFirefoxSearchEnginesXMLData(search_engine_data); 210 bridge_->SetFirefoxSearchEnginesXMLData(search_engine_data);
256 } 211 }
257 212
258 void ExternalProcessImporterClient::OnAutofillFormDataImportStart( 213 void ExternalProcessImporterClient::OnAutofillFormDataImportStart(
259 size_t total_autofill_form_data_entry_count) { 214 int total_autofill_form_data_entry_count) {
260 if (cancelled_) 215 if (cancelled_)
261 return; 216 return;
262 217
263 total_autofill_form_data_entry_count_ = total_autofill_form_data_entry_count; 218 total_autofill_form_data_entry_count_ = total_autofill_form_data_entry_count;
264 autofill_form_data_.reserve(total_autofill_form_data_entry_count); 219 autofill_form_data_.reserve(total_autofill_form_data_entry_count);
265 } 220 }
266 221
267 void ExternalProcessImporterClient::OnAutofillFormDataImportGroup( 222 void ExternalProcessImporterClient::OnAutofillFormDataImportGroup(
268 const std::vector<ImporterAutofillFormDataEntry>& 223 const std::vector<ImporterAutofillFormDataEntry>&
269 autofill_form_data_entry_group) { 224 autofill_form_data_entry_group) {
270 if (cancelled_) 225 if (cancelled_)
271 return; 226 return;
272 227
273 autofill_form_data_.insert(autofill_form_data_.end(), 228 autofill_form_data_.insert(autofill_form_data_.end(),
274 autofill_form_data_entry_group.begin(), 229 autofill_form_data_entry_group.begin(),
275 autofill_form_data_entry_group.end()); 230 autofill_form_data_entry_group.end());
276 if (autofill_form_data_.size() >= total_autofill_form_data_entry_count_) 231 if (autofill_form_data_.size() >= total_autofill_form_data_entry_count_)
277 bridge_->SetAutofillFormData(autofill_form_data_); 232 bridge_->SetAutofillFormData(autofill_form_data_);
278 } 233 }
279 234
280 #if defined(OS_WIN)
281 void ExternalProcessImporterClient::OnIE7PasswordReceived( 235 void ExternalProcessImporterClient::OnIE7PasswordReceived(
282 const importer::ImporterIE7PasswordInfo& importer_password_info) { 236 const importer::ImporterIE7PasswordInfo& importer_password_info) {
237 #if defined(OS_WIN)
283 if (cancelled_) 238 if (cancelled_)
284 return; 239 return;
285 bridge_->AddIE7PasswordInfo(importer_password_info); 240 bridge_->AddIE7PasswordInfo(importer_password_info);
241 #else
242 NOTREACHED();
243 #endif
286 } 244 }
287 #endif
288 245
289 ExternalProcessImporterClient::~ExternalProcessImporterClient() {} 246 ExternalProcessImporterClient::~ExternalProcessImporterClient() {}
290 247
291 void ExternalProcessImporterClient::Cleanup() { 248 void ExternalProcessImporterClient::Cleanup() {
292 if (cancelled_) 249 if (cancelled_)
293 return; 250 return;
294 251
295 if (process_importer_host_.get()) 252 if (process_importer_host_.get())
296 process_importer_host_->NotifyImportEnded(); 253 process_importer_host_->NotifyImportEnded();
254 CloseMojoHandles();
297 Release(); 255 Release();
298 } 256 }
299 257
300 void ExternalProcessImporterClient::CancelImportProcessOnIOThread() {
301 if (utility_process_host_.get())
302 utility_process_host_->Send(new ProfileImportProcessMsg_CancelImport());
303 }
304
305 void ExternalProcessImporterClient::NotifyItemFinishedOnIOThread(
306 importer::ImportItem import_item) {
307 utility_process_host_->Send(
308 new ProfileImportProcessMsg_ReportImportItemFinished(import_item));
309 }
310
311 void ExternalProcessImporterClient::StartProcessOnIOThread( 258 void ExternalProcessImporterClient::StartProcessOnIOThread(
312 BrowserThread::ID thread_id) { 259 BrowserThread::ID thread_id) {
313 utility_process_host_ = 260 utility_process_host_ =
314 UtilityProcessHost::Create( 261 UtilityProcessHost::Create(
315 this, BrowserThread::GetTaskRunnerForThread(thread_id).get()) 262 this, BrowserThread::GetTaskRunnerForThread(thread_id).get())
316 ->AsWeakPtr(); 263 ->AsWeakPtr();
317 utility_process_host_->SetName(l10n_util::GetStringUTF16( 264 utility_process_host_->SetName(l10n_util::GetStringUTF16(
318 IDS_UTILITY_PROCESS_PROFILE_IMPORTER_NAME)); 265 IDS_UTILITY_PROCESS_PROFILE_IMPORTER_NAME));
319 utility_process_host_->DisableSandbox(); 266 utility_process_host_->DisableSandbox();
320 267
321 #if defined(OS_MACOSX) 268 #if defined(OS_MACOSX)
322 base::EnvironmentMap env; 269 base::EnvironmentMap env;
323 std::string dylib_path = GetFirefoxDylibPath().value(); 270 std::string dylib_path = GetFirefoxDylibPath().value();
324 if (!dylib_path.empty()) 271 if (!dylib_path.empty())
325 env["DYLD_FALLBACK_LIBRARY_PATH"] = dylib_path; 272 env["DYLD_FALLBACK_LIBRARY_PATH"] = dylib_path;
326 utility_process_host_->SetEnv(env); 273 utility_process_host_->SetEnv(env);
327 #endif 274 #endif
328 275
276 utility_process_host_->Start();
277 chrome::mojom::ProfileImportPtr profile_import;
278 utility_process_host_->GetRemoteInterfaces()->GetInterface(&profile_import);
279
280 BrowserThread::PostTask(
281 BrowserThread::UI, FROM_HERE,
gab 2016/11/07 20:07:31 Does it matter that this on the UI thread? Is this
tibell 2016/11/07 23:34:23 I opted for Sam's suggestion below, which means we
282 base::Bind(&ExternalProcessImporterClient::SetupMojoOnUIThread, this,
283 base::Passed(profile_import.PassInterface())));
284 }
285
286 void ExternalProcessImporterClient::SetupMojoOnUIThread(
Sam McNally 2016/11/07 06:31:07 Have you considered doing this in Start() and pass
tibell 2016/11/07 23:34:23 Done.
287 chrome::mojom::ProfileImportPtrInfo profile_import_ptr_info) {
gab 2016/11/07 20:07:32 DCHECK(owning_sequence_->RunsTasksOnCurrentThread(
tibell 2016/11/07 23:34:23 Done.
288 profile_import_.Bind(std::move(profile_import_ptr_info));
289 auto observer_ptr = binding_.CreateInterfacePtrAndBind();
290
329 // Dictionary of all localized strings that could be needed by the importer 291 // Dictionary of all localized strings that could be needed by the importer
330 // in the external process. 292 // in the external process.
331 base::DictionaryValue localized_strings; 293 base::DictionaryValue localized_strings;
332 localized_strings.SetString( 294 localized_strings.SetString(
333 base::IntToString(IDS_BOOKMARK_GROUP), 295 base::IntToString(IDS_BOOKMARK_GROUP),
334 l10n_util::GetStringUTF8(IDS_BOOKMARK_GROUP)); 296 l10n_util::GetStringUTF8(IDS_BOOKMARK_GROUP));
335 localized_strings.SetString( 297 localized_strings.SetString(
336 base::IntToString(IDS_BOOKMARK_GROUP_FROM_FIREFOX), 298 base::IntToString(IDS_BOOKMARK_GROUP_FROM_FIREFOX),
337 l10n_util::GetStringUTF8(IDS_BOOKMARK_GROUP_FROM_FIREFOX)); 299 l10n_util::GetStringUTF8(IDS_BOOKMARK_GROUP_FROM_FIREFOX));
338 localized_strings.SetString( 300 localized_strings.SetString(
339 base::IntToString(IDS_BOOKMARK_GROUP_FROM_SAFARI), 301 base::IntToString(IDS_BOOKMARK_GROUP_FROM_SAFARI),
340 l10n_util::GetStringUTF8(IDS_BOOKMARK_GROUP_FROM_SAFARI)); 302 l10n_util::GetStringUTF8(IDS_BOOKMARK_GROUP_FROM_SAFARI));
341 localized_strings.SetString( 303 localized_strings.SetString(
342 base::IntToString(IDS_IMPORT_FROM_FIREFOX), 304 base::IntToString(IDS_IMPORT_FROM_FIREFOX),
343 l10n_util::GetStringUTF8(IDS_IMPORT_FROM_FIREFOX)); 305 l10n_util::GetStringUTF8(IDS_IMPORT_FROM_FIREFOX));
344 localized_strings.SetString( 306 localized_strings.SetString(
345 base::IntToString(IDS_IMPORT_FROM_ICEWEASEL), 307 base::IntToString(IDS_IMPORT_FROM_ICEWEASEL),
346 l10n_util::GetStringUTF8(IDS_IMPORT_FROM_ICEWEASEL)); 308 l10n_util::GetStringUTF8(IDS_IMPORT_FROM_ICEWEASEL));
347 localized_strings.SetString( 309 localized_strings.SetString(
348 base::IntToString(IDS_IMPORT_FROM_SAFARI), 310 base::IntToString(IDS_IMPORT_FROM_SAFARI),
349 l10n_util::GetStringUTF8(IDS_IMPORT_FROM_SAFARI)); 311 l10n_util::GetStringUTF8(IDS_IMPORT_FROM_SAFARI));
350 localized_strings.SetString( 312 localized_strings.SetString(
351 base::IntToString(IDS_BOOKMARK_BAR_FOLDER_NAME), 313 base::IntToString(IDS_BOOKMARK_BAR_FOLDER_NAME),
352 l10n_util::GetStringUTF8(IDS_BOOKMARK_BAR_FOLDER_NAME)); 314 l10n_util::GetStringUTF8(IDS_BOOKMARK_BAR_FOLDER_NAME));
353 315
354 utility_process_host_->Send(new ProfileImportProcessMsg_StartImport( 316 profile_import_->StartImport(source_profile_, items_, localized_strings,
355 source_profile_, items_, localized_strings)); 317 std::move(observer_ptr));
gab 2016/11/07 20:07:32 #include <utility>
tibell 2016/11/07 23:34:23 Done.
356 } 318 }
319
320 void ExternalProcessImporterClient::CloseMojoHandles() {
gab 2016/11/07 20:07:32 DCHECK runs on proper sequence/thread?
tibell 2016/11/07 23:34:23 Fortunately Mojo itself checks this (which is conv
321 profile_import_.reset();
322 binding_.Close();
323 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698