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

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

Issue 448143008: Move StringToUpperASCII and LowerCaseEqualsASCII to the base namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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
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/visitsegment_database.h" 5 #include "chrome/browser/history/visitsegment_database.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <string> 10 #include <string>
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 // TODO(brettw) this should probably use the registry controlled 101 // TODO(brettw) this should probably use the registry controlled
102 // domains service. 102 // domains service.
103 GURL::Replacements r; 103 GURL::Replacements r;
104 const char kWWWDot[] = "www."; 104 const char kWWWDot[] = "www.";
105 const int kWWWDotLen = arraysize(kWWWDot) - 1; 105 const int kWWWDotLen = arraysize(kWWWDot) - 1;
106 106
107 std::string host = url.host(); 107 std::string host = url.host();
108 const char* host_c = host.c_str(); 108 const char* host_c = host.c_str();
109 // Remove www. to avoid some dups. 109 // Remove www. to avoid some dups.
110 if (static_cast<int>(host.size()) > kWWWDotLen && 110 if (static_cast<int>(host.size()) > kWWWDotLen &&
111 LowerCaseEqualsASCII(host_c, host_c + kWWWDotLen, kWWWDot)) { 111 base::LowerCaseEqualsASCII(host_c, host_c + kWWWDotLen, kWWWDot)) {
112 r.SetHost(host.c_str(), 112 r.SetHost(host.c_str(),
113 url::Component(kWWWDotLen, 113 url::Component(kWWWDotLen,
114 static_cast<int>(host.size()) - kWWWDotLen)); 114 static_cast<int>(host.size()) - kWWWDotLen));
115 } 115 }
116 // Remove other stuff we don't want. 116 // Remove other stuff we don't want.
117 r.ClearUsername(); 117 r.ClearUsername();
118 r.ClearPassword(); 118 r.ClearPassword();
119 r.ClearQuery(); 119 r.ClearQuery();
120 r.ClearRef(); 120 r.ClearRef();
121 r.ClearPort(); 121 r.ClearPort();
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 "name VARCHAR," 318 "name VARCHAR,"
319 "url_id INTEGER NON NULL)") && 319 "url_id INTEGER NON NULL)") &&
320 GetDB().Execute("INSERT INTO segments_tmp SELECT " 320 GetDB().Execute("INSERT INTO segments_tmp SELECT "
321 "id, name, url_id FROM segments") && 321 "id, name, url_id FROM segments") &&
322 GetDB().Execute("DROP TABLE segments") && 322 GetDB().Execute("DROP TABLE segments") &&
323 GetDB().Execute("ALTER TABLE segments_tmp RENAME TO segments") && 323 GetDB().Execute("ALTER TABLE segments_tmp RENAME TO segments") &&
324 transaction.Commit(); 324 transaction.Commit();
325 } 325 }
326 326
327 } // namespace history 327 } // namespace history
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/web_request/web_request_api_helpers.cc ('k') | chrome/browser/io_thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698