Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/safe_browsing/incident_reporting/last_download_finder.h " | 5 #include "chrome/browser/safe_browsing/incident_reporting/last_download_finder.h " |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <functional> | 8 #include <functional> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 239 base::Bind(&LastDownloadFinder::OnDownloadQuery, | 239 base::Bind(&LastDownloadFinder::OnDownloadQuery, |
| 240 weak_ptr_factory_.GetWeakPtr(), | 240 weak_ptr_factory_.GetWeakPtr(), |
| 241 profile)); | 241 profile)); |
| 242 } else { | 242 } else { |
| 243 // else wait until history is loaded. | 243 // else wait until history is loaded. |
| 244 history_service_observer_.Add(history_service); | 244 history_service_observer_.Add(history_service); |
| 245 } | 245 } |
| 246 } | 246 } |
| 247 } | 247 } |
| 248 | 248 |
| 249 void LastDownloadFinder::OnProfileHistoryLoaded( | 249 void LastDownloadFinder::OnProfileHistoryLoaded( |
|
sdefresne
2014/12/11 12:43:08
This method is no longer called. Remove.
Paritosh Kumar
2014/12/11 13:13:56
Done.
| |
| 250 Profile* profile, | 250 Profile* profile, |
| 251 HistoryService* history_service) { | 251 HistoryService* history_service) { |
| 252 auto iter = profile_states_.find(profile); | 252 auto iter = profile_states_.find(profile); |
| 253 if (iter == profile_states_.end()) | 253 if (iter == profile_states_.end()) |
| 254 return; | 254 return; |
| 255 | 255 |
| 256 // Start the query in the history service if the finder was waiting for the | 256 // Start the query in the history service if the finder was waiting for the |
| 257 // service to load. | 257 // service to load. |
| 258 if (iter->second == WAITING_FOR_HISTORY) { | 258 if (iter->second == WAITING_FOR_HISTORY) { |
| 259 history_service->QueryDownloads( | 259 history_service->QueryDownloads( |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 332 case chrome::NOTIFICATION_PROFILE_DESTROYED: | 332 case chrome::NOTIFICATION_PROFILE_DESTROYED: |
| 333 AbandonSearchInProfile(content::Source<Profile>(source).ptr()); | 333 AbandonSearchInProfile(content::Source<Profile>(source).ptr()); |
| 334 break; | 334 break; |
| 335 default: | 335 default: |
| 336 break; | 336 break; |
| 337 } | 337 } |
| 338 } | 338 } |
| 339 | 339 |
| 340 void LastDownloadFinder::OnHistoryServiceLoaded( | 340 void LastDownloadFinder::OnHistoryServiceLoaded( |
| 341 HistoryService* history_service) { | 341 HistoryService* history_service) { |
| 342 OnProfileHistoryLoaded(history_service->profile(), history_service); | 342 for (const auto& pair : profile_states_) { |
| 343 HistoryService* hs = HistoryServiceFactory::GetForProfileIfExists( | |
| 344 pair.first, Profile::EXPLICIT_ACCESS); | |
| 345 if (hs == history_service) { | |
| 346 // Start the query in the history service if the finder was waiting for | |
| 347 // the service to load. | |
| 348 if (pair.second == WAITING_FOR_HISTORY) { | |
| 349 history_service->QueryDownloads( | |
| 350 base::Bind(&LastDownloadFinder::OnDownloadQuery, | |
| 351 weak_ptr_factory_.GetWeakPtr(), | |
| 352 pair.first)); | |
| 353 } | |
| 354 return; | |
| 355 } | |
| 356 } | |
| 343 } | 357 } |
| 344 | 358 |
| 345 void LastDownloadFinder::HistoryServiceBeingDeleted( | 359 void LastDownloadFinder::HistoryServiceBeingDeleted( |
| 346 HistoryService* history_service) { | 360 HistoryService* history_service) { |
| 347 history_service_observer_.Remove(history_service); | 361 history_service_observer_.Remove(history_service); |
| 348 } | 362 } |
| 349 | 363 |
| 350 } // namespace safe_browsing | 364 } // namespace safe_browsing |
| OLD | NEW |