OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/history/history_utils.h" |
| 6 |
| 7 #include "base/callback.h" |
| 8 #include "base/logging.h" |
| 9 #include "base/task/cancelable_task_tracker.h" |
| 10 #include "base/time/time.h" |
| 11 #include "chrome/browser/history/delete_directive_handler.h" |
| 12 #include "chrome/browser/history/history_service.h" |
| 13 #include "chrome/browser/history/web_history_service.h" |
| 14 |
| 15 namespace history { |
| 16 namespace { |
| 17 |
| 18 // Callback for WebHistoryService::ExpireWebHistory(). |
| 19 void ExpireWebHistoryComplete(bool success) { |
| 20 // Ignore the result. |
| 21 // |
| 22 // TODO(davidben): ExpireLocalAndRemoteHistoryBetween callback should not fire |
| 23 // until this completes. |
| 24 } |
| 25 |
| 26 } // namespace |
| 27 |
| 28 void ExpireLocalAndRemoteHistoryBetween(HistoryService* local_history, |
| 29 WebHistoryService* web_history, |
| 30 const std::set<GURL>& restrict_urls, |
| 31 base::Time begin_time, |
| 32 base::Time end_time, |
| 33 const base::Closure& callback, |
| 34 base::CancelableTaskTracker* tracker) { |
| 35 DCHECK(local_history); |
| 36 |
| 37 // TODO(dubroy): This should be factored out into a separate class that |
| 38 // dispatches deletions to the proper places. |
| 39 |
| 40 if (web_history) { |
| 41 // TODO(dubroy): This API does not yet support deletion of specific URLs. |
| 42 DCHECK(restrict_urls.empty()); |
| 43 |
| 44 local_history->delete_directive_handler_.CreateDeleteDirectives( |
| 45 std::set<int64>(), begin_time, end_time); |
| 46 |
| 47 // Attempt online deletion from the history server, but ignore the result. |
| 48 // Deletion directives ensure that the results will eventually be deleted. |
| 49 // |
| 50 // TODO(davidben): |callback| should not run until this operation completes |
| 51 // too. |
| 52 web_history->ExpireHistoryBetween(restrict_urls, begin_time, end_time, |
| 53 base::Bind(&ExpireWebHistoryComplete)); |
| 54 } |
| 55 |
| 56 local_history->ExpireHistoryBetween(restrict_urls, begin_time, end_time, |
| 57 callback, tracker); |
| 58 } |
| 59 |
| 60 } // namespace history |
OLD | NEW |