Chromium Code Reviews| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 190 ArcAppListPrefs::Get(profile())->RemoveObserver(this); | 190 ArcAppListPrefs::Get(profile())->RemoveObserver(this); |
| 191 } | 191 } |
| 192 | 192 |
| 193 // AppSearchProvider::DataSource overrides: | 193 // AppSearchProvider::DataSource overrides: |
| 194 void AddApps(AppSearchProvider::Apps* apps) override { | 194 void AddApps(AppSearchProvider::Apps* apps) override { |
| 195 ArcAppListPrefs* arc_prefs = ArcAppListPrefs::Get(profile()); | 195 ArcAppListPrefs* arc_prefs = ArcAppListPrefs::Get(profile()); |
| 196 CHECK(arc_prefs); | 196 CHECK(arc_prefs); |
| 197 | 197 |
| 198 const std::vector<std::string> app_ids = arc_prefs->GetAppIds(); | 198 const std::vector<std::string> app_ids = arc_prefs->GetAppIds(); |
| 199 for (const auto& app_id : app_ids) { | 199 for (const auto& app_id : app_ids) { |
| 200 if (!arc::ShouldShowInLauncher(app_id)) | |
| 201 continue; | |
| 202 | |
| 203 std::unique_ptr<ArcAppListPrefs::AppInfo> app_info = | 200 std::unique_ptr<ArcAppListPrefs::AppInfo> app_info = |
| 204 arc_prefs->GetApp(app_id); | 201 arc_prefs->GetApp(app_id); |
| 205 if (!app_info) { | 202 if (!app_info) { |
| 206 NOTREACHED(); | 203 NOTREACHED(); |
| 207 continue; | 204 continue; |
| 208 } | 205 } |
| 209 | 206 |
| 207 if (!app_info->launchable || !app_info->showInLauncher) | |
|
xiyuan
2016/08/23 17:57:41
Just double check, would this cover the Settings a
xiyuan
2016/08/23 18:12:47
Got a chance to check this?
khmel
2016/08/23 18:15:10
Sorry, forgot to answer.
Yes, checked Settings & A
| |
| 208 continue; | |
| 209 | |
| 210 std::unique_ptr<AppSearchProvider::App> app(new AppSearchProvider::App( | 210 std::unique_ptr<AppSearchProvider::App> app(new AppSearchProvider::App( |
| 211 this, app_id, app_info->name, app_info->last_launch_time, | 211 this, app_id, app_info->name, app_info->last_launch_time, |
| 212 app_info->install_time)); | 212 app_info->install_time)); |
| 213 apps->push_back(std::move(app)); | 213 apps->push_back(std::move(app)); |
| 214 } | 214 } |
| 215 } | 215 } |
| 216 | 216 |
| 217 std::unique_ptr<AppResult> CreateResult( | 217 std::unique_ptr<AppResult> CreateResult( |
| 218 const std::string& app_id, | 218 const std::string& app_id, |
| 219 AppListControllerDelegate* list_controller, | 219 AppListControllerDelegate* list_controller, |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 279 // This will also cause the results to update. | 279 // This will also cause the results to update. |
| 280 if (show_recommendations) | 280 if (show_recommendations) |
| 281 RefreshApps(); | 281 RefreshApps(); |
| 282 | 282 |
| 283 UpdateResults(); | 283 UpdateResults(); |
| 284 } | 284 } |
| 285 | 285 |
| 286 void AppSearchProvider::Stop() { | 286 void AppSearchProvider::Stop() { |
| 287 } | 287 } |
| 288 | 288 |
| 289 | |
| 290 void AppSearchProvider::RefreshApps() { | 289 void AppSearchProvider::RefreshApps() { |
| 291 apps_.clear(); | 290 apps_.clear(); |
| 292 for (auto& data_source : data_sources_) { | 291 for (auto& data_source : data_sources_) { |
| 293 data_source->AddApps(&apps_); | 292 data_source->AddApps(&apps_); |
| 294 } | 293 } |
| 295 } | 294 } |
| 296 | 295 |
| 297 void AppSearchProvider::UpdateResults() { | 296 void AppSearchProvider::UpdateResults() { |
| 298 const TokenizedString query_terms(query_); | 297 const TokenizedString query_terms(query_); |
| 299 bool show_recommendations = query_.empty(); | 298 bool show_recommendations = query_.empty(); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 357 } else { | 356 } else { |
| 358 if (!update_results_factory_.HasWeakPtrs()) { | 357 if (!update_results_factory_.HasWeakPtrs()) { |
| 359 base::ThreadTaskRunnerHandle::Get()->PostTask( | 358 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 360 FROM_HERE, base::Bind(&AppSearchProvider::UpdateResults, | 359 FROM_HERE, base::Bind(&AppSearchProvider::UpdateResults, |
| 361 update_results_factory_.GetWeakPtr())); | 360 update_results_factory_.GetWeakPtr())); |
| 362 } | 361 } |
| 363 } | 362 } |
| 364 } | 363 } |
| 365 | 364 |
| 366 } // namespace app_list | 365 } // namespace app_list |
| OLD | NEW |