| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/ui/app_list/search/app_search_provider.h" | 5 #include "chrome/browser/ui/app_list/search/app_search_provider.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 RefreshApps(); | 49 RefreshApps(); |
| 50 } | 50 } |
| 51 | 51 |
| 52 AppSearchProvider::~AppSearchProvider() {} | 52 AppSearchProvider::~AppSearchProvider() {} |
| 53 | 53 |
| 54 void AppSearchProvider::Start(const string16& query) { | 54 void AppSearchProvider::Start(const string16& query) { |
| 55 const TokenizedString query_terms(query); | 55 const TokenizedString query_terms(query); |
| 56 | 56 |
| 57 ClearResults(); | 57 ClearResults(); |
| 58 | 58 |
| 59 DLOG(INFO) << "AppSearchPRovder has " << apps_.size() << " apps."; |
| 60 |
| 59 TokenizedStringMatch match; | 61 TokenizedStringMatch match; |
| 60 for (Apps::const_iterator app_it = apps_.begin(); | 62 for (Apps::const_iterator app_it = apps_.begin(); |
| 61 app_it != apps_.end(); | 63 app_it != apps_.end(); |
| 62 ++app_it) { | 64 ++app_it) { |
| 63 if (!match.Calculate(query_terms, (*app_it)->indexed_name())) | 65 if (!match.Calculate(query_terms, (*app_it)->indexed_name())) |
| 64 continue; | 66 continue; |
| 65 | 67 |
| 66 scoped_ptr<AppResult> result( | 68 scoped_ptr<AppResult> result( |
| 67 new AppResult(profile_, (*app_it)->app_id(), list_controller_)); | 69 new AppResult(profile_, (*app_it)->app_id(), list_controller_)); |
| 68 result->UpdateFromMatch((*app_it)->indexed_name(), match); | 70 result->UpdateFromMatch((*app_it)->indexed_name(), match); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 AddApps(extension_service->terminated_extensions(), extension_service); | 104 AddApps(extension_service->terminated_extensions(), extension_service); |
| 103 } | 105 } |
| 104 | 106 |
| 105 void AppSearchProvider::Observe(int type, | 107 void AppSearchProvider::Observe(int type, |
| 106 const content::NotificationSource& source, | 108 const content::NotificationSource& source, |
| 107 const content::NotificationDetails& detaila) { | 109 const content::NotificationDetails& detaila) { |
| 108 RefreshApps(); | 110 RefreshApps(); |
| 109 } | 111 } |
| 110 | 112 |
| 111 } // namespace app_list | 113 } // namespace app_list |
| OLD | NEW |