| 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/history/expire_history_backend.h" | 5 #include "chrome/browser/history/expire_history_backend.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <functional> | 8 #include <functional> |
| 9 #include <limits> | 9 #include <limits> |
| 10 | 10 |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 } | 314 } |
| 315 } | 315 } |
| 316 | 316 |
| 317 void ExpireHistoryBackend::BroadcastNotifications(DeleteEffects* effects, | 317 void ExpireHistoryBackend::BroadcastNotifications(DeleteEffects* effects, |
| 318 DeletionType type) { | 318 DeletionType type) { |
| 319 if (!effects->modified_urls.empty()) { | 319 if (!effects->modified_urls.empty()) { |
| 320 scoped_ptr<URLsModifiedDetails> details(new URLsModifiedDetails); | 320 scoped_ptr<URLsModifiedDetails> details(new URLsModifiedDetails); |
| 321 details->changed_urls = effects->modified_urls; | 321 details->changed_urls = effects->modified_urls; |
| 322 delegate_->NotifySyncURLsModified(&details->changed_urls); | 322 delegate_->NotifySyncURLsModified(&details->changed_urls); |
| 323 delegate_->BroadcastNotifications( | 323 delegate_->BroadcastNotifications( |
| 324 chrome::NOTIFICATION_HISTORY_URLS_MODIFIED, | 324 chrome::NOTIFICATION_HISTORY_URLS_MODIFIED, details.Pass()); |
| 325 details.PassAs<HistoryDetails>()); | |
| 326 } | 325 } |
| 327 if (!effects->deleted_urls.empty()) { | 326 if (!effects->deleted_urls.empty()) { |
| 328 scoped_ptr<URLsDeletedDetails> details(new URLsDeletedDetails); | 327 scoped_ptr<URLsDeletedDetails> details(new URLsDeletedDetails); |
| 329 details->all_history = false; | 328 details->all_history = false; |
| 330 details->expired = (type == DELETION_EXPIRED); | 329 details->expired = (type == DELETION_EXPIRED); |
| 331 details->rows = effects->deleted_urls; | 330 details->rows = effects->deleted_urls; |
| 332 details->favicon_urls = effects->deleted_favicons; | 331 details->favicon_urls = effects->deleted_favicons; |
| 333 delegate_->NotifySyncURLsDeleted(details->all_history, details->expired, | 332 delegate_->NotifySyncURLsDeleted(details->all_history, details->expired, |
| 334 &details->rows); | 333 &details->rows); |
| 335 delegate_->BroadcastNotifications(chrome::NOTIFICATION_HISTORY_URLS_DELETED, | 334 delegate_->BroadcastNotifications(chrome::NOTIFICATION_HISTORY_URLS_DELETED, |
| 336 details.PassAs<HistoryDetails>()); | 335 details.Pass()); |
| 337 } | 336 } |
| 338 } | 337 } |
| 339 | 338 |
| 340 void ExpireHistoryBackend::DeleteVisitRelatedInfo(const VisitVector& visits, | 339 void ExpireHistoryBackend::DeleteVisitRelatedInfo(const VisitVector& visits, |
| 341 DeleteEffects* effects) { | 340 DeleteEffects* effects) { |
| 342 for (size_t i = 0; i < visits.size(); i++) { | 341 for (size_t i = 0; i < visits.size(); i++) { |
| 343 // Delete the visit itself. | 342 // Delete the visit itself. |
| 344 main_db_->DeleteVisit(visits[i]); | 343 main_db_->DeleteVisit(visits[i]); |
| 345 | 344 |
| 346 // Add the URL row to the affected URL list. | 345 // Add the URL row to the affected URL list. |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 516 HistoryClient* ExpireHistoryBackend::GetHistoryClient() { | 515 HistoryClient* ExpireHistoryBackend::GetHistoryClient() { |
| 517 // We use the history client to determine if a URL is bookmarked. The data is | 516 // We use the history client to determine if a URL is bookmarked. The data is |
| 518 // loaded on a separate thread and may not be done by the time we get here. | 517 // loaded on a separate thread and may not be done by the time we get here. |
| 519 // We therefore block until the bookmarks have finished loading. | 518 // We therefore block until the bookmarks have finished loading. |
| 520 if (history_client_) | 519 if (history_client_) |
| 521 history_client_->BlockUntilBookmarksLoaded(); | 520 history_client_->BlockUntilBookmarksLoaded(); |
| 522 return history_client_; | 521 return history_client_; |
| 523 } | 522 } |
| 524 | 523 |
| 525 } // namespace history | 524 } // namespace history |
| OLD | NEW |