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

Unified Diff: chrome/browser/history/url_database.cc

Issue 8286011: When users navigate to an intranet host that has not been previously typed, treat it as a typed n... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/history/url_database.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/history/url_database.cc
===================================================================
--- chrome/browser/history/url_database.cc (revision 105368)
+++ chrome/browser/history/url_database.cc (working copy)
@@ -291,7 +291,7 @@
return true;
}
-bool URLDatabase::AutocompleteForPrefix(const string16& prefix,
+bool URLDatabase::AutocompleteForPrefix(const std::string& prefix,
size_t max_results,
bool typed_only,
std::vector<history::URLRow>* results) {
@@ -323,11 +323,10 @@
// followed by the maximum character size. Use 8-bit strings for everything
// so we can be sure sqlite is comparing everything in 8-bit mode. Otherwise,
// it will have to convert strings either to UTF-8 or UTF-16 for comparison.
- std::string prefix_utf8(UTF16ToUTF8(prefix));
- std::string end_query(prefix_utf8);
+ std::string end_query(prefix);
end_query.push_back(std::numeric_limits<unsigned char>::max());
- statement.BindString(0, prefix_utf8);
+ statement.BindString(0, prefix);
statement.BindString(1, end_query);
statement.BindInt(2, static_cast<int>(max_results));
@@ -340,6 +339,23 @@
return !results->empty();
}
+bool URLDatabase::IsTypedHost(const std::string& host) {
+ const char* schemes[] = {
+ chrome::kHttpScheme,
+ chrome::kHttpsScheme,
+ chrome::kFtpScheme
+ };
+ std::vector<history::URLRow> dummy;
+ for (size_t i = 0; i < arraysize(schemes); ++i) {
+ std::string scheme_and_host(schemes[i]);
+ scheme_and_host += chrome::kStandardSchemeSeparator + host;
+ if (AutocompleteForPrefix(scheme_and_host + '/', 1, true, &dummy) ||
+ AutocompleteForPrefix(scheme_and_host + ':', 1, true, &dummy))
+ return true;
+ }
+ return false;
+}
+
bool URLDatabase::FindShortestURLFromBase(const std::string& base,
const std::string& url,
int min_visits,
« no previous file with comments | « chrome/browser/history/url_database.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698