OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_list.h" | 5 #include "chrome/browser/importer/importer_list.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "chrome/browser/first_run/first_run.h" | 8 #include "chrome/browser/first_run/first_run.h" |
9 #include "chrome/browser/importer/firefox_importer_utils.h" | 9 #include "chrome/browser/importer/firefox_importer_utils.h" |
10 #include "chrome/browser/importer/importer_bridge.h" | 10 #include "chrome/browser/importer/importer_bridge.h" |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 #endif | 199 #endif |
200 | 200 |
201 // TODO(jhawkins): Remove this condition once DetectSourceProfilesHack is | 201 // TODO(jhawkins): Remove this condition once DetectSourceProfilesHack is |
202 // removed. | 202 // removed. |
203 if (is_observed_) { | 203 if (is_observed_) { |
204 BrowserThread::PostTask( | 204 BrowserThread::PostTask( |
205 source_thread_id_, | 205 source_thread_id_, |
206 FROM_HERE, | 206 FROM_HERE, |
207 base::Bind(&ImporterList::SourceProfilesLoaded, this, profiles)); | 207 base::Bind(&ImporterList::SourceProfilesLoaded, this, profiles)); |
208 } else { | 208 } else { |
209 source_profiles_->assign(profiles.begin(), profiles.end()); | 209 source_profiles_.assign(profiles.begin(), profiles.end()); |
210 source_profiles_loaded_ = true; | 210 source_profiles_loaded_ = true; |
211 } | 211 } |
212 } | 212 } |
213 | 213 |
214 void ImporterList::SourceProfilesLoaded( | 214 void ImporterList::SourceProfilesLoaded( |
215 const std::vector<importer::SourceProfile*>& profiles) { | 215 const std::vector<importer::SourceProfile*>& profiles) { |
216 // |observer_| may be NULL if it removed itself before being notified. | 216 // |observer_| may be NULL if it removed itself before being notified. |
217 if (!observer_) | 217 if (!observer_) |
218 return; | 218 return; |
219 | 219 |
220 BrowserThread::ID current_thread_id; | 220 BrowserThread::ID current_thread_id; |
221 BrowserThread::GetCurrentThreadIdentifier(¤t_thread_id); | 221 BrowserThread::GetCurrentThreadIdentifier(¤t_thread_id); |
222 DCHECK_EQ(current_thread_id, source_thread_id_); | 222 DCHECK_EQ(current_thread_id, source_thread_id_); |
223 | 223 |
224 source_profiles_->assign(profiles.begin(), profiles.end()); | 224 source_profiles_.assign(profiles.begin(), profiles.end()); |
225 source_profiles_loaded_ = true; | 225 source_profiles_loaded_ = true; |
226 source_thread_id_ = BrowserThread::UI; | 226 source_thread_id_ = BrowserThread::UI; |
227 | 227 |
228 observer_->OnSourceProfilesLoaded(); | 228 observer_->OnSourceProfilesLoaded(); |
229 observer_ = NULL; | 229 observer_ = NULL; |
230 | 230 |
231 // TODO(jhawkins): Remove once DetectSourceProfilesHack is removed. | 231 // TODO(jhawkins): Remove once DetectSourceProfilesHack is removed. |
232 is_observed_ = false; | 232 is_observed_ = false; |
233 } | 233 } |
OLD | NEW |