| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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.h" | 5 #include "chrome/browser/autocomplete/autocomplete.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 588 BookmarkModel* bookmark_model = profile_->GetBookmarkModel(); | 588 BookmarkModel* bookmark_model = profile_->GetBookmarkModel(); |
| 589 if (!bookmark_model || !bookmark_model->IsLoaded()) | 589 if (!bookmark_model || !bookmark_model->IsLoaded()) |
| 590 return; | 590 return; |
| 591 | 591 |
| 592 for (ACMatches::iterator i = matches_.begin(); i != matches_.end(); ++i) | 592 for (ACMatches::iterator i = matches_.begin(); i != matches_.end(); ++i) |
| 593 i->starred = bookmark_model->IsBookmarked(GURL(i->destination_url)); | 593 i->starred = bookmark_model->IsBookmarked(GURL(i->destination_url)); |
| 594 } | 594 } |
| 595 | 595 |
| 596 std::wstring AutocompleteProvider::StringForURLDisplay( | 596 std::wstring AutocompleteProvider::StringForURLDisplay( |
| 597 const GURL& url, | 597 const GURL& url, |
| 598 bool check_accept_lang) const { | 598 bool check_accept_lang, |
| 599 bool trim_http) const { |
| 599 std::wstring languages = (check_accept_lang && profile_) ? | 600 std::wstring languages = (check_accept_lang && profile_) ? |
| 600 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages) : std::wstring(); | 601 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages) : std::wstring(); |
| 601 return net::FormatUrl(url, languages); | 602 const net::FormatUrlTypes format_types = trim_http ? |
| 603 net::kFormatUrlOmitAll : net::kFormatUrlOmitUsernamePassword; |
| 604 return net::FormatUrl(url, languages, format_types, UnescapeRule::SPACES, |
| 605 NULL, NULL, NULL); |
| 602 } | 606 } |
| 603 | 607 |
| 604 // AutocompleteResult --------------------------------------------------------- | 608 // AutocompleteResult --------------------------------------------------------- |
| 605 | 609 |
| 606 // static | 610 // static |
| 607 size_t AutocompleteResult::max_matches_ = 6; | 611 size_t AutocompleteResult::max_matches_ = 6; |
| 608 | 612 |
| 609 void AutocompleteResult::Selection::Clear() { | 613 void AutocompleteResult::Selection::Clear() { |
| 610 destination_url = GURL(); | 614 destination_url = GURL(); |
| 611 provider_affinity = NULL; | 615 provider_affinity = NULL; |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1007 void AutocompleteController::CheckIfDone() { | 1011 void AutocompleteController::CheckIfDone() { |
| 1008 for (ACProviders::const_iterator i(providers_.begin()); i != providers_.end(); | 1012 for (ACProviders::const_iterator i(providers_.begin()); i != providers_.end(); |
| 1009 ++i) { | 1013 ++i) { |
| 1010 if (!(*i)->done()) { | 1014 if (!(*i)->done()) { |
| 1011 done_ = false; | 1015 done_ = false; |
| 1012 return; | 1016 return; |
| 1013 } | 1017 } |
| 1014 } | 1018 } |
| 1015 done_ = true; | 1019 done_ = true; |
| 1016 } | 1020 } |
| OLD | NEW |