| 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 "ui/app_list/views/app_list_main_view.h" | 5 #include "ui/app_list/views/app_list_main_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
| 12 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
| 13 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
| 14 #include "content/public/browser/user_metrics.h" |
| 14 #include "ui/app_list/app_list_constants.h" | 15 #include "ui/app_list/app_list_constants.h" |
| 15 #include "ui/app_list/app_list_item_model.h" | 16 #include "ui/app_list/app_list_item_model.h" |
| 16 #include "ui/app_list/app_list_model.h" | 17 #include "ui/app_list/app_list_model.h" |
| 17 #include "ui/app_list/app_list_view_delegate.h" | 18 #include "ui/app_list/app_list_view_delegate.h" |
| 18 #include "ui/app_list/pagination_model.h" | 19 #include "ui/app_list/pagination_model.h" |
| 19 #include "ui/app_list/search_box_model.h" | 20 #include "ui/app_list/search_box_model.h" |
| 20 #include "ui/app_list/views/app_list_item_view.h" | 21 #include "ui/app_list/views/app_list_item_view.h" |
| 21 #include "ui/app_list/views/contents_view.h" | 22 #include "ui/app_list/views/contents_view.h" |
| 22 #include "ui/app_list/views/search_box_view.h" | 23 #include "ui/app_list/views/search_box_view.h" |
| 23 #include "ui/views/controls/textfield/textfield.h" | 24 #include "ui/views/controls/textfield/textfield.h" |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 DCHECK(it != pending_icon_loaders_.end()); | 180 DCHECK(it != pending_icon_loaders_.end()); |
| 180 pending_icon_loaders_.erase(it); | 181 pending_icon_loaders_.erase(it); |
| 181 | 182 |
| 182 if (pending_icon_loaders_.empty() && icon_loading_wait_timer_.IsRunning()) { | 183 if (pending_icon_loaders_.empty() && icon_loading_wait_timer_.IsRunning()) { |
| 183 icon_loading_wait_timer_.Stop(); | 184 icon_loading_wait_timer_.Stop(); |
| 184 GetWidget()->Show(); | 185 GetWidget()->Show(); |
| 185 } | 186 } |
| 186 } | 187 } |
| 187 | 188 |
| 188 void AppListMainView::ActivateApp(AppListItemModel* item, int event_flags) { | 189 void AppListMainView::ActivateApp(AppListItemModel* item, int event_flags) { |
| 189 if (delegate_) | 190 content::RecordAction(content::UserMetricsAction("AppList_ClickOnApp")); |
| 190 delegate_->ActivateAppListItem(item, event_flags); | 191 item->Activate(event_flags); |
| 191 } | 192 } |
| 192 | 193 |
| 193 void AppListMainView::GetShortcutPathForApp( | 194 void AppListMainView::GetShortcutPathForApp( |
| 194 const std::string& app_id, | 195 const std::string& app_id, |
| 195 const base::Callback<void(const base::FilePath&)>& callback) { | 196 const base::Callback<void(const base::FilePath&)>& callback) { |
| 196 if (delegate_) { | 197 if (delegate_) { |
| 197 delegate_->GetShortcutPathForApp(app_id, callback); | 198 delegate_->GetShortcutPathForApp(app_id, callback); |
| 198 return; | 199 return; |
| 199 } | 200 } |
| 200 callback.Run(base::FilePath()); | 201 callback.Run(base::FilePath()); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 // Resubmit the query via a posted task so that all observers for the | 237 // Resubmit the query via a posted task so that all observers for the |
| 237 // uninstall notification are notified. | 238 // uninstall notification are notified. |
| 238 base::MessageLoop::current()->PostTask( | 239 base::MessageLoop::current()->PostTask( |
| 239 FROM_HERE, | 240 FROM_HERE, |
| 240 base::Bind(&AppListMainView::QueryChanged, | 241 base::Bind(&AppListMainView::QueryChanged, |
| 241 weak_ptr_factory_.GetWeakPtr(), | 242 weak_ptr_factory_.GetWeakPtr(), |
| 242 search_box_view_)); | 243 search_box_view_)); |
| 243 } | 244 } |
| 244 | 245 |
| 245 } // namespace app_list | 246 } // namespace app_list |
| OLD | NEW |