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

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

Issue 254763005: Move some content url constants to /url. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update url/BUILD.gn and address some style nits. Created 6 years, 7 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/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>
11 11
12 #include "base/i18n/case_conversion.h" 12 #include "base/i18n/case_conversion.h"
13 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
14 #include "chrome/common/url_constants.h" 14 #include "chrome/common/url_constants.h"
15 #include "net/base/net_util.h" 15 #include "net/base/net_util.h"
16 #include "sql/statement.h" 16 #include "sql/statement.h"
17 #include "ui/base/l10n/l10n_util.h" 17 #include "ui/base/l10n/l10n_util.h"
18 #include "url/gurl.h" 18 #include "url/gurl.h"
19 #include "url/url_constants.h"
19 20
20 namespace history { 21 namespace history {
21 22
22 const char URLDatabase::kURLRowFields[] = HISTORY_URL_ROW_FIELDS; 23 const char URLDatabase::kURLRowFields[] = HISTORY_URL_ROW_FIELDS;
23 const int URLDatabase::kNumURLRowFields = 9; 24 const int URLDatabase::kNumURLRowFields = 9;
24 25
25 URLDatabase::URLEnumeratorBase::URLEnumeratorBase() 26 URLDatabase::URLEnumeratorBase::URLEnumeratorBase()
26 : initialized_(false) { 27 : initialized_(false) {
27 } 28 }
28 29
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 history::URLRow info; 307 history::URLRow info;
307 FillURLRow(statement, &info); 308 FillURLRow(statement, &info);
308 if (info.url().is_valid()) 309 if (info.url().is_valid())
309 results->push_back(info); 310 results->push_back(info);
310 } 311 }
311 return !results->empty(); 312 return !results->empty();
312 } 313 }
313 314
314 bool URLDatabase::IsTypedHost(const std::string& host) { 315 bool URLDatabase::IsTypedHost(const std::string& host) {
315 const char* schemes[] = { 316 const char* schemes[] = {
316 content::kHttpScheme, 317 url::kHttpScheme,
317 content::kHttpsScheme, 318 url::kHttpsScheme,
318 content::kFtpScheme 319 content::kFtpScheme
319 }; 320 };
320 URLRows dummy; 321 URLRows dummy;
321 for (size_t i = 0; i < arraysize(schemes); ++i) { 322 for (size_t i = 0; i < arraysize(schemes); ++i) {
322 std::string scheme_and_host(schemes[i]); 323 std::string scheme_and_host(schemes[i]);
323 scheme_and_host += content::kStandardSchemeSeparator + host; 324 scheme_and_host += content::kStandardSchemeSeparator + host;
324 if (AutocompleteForPrefix(scheme_and_host + '/', 1, true, &dummy) || 325 if (AutocompleteForPrefix(scheme_and_host + '/', 1, true, &dummy) ||
325 AutocompleteForPrefix(scheme_and_host + ':', 1, true, &dummy)) 326 AutocompleteForPrefix(scheme_and_host + ':', 1, true, &dummy))
326 return true; 327 return true;
327 } 328 }
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
616 return GetDB().Execute(sql.c_str()); 617 return GetDB().Execute(sql.c_str());
617 } 618 }
618 619
619 bool URLDatabase::CreateMainURLIndex() { 620 bool URLDatabase::CreateMainURLIndex() {
620 // Index over URLs so we can quickly look up based on URL. 621 // Index over URLs so we can quickly look up based on URL.
621 return GetDB().Execute( 622 return GetDB().Execute(
622 "CREATE INDEX IF NOT EXISTS urls_url_index ON urls (url)"); 623 "CREATE INDEX IF NOT EXISTS urls_url_index ON urls (url)");
623 } 624 }
624 625
625 } // namespace history 626 } // namespace history
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698