Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(354)

Side by Side Diff: components/history/core/browser/visit_database.cc

Issue 1081923002: Remove PrerenderLocalPredictor, part 5. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@prerender-local-predictor-4
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/history/core/browser/visit_database.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "components/history/core/browser/visit_database.h" 5 #include "components/history/core/browser/visit_database.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 if (!GetDB().DoesColumnExist("visits", "visit_duration")) { 592 if (!GetDB().DoesColumnExist("visits", "visit_duration")) {
593 // Old versions don't have the visit_duration column, we modify the table 593 // Old versions don't have the visit_duration column, we modify the table
594 // to add that field. 594 // to add that field.
595 if (!GetDB().Execute("ALTER TABLE visits " 595 if (!GetDB().Execute("ALTER TABLE visits "
596 "ADD COLUMN visit_duration INTEGER DEFAULT 0 NOT NULL")) 596 "ADD COLUMN visit_duration INTEGER DEFAULT 0 NOT NULL"))
597 return false; 597 return false;
598 } 598 }
599 return true; 599 return true;
600 } 600 }
601 601
602 void VisitDatabase::GetBriefVisitInfoOfMostRecentVisits(
603 int max_visits,
604 std::vector<BriefVisitInfo>* result_vector) {
605 result_vector->clear();
606
607 sql::Statement statement(GetDB().GetUniqueStatement(
608 "SELECT url,visit_time,transition FROM visits "
609 "ORDER BY id DESC LIMIT ?"));
610
611 statement.BindInt64(0, max_visits);
612
613 if (!statement.is_valid())
614 return;
615
616 while (statement.Step()) {
617 BriefVisitInfo info;
618 info.url_id = statement.ColumnInt64(0);
619 info.time = base::Time::FromInternalValue(statement.ColumnInt64(1));
620 info.transition = ui::PageTransitionFromInt(statement.ColumnInt(2));
621 result_vector->push_back(info);
622 }
623 }
624
625 } // namespace history 602 } // namespace history
OLDNEW
« no previous file with comments | « components/history/core/browser/visit_database.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698