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/history/history_backend.h" | 5 #include "chrome/browser/history/history_backend.h" |
6 | 6 |
7 #include <list> | 7 #include <list> |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <vector> | 10 #include <vector> |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 return; | 369 return; |
370 | 370 |
371 // Will be filled with the URL ID and the visit ID of the last addition. | 371 // Will be filled with the URL ID and the visit ID of the last addition. |
372 std::pair<URLID, VisitID> last_ids(0, tracker_.GetLastVisit( | 372 std::pair<URLID, VisitID> last_ids(0, tracker_.GetLastVisit( |
373 request->id_scope, request->page_id, request->referrer)); | 373 request->id_scope, request->page_id, request->referrer)); |
374 | 374 |
375 VisitID from_visit_id = last_ids.second; | 375 VisitID from_visit_id = last_ids.second; |
376 | 376 |
377 // If a redirect chain is given, we expect the last item in that chain to be | 377 // If a redirect chain is given, we expect the last item in that chain to be |
378 // the final URL. | 378 // the final URL. |
379 DCHECK(request->redirects.size() == 0 || | 379 DCHECK(request->redirects.empty() || |
380 request->redirects.back() == request->url); | 380 request->redirects.back() == request->url); |
381 | 381 |
382 // Avoid duplicating times in the database, at least as long as pages are | 382 // Avoid duplicating times in the database, at least as long as pages are |
383 // added in order. However, we don't want to disallow pages from recording | 383 // added in order. However, we don't want to disallow pages from recording |
384 // times earlier than our last_recorded_time_, because someone might set | 384 // times earlier than our last_recorded_time_, because someone might set |
385 // their machine's clock back. | 385 // their machine's clock back. |
386 if (last_requested_time_ == request->time) { | 386 if (last_requested_time_ == request->time) { |
387 last_recorded_time_ = last_recorded_time_ + TimeDelta::FromMicroseconds(1); | 387 last_recorded_time_ = last_recorded_time_ + TimeDelta::FromMicroseconds(1); |
388 } else { | 388 } else { |
389 last_requested_time_ = request->time; | 389 last_requested_time_ = request->time; |
(...skipping 1805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2195 return true; | 2195 return true; |
2196 } | 2196 } |
2197 | 2197 |
2198 BookmarkService* HistoryBackend::GetBookmarkService() { | 2198 BookmarkService* HistoryBackend::GetBookmarkService() { |
2199 if (bookmark_service_) | 2199 if (bookmark_service_) |
2200 bookmark_service_->BlockTillLoaded(); | 2200 bookmark_service_->BlockTillLoaded(); |
2201 return bookmark_service_; | 2201 return bookmark_service_; |
2202 } | 2202 } |
2203 | 2203 |
2204 } // namespace history | 2204 } // namespace history |
OLD | NEW |