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

Side by Side Diff: chrome/browser/history/url_database.cc

Issue 12033021: Add UMA metrics and histograms for locally managed users. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/history/url_database.h ('k') | chrome/browser/managed_mode/managed_mode.h » ('j') | 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 "chrome/browser/history/url_database.h" 5 #include "chrome/browser/history/url_database.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 "SELECT" HISTORY_URL_ROW_FIELDS "FROM urls WHERE typed_count > 0")); 104 "SELECT" HISTORY_URL_ROW_FIELDS "FROM urls WHERE typed_count > 0"));
105 105
106 while (statement.Step()) { 106 while (statement.Step()) {
107 URLRow info; 107 URLRow info;
108 FillURLRow(statement, &info); 108 FillURLRow(statement, &info);
109 urls->push_back(info); 109 urls->push_back(info);
110 } 110 }
111 return true; 111 return true;
112 } 112 }
113 113
114 bool URLDatabase::GetUniqueURLsInRange(base::Time begin_time,
115 base::Time end_time,
116 int max_results,
117 URLRows* urls) {
118 sql::Statement statement(GetDB().GetCachedStatement(SQL_FROM_HERE,
119 "SELECT DISTINCT" HISTORY_URL_ROW_FIELDS "FROM urls "
120 "WHERE last_visit_time > ? AND last_visit_time < ? "
121 "ORDER BY last_visit_time LIMIT ?"));
122
123 // See VisitDatabase::GetVisibleVisitsInRange for more info on how these
124 // times are bound.
125 int64 end = end_time.ToInternalValue();
126 statement.BindInt64(0, begin_time.ToInternalValue());
127 statement.BindInt64(1, end ? end : std::numeric_limits<int64>::max());
128 statement.BindInt64(2,
129 max_results ? max_results : std::numeric_limits<int64>::max());
130
131 while (statement.Step()) {
132 URLRow info;
133 FillURLRow(statement, &info);
134 urls->push_back(info);
135 }
136 return true;
137 }
138
114 URLID URLDatabase::GetRowForURL(const GURL& url, history::URLRow* info) { 139 URLID URLDatabase::GetRowForURL(const GURL& url, history::URLRow* info) {
115 sql::Statement statement(GetDB().GetCachedStatement(SQL_FROM_HERE, 140 sql::Statement statement(GetDB().GetCachedStatement(SQL_FROM_HERE,
116 "SELECT" HISTORY_URL_ROW_FIELDS "FROM urls WHERE url=?")); 141 "SELECT" HISTORY_URL_ROW_FIELDS "FROM urls WHERE url=?"));
117 std::string url_string = GURLToDatabaseURL(url); 142 std::string url_string = GURLToDatabaseURL(url);
118 statement.BindString(0, url_string); 143 statement.BindString(0, url_string);
119 144
120 if (!statement.Step()) 145 if (!statement.Step())
121 return 0; // no data 146 return 0; // no data
122 147
123 if (info) 148 if (info)
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 return GetDB().Execute(sql.c_str()); 594 return GetDB().Execute(sql.c_str());
570 } 595 }
571 596
572 bool URLDatabase::CreateMainURLIndex() { 597 bool URLDatabase::CreateMainURLIndex() {
573 // Index over URLs so we can quickly look up based on URL. 598 // Index over URLs so we can quickly look up based on URL.
574 return GetDB().Execute( 599 return GetDB().Execute(
575 "CREATE INDEX IF NOT EXISTS urls_url_index ON urls (url)"); 600 "CREATE INDEX IF NOT EXISTS urls_url_index ON urls (url)");
576 } 601 }
577 602
578 } // namespace history 603 } // namespace history
OLDNEW
« no previous file with comments | « chrome/browser/history/url_database.h ('k') | chrome/browser/managed_mode/managed_mode.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698