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

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

Issue 254763005: Move some content url constants to /url. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Initial patches. Created 6 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 (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/visit_database.h" 5 #include "chrome/browser/history/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>
11 11
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/strings/string_number_conversions.h" 13 #include "base/strings/string_number_conversions.h"
14 #include "chrome/browser/history/url_database.h" 14 #include "chrome/browser/history/url_database.h"
15 #include "chrome/browser/history/visit_filter.h" 15 #include "chrome/browser/history/visit_filter.h"
16 #include "chrome/common/url_constants.h" 16 #include "chrome/common/url_constants.h"
17 #include "content/public/common/page_transition_types.h" 17 #include "content/public/common/page_transition_types.h"
18 #include "net/base/url_constants.h"
18 #include "sql/statement.h" 19 #include "sql/statement.h"
19 20
20 namespace history { 21 namespace history {
21 22
22 VisitDatabase::VisitDatabase() { 23 VisitDatabase::VisitDatabase() {
23 } 24 }
24 25
25 VisitDatabase::~VisitDatabase() { 26 VisitDatabase::~VisitDatabase() {
26 } 27 }
27 28
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 return false; 484 return false;
484 485
485 *from_url = GURL(statement.ColumnString(0)); 486 *from_url = GURL(statement.ColumnString(0));
486 } 487 }
487 return true; 488 return true;
488 } 489 }
489 490
490 bool VisitDatabase::GetVisibleVisitCountToHost(const GURL& url, 491 bool VisitDatabase::GetVisibleVisitCountToHost(const GURL& url,
491 int* count, 492 int* count,
492 base::Time* first_visit) { 493 base::Time* first_visit) {
493 if (!url.SchemeIs(content::kHttpScheme) && 494 if (!url.SchemeIs(net::kHttpScheme) && !url.SchemeIs(net::kHttpsScheme))
494 !url.SchemeIs(content::kHttpsScheme))
495 return false; 495 return false;
496 496
497 // We need to search for URLs with a matching host/port. One way to query for 497 // We need to search for URLs with a matching host/port. One way to query for
498 // this is to use the LIKE operator, eg 'url LIKE http://google.com/%'. This 498 // this is to use the LIKE operator, eg 'url LIKE http://google.com/%'. This
499 // is inefficient though in that it doesn't use the index and each entry must 499 // is inefficient though in that it doesn't use the index and each entry must
500 // be visited. The same query can be executed by using >= and < operator. 500 // be visited. The same query can be executed by using >= and < operator.
501 // The query becomes: 501 // The query becomes:
502 // 'url >= http://google.com/' and url < http://google.com0'. 502 // 'url >= http://google.com/' and url < http://google.com0'.
503 // 0 is used as it is one character greater than '/'. 503 // 0 is used as it is one character greater than '/'.
504 const std::string host_query_min = url.GetOrigin().spec(); 504 const std::string host_query_min = url.GetOrigin().spec();
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
616 while (statement.Step()) { 616 while (statement.Step()) {
617 BriefVisitInfo info; 617 BriefVisitInfo info;
618 info.url_id = statement.ColumnInt64(0); 618 info.url_id = statement.ColumnInt64(0);
619 info.time = base::Time::FromInternalValue(statement.ColumnInt64(1)); 619 info.time = base::Time::FromInternalValue(statement.ColumnInt64(1));
620 info.transition = content::PageTransitionFromInt(statement.ColumnInt(2)); 620 info.transition = content::PageTransitionFromInt(statement.ColumnInt(2));
621 result_vector->push_back(info); 621 result_vector->push_back(info);
622 } 622 }
623 } 623 }
624 624
625 } // namespace history 625 } // namespace history
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698