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

Side by Side Diff: chrome/browser/autocomplete/autocomplete_match.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/autocomplete/autocomplete_match.h" 5 #include "chrome/browser/autocomplete/autocomplete_match.h"
6 6
7 #include "base/i18n/time_formatting.h" 7 #include "base/i18n/time_formatting.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/strings/string16.h" 9 #include "base/strings/string16.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
11 #include "base/strings/string_util.h" 11 #include "base/strings/string_util.h"
12 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
13 #include "base/time/time.h" 13 #include "base/time/time.h"
14 #include "chrome/browser/autocomplete/autocomplete_provider.h" 14 #include "chrome/browser/autocomplete/autocomplete_provider.h"
15 #include "chrome/browser/search_engines/template_url.h" 15 #include "chrome/browser/search_engines/template_url.h"
16 #include "chrome/browser/search_engines/template_url_service.h" 16 #include "chrome/browser/search_engines/template_url_service.h"
17 #include "chrome/browser/search_engines/template_url_service_factory.h" 17 #include "chrome/browser/search_engines/template_url_service_factory.h"
18 #include "content/public/common/url_constants.h" 18 #include "content/public/common/url_constants.h"
19 #include "grit/theme_resources.h" 19 #include "grit/theme_resources.h"
20 #include "url/url_constants.h"
20 21
21 namespace { 22 namespace {
22 23
23 bool IsTrivialClassification(const ACMatchClassifications& classifications) { 24 bool IsTrivialClassification(const ACMatchClassifications& classifications) {
24 return classifications.empty() || 25 return classifications.empty() ||
25 ((classifications.size() == 1) && 26 ((classifications.size() == 1) &&
26 (classifications.back().style == ACMatchClassification::NONE)); 27 (classifications.back().style == ACMatchClassification::NONE));
27 } 28 }
28 29
29 } // namespace 30 } // namespace
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 static const char prefix[] = "www."; 370 static const char prefix[] = "www.";
370 static const size_t prefix_len = arraysize(prefix) - 1; 371 static const size_t prefix_len = arraysize(prefix) - 1;
371 std::string host = stripped_destination_url.host(); 372 std::string host = stripped_destination_url.host();
372 if (host.compare(0, prefix_len, prefix) == 0) { 373 if (host.compare(0, prefix_len, prefix) == 0) {
373 host = host.substr(prefix_len); 374 host = host.substr(prefix_len);
374 replacements.SetHostStr(host); 375 replacements.SetHostStr(host);
375 needs_replacement = true; 376 needs_replacement = true;
376 } 377 }
377 378
378 // Replace https protocol with http protocol. 379 // Replace https protocol with http protocol.
379 if (stripped_destination_url.SchemeIs(content::kHttpsScheme)) { 380 if (stripped_destination_url.SchemeIs(url::kHttpsScheme)) {
380 replacements.SetScheme( 381 replacements.SetScheme(
381 content::kHttpScheme, 382 url::kHttpScheme,
382 url_parse::Component(0, strlen(content::kHttpScheme))); 383 url_parse::Component(0, strlen(url::kHttpScheme)));
383 needs_replacement = true; 384 needs_replacement = true;
384 } 385 }
385 386
386 if (needs_replacement) 387 if (needs_replacement)
387 stripped_destination_url = stripped_destination_url.ReplaceComponents( 388 stripped_destination_url = stripped_destination_url.ReplaceComponents(
388 replacements); 389 replacements);
389 } 390 }
390 391
391 void AutocompleteMatch::GetKeywordUIState(Profile* profile, 392 void AutocompleteMatch::GetKeywordUIState(Profile* profile,
392 base::string16* keyword, 393 base::string16* keyword,
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 << " is unsorted in relation to last offset of " << last_offset 499 << " is unsorted in relation to last offset of " << last_offset
499 << ". Provider: " << provider_name << "."; 500 << ". Provider: " << provider_name << ".";
500 DCHECK_LT(i->offset, text.length()) 501 DCHECK_LT(i->offset, text.length())
501 << " Classification of [" << i->offset << "," << text.length() 502 << " Classification of [" << i->offset << "," << text.length()
502 << "] is out of bounds for \"" << text << "\". Provider: " 503 << "] is out of bounds for \"" << text << "\". Provider: "
503 << provider_name << "."; 504 << provider_name << ".";
504 last_offset = i->offset; 505 last_offset = i->offset;
505 } 506 }
506 } 507 }
507 #endif 508 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698