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/shortcuts_backend.h" | 5 #include "chrome/browser/autocomplete/shortcuts_backend.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 history::ShortcutsDatabase::Shortcut::MatchCore | 145 history::ShortcutsDatabase::Shortcut::MatchCore |
146 ShortcutsBackend::MatchToMatchCore(const AutocompleteMatch& match, | 146 ShortcutsBackend::MatchToMatchCore(const AutocompleteMatch& match, |
147 Profile* profile) { | 147 Profile* profile) { |
148 const AutocompleteMatch::Type match_type = GetTypeForShortcut(match.type); | 148 const AutocompleteMatch::Type match_type = GetTypeForShortcut(match.type); |
149 TemplateURLService* service = | 149 TemplateURLService* service = |
150 TemplateURLServiceFactory::GetForProfile(profile); | 150 TemplateURLServiceFactory::GetForProfile(profile); |
151 const AutocompleteMatch& normalized_match = | 151 const AutocompleteMatch& normalized_match = |
152 AutocompleteMatch::IsSpecializedSearchType(match.type) ? | 152 AutocompleteMatch::IsSpecializedSearchType(match.type) ? |
153 BaseSearchProvider::CreateSearchSuggestion( | 153 BaseSearchProvider::CreateSearchSuggestion( |
154 match.search_terms_args->search_terms, match_type, | 154 match.search_terms_args->search_terms, match_type, |
155 (match.transition == content::PAGE_TRANSITION_KEYWORD), | 155 (match.transition == ui::PAGE_TRANSITION_KEYWORD), |
156 match.GetTemplateURL(service, false), | 156 match.GetTemplateURL(service, false), |
157 UIThreadSearchTermsData(profile)) : | 157 UIThreadSearchTermsData(profile)) : |
158 match; | 158 match; |
159 return history::ShortcutsDatabase::Shortcut::MatchCore( | 159 return history::ShortcutsDatabase::Shortcut::MatchCore( |
160 normalized_match.fill_into_edit, normalized_match.destination_url, | 160 normalized_match.fill_into_edit, normalized_match.destination_url, |
161 normalized_match.contents, | 161 normalized_match.contents, |
162 StripMatchMarkers(normalized_match.contents_class), | 162 StripMatchMarkers(normalized_match.contents_class), |
163 normalized_match.description, | 163 normalized_match.description, |
164 StripMatchMarkers(normalized_match.description_class), | 164 StripMatchMarkers(normalized_match.description_class), |
165 normalized_match.transition, match_type, normalized_match.keyword); | 165 normalized_match.transition, match_type, normalized_match.keyword); |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 guid_map_.clear(); | 321 guid_map_.clear(); |
322 FOR_EACH_OBSERVER(ShortcutsBackendObserver, observer_list_, | 322 FOR_EACH_OBSERVER(ShortcutsBackendObserver, observer_list_, |
323 OnShortcutsChanged()); | 323 OnShortcutsChanged()); |
324 return no_db_access_ || | 324 return no_db_access_ || |
325 BrowserThread::PostTask( | 325 BrowserThread::PostTask( |
326 BrowserThread::DB, FROM_HERE, | 326 BrowserThread::DB, FROM_HERE, |
327 base::Bind(base::IgnoreResult( | 327 base::Bind(base::IgnoreResult( |
328 &history::ShortcutsDatabase::DeleteAllShortcuts), | 328 &history::ShortcutsDatabase::DeleteAllShortcuts), |
329 db_.get())); | 329 db_.get())); |
330 } | 330 } |
OLD | NEW |