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/browser/importer/importer.h" | 5 #include "chrome/browser/importer/importer.h" |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "base/thread.h" | 8 #include "base/thread.h" |
9 #include "chrome/browser/bookmarks/bookmark_model.h" | 9 #include "chrome/browser/bookmarks/bookmark_model.h" |
10 #include "chrome/browser/browser_list.h" | 10 #include "chrome/browser/browser_list.h" |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 Profile* target_profile, | 333 Profile* target_profile, |
334 uint16 items, | 334 uint16 items, |
335 ProfileWriter* writer, | 335 ProfileWriter* writer, |
336 bool first_run) { | 336 bool first_run) { |
337 DCHECK(!profile_); | 337 DCHECK(!profile_); |
338 profile_ = target_profile; | 338 profile_ = target_profile; |
339 writer_ = writer; | 339 writer_ = writer; |
340 profile_info_ = &profile_info; | 340 profile_info_ = &profile_info; |
341 items_ = items; | 341 items_ = items; |
342 | 342 |
| 343 ImporterHost::AddRef(); // Balanced in ImporterHost::ImportEnded. |
| 344 |
343 import_to_bookmark_bar_ = ShouldImportToBookmarkBar(first_run); | 345 import_to_bookmark_bar_ = ShouldImportToBookmarkBar(first_run); |
344 CheckForFirefoxLock(profile_info, items, first_run); | 346 CheckForFirefoxLock(profile_info, items, first_run); |
345 CheckForLoadedModels(items); | 347 CheckForLoadedModels(items); |
346 | 348 |
347 ImporterHost::AddRef(); // Balanced in ImporterHost::ImportEnded. | |
348 InvokeTaskIfDone(); | 349 InvokeTaskIfDone(); |
349 } | 350 } |
350 | 351 |
351 void ExternalProcessImporterHost::InvokeTaskIfDone() { | 352 void ExternalProcessImporterHost::InvokeTaskIfDone() { |
352 if (waiting_for_bookmarkbar_model_ || !registrar_.IsEmpty() || | 353 if (waiting_for_bookmarkbar_model_ || !registrar_.IsEmpty() || |
353 !is_source_readable_ || cancelled_) | 354 !is_source_readable_ || cancelled_) |
354 return; | 355 return; |
355 | 356 |
356 // The in-process half of the bridge which catches data from the IPC pipe | 357 // The in-process half of the bridge which catches data from the IPC pipe |
357 // and feeds it to the ProfileWriter. The external process half of the | 358 // and feeds it to the ProfileWriter. The external process half of the |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
577 std::vector<TemplateURL>::const_iterator iter; | 578 std::vector<TemplateURL>::const_iterator iter; |
578 for (iter = template_urls.begin(); | 579 for (iter = template_urls.begin(); |
579 iter != template_urls.end(); | 580 iter != template_urls.end(); |
580 ++iter) { | 581 ++iter) { |
581 template_url_vec.push_back(new TemplateURL(*iter)); | 582 template_url_vec.push_back(new TemplateURL(*iter)); |
582 } | 583 } |
583 bridge_->SetKeywords(template_url_vec, default_keyword_index, | 584 bridge_->SetKeywords(template_url_vec, default_keyword_index, |
584 unique_on_host_and_path); | 585 unique_on_host_and_path); |
585 } | 586 } |
586 | 587 |
OLD | NEW |