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

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

Issue 2781263002: Some C++11 cleanup of history types. (Closed)
Patch Set: Fix Android Created 3 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/url_database.h" 5 #include "components/history/core/browser/url_database.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 replacements.ClearUsername(); 55 replacements.ClearUsername();
56 replacements.ClearPassword(); 56 replacements.ClearPassword();
57 57
58 return (gurl.ReplaceComponents(replacements)).spec(); 58 return (gurl.ReplaceComponents(replacements)).spec();
59 } 59 }
60 60
61 // Convenience to fill a URLRow. Must be in sync with the fields in 61 // Convenience to fill a URLRow. Must be in sync with the fields in
62 // kURLRowFields. 62 // kURLRowFields.
63 void URLDatabase::FillURLRow(sql::Statement& s, URLRow* i) { 63 void URLDatabase::FillURLRow(sql::Statement& s, URLRow* i) {
64 DCHECK(i); 64 DCHECK(i);
65 i->id_ = s.ColumnInt64(0); 65 i->set_id(s.ColumnInt64(0));
66 i->url_ = GURL(s.ColumnString(1)); 66 i->set_url(GURL(s.ColumnString(1)));
67 i->title_ = s.ColumnString16(2); 67 i->set_title(s.ColumnString16(2));
68 i->visit_count_ = s.ColumnInt(3); 68 i->set_visit_count(s.ColumnInt(3));
69 i->typed_count_ = s.ColumnInt(4); 69 i->set_typed_count(s.ColumnInt(4));
70 i->last_visit_ = base::Time::FromInternalValue(s.ColumnInt64(5)); 70 i->set_last_visit(base::Time::FromInternalValue(s.ColumnInt64(5)));
71 i->hidden_ = s.ColumnInt(6) != 0; 71 i->set_hidden(s.ColumnInt(6) != 0);
72 } 72 }
73 73
74 bool URLDatabase::GetURLRow(URLID url_id, URLRow* info) { 74 bool URLDatabase::GetURLRow(URLID url_id, URLRow* info) {
75 // TODO(brettw) We need check for empty URLs to handle the case where 75 // TODO(brettw) We need check for empty URLs to handle the case where
76 // there are old URLs in the database that are empty that got in before 76 // there are old URLs in the database that are empty that got in before
77 // we added any checks. We should eventually be able to remove it 77 // we added any checks. We should eventually be able to remove it
78 // when all inputs are using GURL (which prohibit empty input). 78 // when all inputs are using GURL (which prohibit empty input).
79 sql::Statement statement(GetDB().GetCachedStatement(SQL_FROM_HERE, 79 sql::Statement statement(GetDB().GetCachedStatement(SQL_FROM_HERE,
80 "SELECT" HISTORY_URL_ROW_FIELDS "FROM urls WHERE id=?")); 80 "SELECT" HISTORY_URL_ROW_FIELDS "FROM urls WHERE id=?"));
81 statement.BindInt64(0, url_id); 81 statement.BindInt64(0, url_id);
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 bool RowQualifiesAsSignificant(const URLRow& row, 640 bool RowQualifiesAsSignificant(const URLRow& row,
641 const base::Time& threshold) { 641 const base::Time& threshold) {
642 const base::Time& real_threshold = 642 const base::Time& real_threshold =
643 threshold.is_null() ? AutocompleteAgeThreshold() : threshold; 643 threshold.is_null() ? AutocompleteAgeThreshold() : threshold;
644 return (row.typed_count() >= kLowQualityMatchTypedLimit) || 644 return (row.typed_count() >= kLowQualityMatchTypedLimit) ||
645 (row.visit_count() >= kLowQualityMatchVisitLimit) || 645 (row.visit_count() >= kLowQualityMatchVisitLimit) ||
646 (row.last_visit() >= real_threshold); 646 (row.last_visit() >= real_threshold);
647 } 647 }
648 648
649 } // namespace history 649 } // namespace history
OLDNEW
« no previous file with comments | « components/history/core/browser/history_types.cc ('k') | components/history/core/browser/url_row.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698