| 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 "ui/app_list/app_list_constants.h" | 14 #include "ui/app_list/app_list_constants.h" |
| 15 #include "ui/app_list/app_list_folder_item.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" |
| 24 #include "ui/views/layout/box_layout.h" | 25 #include "ui/views/layout/box_layout.h" |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 DCHECK(it != pending_icon_loaders_.end()); | 184 DCHECK(it != pending_icon_loaders_.end()); |
| 184 pending_icon_loaders_.erase(it); | 185 pending_icon_loaders_.erase(it); |
| 185 | 186 |
| 186 if (pending_icon_loaders_.empty() && icon_loading_wait_timer_.IsRunning()) { | 187 if (pending_icon_loaders_.empty() && icon_loading_wait_timer_.IsRunning()) { |
| 187 icon_loading_wait_timer_.Stop(); | 188 icon_loading_wait_timer_.Stop(); |
| 188 GetWidget()->Show(); | 189 GetWidget()->Show(); |
| 189 } | 190 } |
| 190 } | 191 } |
| 191 | 192 |
| 192 void AppListMainView::ActivateApp(AppListItemModel* item, int event_flags) { | 193 void AppListMainView::ActivateApp(AppListItemModel* item, int event_flags) { |
| 193 item->Activate(event_flags); | 194 // TODO(jennyz): Activate the folder via AppListModel notification. |
| 195 if (item->GetAppType() == AppListFolderItem::kAppType) |
| 196 contents_view_->ShowFolderContent(static_cast<AppListFolderItem*>(item)); |
| 197 else |
| 198 item->Activate(event_flags); |
| 194 } | 199 } |
| 195 | 200 |
| 196 void AppListMainView::GetShortcutPathForApp( | 201 void AppListMainView::GetShortcutPathForApp( |
| 197 const std::string& app_id, | 202 const std::string& app_id, |
| 198 const base::Callback<void(const base::FilePath&)>& callback) { | 203 const base::Callback<void(const base::FilePath&)>& callback) { |
| 199 if (delegate_) { | 204 if (delegate_) { |
| 200 delegate_->GetShortcutPathForApp(app_id, callback); | 205 delegate_->GetShortcutPathForApp(app_id, callback); |
| 201 return; | 206 return; |
| 202 } | 207 } |
| 203 callback.Run(base::FilePath()); | 208 callback.Run(base::FilePath()); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 // Resubmit the query via a posted task so that all observers for the | 244 // Resubmit the query via a posted task so that all observers for the |
| 240 // uninstall notification are notified. | 245 // uninstall notification are notified. |
| 241 base::MessageLoop::current()->PostTask( | 246 base::MessageLoop::current()->PostTask( |
| 242 FROM_HERE, | 247 FROM_HERE, |
| 243 base::Bind(&AppListMainView::QueryChanged, | 248 base::Bind(&AppListMainView::QueryChanged, |
| 244 weak_ptr_factory_.GetWeakPtr(), | 249 weak_ptr_factory_.GetWeakPtr(), |
| 245 search_box_view_)); | 250 search_box_view_)); |
| 246 } | 251 } |
| 247 | 252 |
| 248 } // namespace app_list | 253 } // namespace app_list |
| OLD | NEW |