OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/gfx/text_elider.h" | |
10 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
11 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
12 #include "base/string_util.h" | 11 #include "base/string_util.h" |
13 #include "chrome/browser/autocomplete/history_url_provider.h" | 12 #include "chrome/browser/autocomplete/history_url_provider.h" |
14 #include "chrome/browser/autocomplete/history_contents_provider.h" | 13 #include "chrome/browser/autocomplete/history_contents_provider.h" |
15 #include "chrome/browser/autocomplete/keyword_provider.h" | 14 #include "chrome/browser/autocomplete/keyword_provider.h" |
16 #include "chrome/browser/autocomplete/search_provider.h" | 15 #include "chrome/browser/autocomplete/search_provider.h" |
17 #include "chrome/browser/bookmarks/bookmark_model.h" | 16 #include "chrome/browser/bookmarks/bookmark_model.h" |
18 #include "chrome/browser/dom_ui/history_ui.h" | 17 #include "chrome/browser/dom_ui/history_ui.h" |
19 #include "chrome/browser/external_protocol_handler.h" | 18 #include "chrome/browser/external_protocol_handler.h" |
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
485 if (!bookmark_model || !bookmark_model->IsLoaded()) | 484 if (!bookmark_model || !bookmark_model->IsLoaded()) |
486 return; | 485 return; |
487 | 486 |
488 for (ACMatches::iterator i = matches_.begin(); i != matches_.end(); ++i) | 487 for (ACMatches::iterator i = matches_.begin(); i != matches_.end(); ++i) |
489 i->starred = bookmark_model->IsBookmarked(GURL(i->destination_url)); | 488 i->starred = bookmark_model->IsBookmarked(GURL(i->destination_url)); |
490 } | 489 } |
491 | 490 |
492 std::wstring AutocompleteProvider::StringForURLDisplay( | 491 std::wstring AutocompleteProvider::StringForURLDisplay( |
493 const GURL& url, | 492 const GURL& url, |
494 bool check_accept_lang) const { | 493 bool check_accept_lang) const { |
495 return gfx::GetCleanStringFromUrl(url, (check_accept_lang && profile_) ? | 494 std::wstring languages = (check_accept_lang && profile_) ? |
496 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages) : std::wstring(), | 495 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages) : std::wstring(); |
497 NULL, NULL); | 496 return net::FormatUrl(url, languages); |
498 } | 497 } |
499 | 498 |
500 // AutocompleteResult --------------------------------------------------------- | 499 // AutocompleteResult --------------------------------------------------------- |
501 | 500 |
502 // static | 501 // static |
503 size_t AutocompleteResult::max_matches_ = 6; | 502 size_t AutocompleteResult::max_matches_ = 6; |
504 | 503 |
505 void AutocompleteResult::Selection::Clear() { | 504 void AutocompleteResult::Selection::Clear() { |
506 destination_url = GURL(); | 505 destination_url = GURL(); |
507 provider_affinity = NULL; | 506 provider_affinity = NULL; |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
869 match.contents_class.push_back( | 868 match.contents_class.push_back( |
870 ACMatchClassification(keyword_offset + input_.text().size(), | 869 ACMatchClassification(keyword_offset + input_.text().size(), |
871 ACMatchClassification::NONE)); | 870 ACMatchClassification::NONE)); |
872 } | 871 } |
873 match.destination_url = | 872 match.destination_url = |
874 HistoryUI::GetHistoryURLWithSearchText(input_.text()); | 873 HistoryUI::GetHistoryURLWithSearchText(input_.text()); |
875 match.transition = PageTransition::AUTO_BOOKMARK; | 874 match.transition = PageTransition::AUTO_BOOKMARK; |
876 match.provider = history_contents_provider_; | 875 match.provider = history_contents_provider_; |
877 latest_result_.AddMatch(match); | 876 latest_result_.AddMatch(match); |
878 } | 877 } |
OLD | NEW |