OLD | NEW |
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" |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 static const char prefix[] = "www."; | 369 static const char prefix[] = "www."; |
370 static const size_t prefix_len = arraysize(prefix) - 1; | 370 static const size_t prefix_len = arraysize(prefix) - 1; |
371 std::string host = stripped_destination_url.host(); | 371 std::string host = stripped_destination_url.host(); |
372 if (host.compare(0, prefix_len, prefix) == 0) { | 372 if (host.compare(0, prefix_len, prefix) == 0) { |
373 host = host.substr(prefix_len); | 373 host = host.substr(prefix_len); |
374 replacements.SetHostStr(host); | 374 replacements.SetHostStr(host); |
375 needs_replacement = true; | 375 needs_replacement = true; |
376 } | 376 } |
377 | 377 |
378 // Replace https protocol with http protocol. | 378 // Replace https protocol with http protocol. |
379 if (stripped_destination_url.SchemeIs(content::kHttpsScheme)) { | 379 if (stripped_destination_url.SchemeIs(url::kHttpsScheme)) { |
380 replacements.SetScheme(content::kHttpScheme, | 380 replacements.SetScheme(url::kHttpScheme, |
381 url::Component(0, strlen(content::kHttpScheme))); | 381 url::Component(0, strlen(url::kHttpScheme))); |
382 needs_replacement = true; | 382 needs_replacement = true; |
383 } | 383 } |
384 | 384 |
385 if (needs_replacement) | 385 if (needs_replacement) |
386 stripped_destination_url = stripped_destination_url.ReplaceComponents( | 386 stripped_destination_url = stripped_destination_url.ReplaceComponents( |
387 replacements); | 387 replacements); |
388 } | 388 } |
389 | 389 |
390 void AutocompleteMatch::GetKeywordUIState(Profile* profile, | 390 void AutocompleteMatch::GetKeywordUIState(Profile* profile, |
391 base::string16* keyword, | 391 base::string16* keyword, |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
497 << " is unsorted in relation to last offset of " << last_offset | 497 << " is unsorted in relation to last offset of " << last_offset |
498 << ". Provider: " << provider_name << "."; | 498 << ". Provider: " << provider_name << "."; |
499 DCHECK_LT(i->offset, text.length()) | 499 DCHECK_LT(i->offset, text.length()) |
500 << " Classification of [" << i->offset << "," << text.length() | 500 << " Classification of [" << i->offset << "," << text.length() |
501 << "] is out of bounds for \"" << text << "\". Provider: " | 501 << "] is out of bounds for \"" << text << "\". Provider: " |
502 << provider_name << "."; | 502 << provider_name << "."; |
503 last_offset = i->offset; | 503 last_offset = i->offset; |
504 } | 504 } |
505 } | 505 } |
506 #endif | 506 #endif |
OLD | NEW |