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_host.h" | 5 #include "chrome/browser/importer/external_process_importer_host.h" |
6 | 6 |
7 #include "chrome/browser/bookmarks/bookmark_model.h" | 7 #include "chrome/browser/bookmarks/bookmark_model.h" |
8 #include "chrome/browser/importer/external_process_importer_client.h" | 8 #include "chrome/browser/importer/external_process_importer_client.h" |
9 #include "chrome/browser/importer/importer_type.h" | 9 #include "chrome/browser/importer/importer_type.h" |
10 #include "chrome/browser/importer/in_process_importer_bridge.h" | 10 #include "chrome/browser/importer/in_process_importer_bridge.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 client_->Cancel(); | 23 client_->Cancel(); |
24 NotifyImportEnded(); // Tells the observer that we're done, and releases us. | 24 NotifyImportEnded(); // Tells the observer that we're done, and releases us. |
25 } | 25 } |
26 | 26 |
27 ExternalProcessImporterHost::~ExternalProcessImporterHost() {} | 27 ExternalProcessImporterHost::~ExternalProcessImporterHost() {} |
28 | 28 |
29 void ExternalProcessImporterHost::StartImportSettings( | 29 void ExternalProcessImporterHost::StartImportSettings( |
30 const importer::SourceProfile& source_profile, | 30 const importer::SourceProfile& source_profile, |
31 Profile* target_profile, | 31 Profile* target_profile, |
32 uint16 items, | 32 uint16 items, |
33 ProfileWriter* writer, | 33 ProfileWriter* writer) { |
34 bool first_run) { | |
35 // We really only support importing from one host at a time. | 34 // We really only support importing from one host at a time. |
36 DCHECK(!profile_); | 35 DCHECK(!profile_); |
37 DCHECK(target_profile); | 36 DCHECK(target_profile); |
38 | 37 |
39 profile_ = target_profile; | 38 profile_ = target_profile; |
40 writer_ = writer; | 39 writer_ = writer; |
41 source_profile_ = &source_profile; | 40 source_profile_ = &source_profile; |
42 items_ = items; | 41 items_ = items; |
43 | 42 |
44 ImporterHost::AddRef(); // Balanced in ImporterHost::NotifyImportEnded. | 43 ImporterHost::AddRef(); // Balanced in ImporterHost::NotifyImportEnded. |
45 | 44 |
46 CheckForFirefoxLock(source_profile, items, first_run); | 45 CheckForFirefoxLock(source_profile, items); |
47 CheckForLoadedModels(items); | 46 CheckForLoadedModels(items); |
48 | 47 |
49 InvokeTaskIfDone(); | 48 InvokeTaskIfDone(); |
50 } | 49 } |
51 | 50 |
52 void ExternalProcessImporterHost::InvokeTaskIfDone() { | 51 void ExternalProcessImporterHost::InvokeTaskIfDone() { |
53 if (waiting_for_bookmarkbar_model_ || !registrar_.IsEmpty() || | 52 if (waiting_for_bookmarkbar_model_ || !registrar_.IsEmpty() || |
54 !is_source_readable_ || cancelled_) | 53 !is_source_readable_ || cancelled_) |
55 return; | 54 return; |
56 | 55 |
(...skipping 12 matching lines...) Expand all Loading... |
69 | 68 |
70 void ExternalProcessImporterHost::Loaded(BookmarkModel* model, | 69 void ExternalProcessImporterHost::Loaded(BookmarkModel* model, |
71 bool ids_reassigned) { | 70 bool ids_reassigned) { |
72 DCHECK(model->IsLoaded()); | 71 DCHECK(model->IsLoaded()); |
73 model->RemoveObserver(this); | 72 model->RemoveObserver(this); |
74 waiting_for_bookmarkbar_model_ = false; | 73 waiting_for_bookmarkbar_model_ = false; |
75 installed_bookmark_observer_ = false; | 74 installed_bookmark_observer_ = false; |
76 | 75 |
77 InvokeTaskIfDone(); | 76 InvokeTaskIfDone(); |
78 } | 77 } |
OLD | NEW |