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/download/download_history.h" | 5 #include "chrome/browser/download/download_history.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "chrome/browser/history/download_history_info.h" | 8 #include "chrome/browser/history/download_history_info.h" |
9 #include "chrome/browser/history/history_marshaling.h" | 9 #include "chrome/browser/history/history_marshaling.h" |
10 #include "chrome/browser/download/download_item.h" | 10 #include "chrome/browser/download/download_item.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 | 41 |
42 void DownloadHistory::CheckVisitedReferrerBefore( | 42 void DownloadHistory::CheckVisitedReferrerBefore( |
43 int32 download_id, | 43 int32 download_id, |
44 const GURL& referrer_url, | 44 const GURL& referrer_url, |
45 VisitedBeforeDoneCallback* callback) { | 45 VisitedBeforeDoneCallback* callback) { |
46 DCHECK(callback); | 46 DCHECK(callback); |
47 | 47 |
48 if (referrer_url.is_valid()) { | 48 if (referrer_url.is_valid()) { |
49 HistoryService* hs = profile_->GetHistoryService(Profile::EXPLICIT_ACCESS); | 49 HistoryService* hs = profile_->GetHistoryService(Profile::EXPLICIT_ACCESS); |
50 if (hs) { | 50 if (hs) { |
51 HistoryService::Handle handle = hs->GetVisitCountToHost(referrer_url, | 51 HistoryService::Handle handle = |
52 &history_consumer_, | 52 hs->GetVisibleVisitCountToHost(referrer_url, &history_consumer_, |
53 NewCallback(this, &DownloadHistory::OnGotVisitCountToHost)); | 53 NewCallback(this, &DownloadHistory::OnGotVisitCountToHost)); |
54 visited_before_requests_[handle] = std::make_pair(download_id, callback); | 54 visited_before_requests_[handle] = std::make_pair(download_id, callback); |
55 return; | 55 return; |
56 } | 56 } |
57 } | 57 } |
58 callback->Run(download_id, false); | 58 callback->Run(download_id, false); |
59 } | 59 } |
60 | 60 |
61 void DownloadHistory::AddEntry( | 61 void DownloadHistory::AddEntry( |
62 DownloadItem* download_item, | 62 DownloadItem* download_item, |
63 HistoryService::DownloadCreateCallback* callback) { | 63 HistoryService::DownloadCreateCallback* callback) { |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 base::Time first_visit) { | 139 base::Time first_visit) { |
140 VisitedBeforeRequestsMap::iterator request = | 140 VisitedBeforeRequestsMap::iterator request = |
141 visited_before_requests_.find(handle); | 141 visited_before_requests_.find(handle); |
142 DCHECK(request != visited_before_requests_.end()); | 142 DCHECK(request != visited_before_requests_.end()); |
143 int32 download_id = request->second.first; | 143 int32 download_id = request->second.first; |
144 VisitedBeforeDoneCallback* callback = request->second.second; | 144 VisitedBeforeDoneCallback* callback = request->second.second; |
145 visited_before_requests_.erase(request); | 145 visited_before_requests_.erase(request); |
146 callback->Run(download_id, found_visits && count && | 146 callback->Run(download_id, found_visits && count && |
147 (first_visit.LocalMidnight() < base::Time::Now().LocalMidnight())); | 147 (first_visit.LocalMidnight() < base::Time::Now().LocalMidnight())); |
148 } | 148 } |
OLD | NEW |