| 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_provider.h" | 5 #include "chrome/browser/autocomplete/autocomplete_provider.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "chrome/browser/autocomplete/autocomplete_match.h" | 10 #include "chrome/browser/autocomplete/autocomplete_match.h" |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 DLOG(WARNING) << "The AutocompleteProvider '" << GetName() | 100 DLOG(WARNING) << "The AutocompleteProvider '" << GetName() |
| 101 << "' has not implemented DeleteMatch."; | 101 << "' has not implemented DeleteMatch."; |
| 102 } | 102 } |
| 103 | 103 |
| 104 void AutocompleteProvider::AddProviderInfo(ProvidersInfo* provider_info) const { | 104 void AutocompleteProvider::AddProviderInfo(ProvidersInfo* provider_info) const { |
| 105 } | 105 } |
| 106 | 106 |
| 107 void AutocompleteProvider::ResetSession() { | 107 void AutocompleteProvider::ResetSession() { |
| 108 } | 108 } |
| 109 | 109 |
| 110 string16 AutocompleteProvider::StringForURLDisplay(const GURL& url, | 110 base::string16 AutocompleteProvider::StringForURLDisplay(const GURL& url, |
| 111 bool check_accept_lang, | 111 bool check_accept_lang, |
| 112 bool trim_http) const { | 112 bool trim_http) const { |
| 113 std::string languages = (check_accept_lang && profile_) ? | 113 std::string languages = (check_accept_lang && profile_) ? |
| 114 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages) : std::string(); | 114 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages) : std::string(); |
| 115 return net::FormatUrl(url, languages, | 115 return net::FormatUrl(url, languages, |
| 116 net::kFormatUrlOmitAll & ~(trim_http ? 0 : net::kFormatUrlOmitHTTP), | 116 net::kFormatUrlOmitAll & ~(trim_http ? 0 : net::kFormatUrlOmitHTTP), |
| 117 net::UnescapeRule::SPACES, NULL, NULL, NULL); | 117 net::UnescapeRule::SPACES, NULL, NULL, NULL); |
| 118 } | 118 } |
| 119 | 119 |
| 120 AutocompleteProvider::~AutocompleteProvider() { | 120 AutocompleteProvider::~AutocompleteProvider() { |
| 121 Stop(false); | 121 Stop(false); |
| 122 } | 122 } |
| 123 | 123 |
| 124 void AutocompleteProvider::UpdateStarredStateOfMatches() { | 124 void AutocompleteProvider::UpdateStarredStateOfMatches() { |
| 125 if (matches_.empty()) | 125 if (matches_.empty()) |
| 126 return; | 126 return; |
| 127 | 127 |
| 128 if (!profile_) | 128 if (!profile_) |
| 129 return; | 129 return; |
| 130 | 130 |
| 131 BookmarkModel* bookmark_model = BookmarkModelFactory::GetForProfile(profile_); | 131 BookmarkModel* bookmark_model = BookmarkModelFactory::GetForProfile(profile_); |
| 132 if (!bookmark_model || !bookmark_model->loaded()) | 132 if (!bookmark_model || !bookmark_model->loaded()) |
| 133 return; | 133 return; |
| 134 | 134 |
| 135 for (ACMatches::iterator i(matches_.begin()); i != matches_.end(); ++i) | 135 for (ACMatches::iterator i(matches_.begin()); i != matches_.end(); ++i) |
| 136 i->starred = bookmark_model->IsBookmarked(i->destination_url); | 136 i->starred = bookmark_model->IsBookmarked(i->destination_url); |
| 137 } | 137 } |
| OLD | NEW |