Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "athena/home/app_list_view_delegate.h" | 5 #include "athena/home/app_list_view_delegate.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "athena/home/public/app_model_builder.h" | 10 #include "athena/home/public/app_model_builder.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 46 // TODO(mukai): port app-list's mixer and remove this restriction. | 46 // TODO(mukai): port app-list's mixer and remove this restriction. |
| 47 DCHECK(search_providers_.empty()); | 47 DCHECK(search_providers_.empty()); |
| 48 search_provider->set_result_changed_callback(base::Bind( | 48 search_provider->set_result_changed_callback(base::Bind( |
| 49 &AppListViewDelegate::SearchResultChanged, base::Unretained(this))); | 49 &AppListViewDelegate::SearchResultChanged, base::Unretained(this))); |
| 50 search_providers_.push_back(search_provider); | 50 search_providers_.push_back(search_provider); |
| 51 } | 51 } |
| 52 | 52 |
| 53 void AppListViewDelegate::SearchResultChanged() { | 53 void AppListViewDelegate::SearchResultChanged() { |
| 54 // TODO(mukai): port app-list's Mixer to reorder the results properly. | 54 // TODO(mukai): port app-list's Mixer to reorder the results properly. |
| 55 app_list::SearchProvider* search_provider = search_providers_[0]; | 55 app_list::SearchProvider* search_provider = search_providers_[0]; |
| 56 std::vector<app_list::SearchResult*> results; | 56 const app_list::SearchProvider::Results& results = search_provider->results(); |
| 57 search_provider->ReleaseResult(&results); | 57 model_->results()->DeleteAll(); |
|
tapted
2014/10/02 07:19:21
Does this cause flickering of the search results i
Jun Mukai
2014/10/03 01:24:23
Right, this actually causes flickering unfortunate
| |
| 58 if (results.empty()) { | 58 for (size_t i = 0; i < results.size(); ++i) |
| 59 model_->results()->DeleteAll(); | 59 model_->results()->Add(results[i]->Duplicate().release()); |
|
tapted
2014/10/02 07:19:21
(no action required) would be nice if this .releas
Jun Mukai
2014/10/03 01:24:23
Agreed. I think ideally ListModel should support i
| |
| 60 } else { | |
| 61 for (size_t i = 0; i < results.size(); ++i) | |
| 62 model_->results()->Add(results[i]); | |
| 63 } | |
| 64 } | 60 } |
| 65 | 61 |
| 66 bool AppListViewDelegate::ForceNativeDesktop() const { | 62 bool AppListViewDelegate::ForceNativeDesktop() const { |
| 67 return false; | 63 return false; |
| 68 } | 64 } |
| 69 | 65 |
| 70 void AppListViewDelegate::SetProfileByPath(const base::FilePath& profile_path) { | 66 void AppListViewDelegate::SetProfileByPath(const base::FilePath& profile_path) { |
| 71 // Nothing needs to be done. | 67 // Nothing needs to be done. |
| 72 } | 68 } |
| 73 | 69 |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 181 const app_list::AppListViewDelegate::Users& | 177 const app_list::AppListViewDelegate::Users& |
| 182 AppListViewDelegate::GetUsers() const { | 178 AppListViewDelegate::GetUsers() const { |
| 183 return users_; | 179 return users_; |
| 184 } | 180 } |
| 185 | 181 |
| 186 bool AppListViewDelegate::ShouldCenterWindow() const { | 182 bool AppListViewDelegate::ShouldCenterWindow() const { |
| 187 return true; | 183 return true; |
| 188 } | 184 } |
| 189 | 185 |
| 190 } // namespace athena | 186 } // namespace athena |
| OLD | NEW |