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 if (item->GetAppType() == AppListFolderItem::kAppType) |
195 contents_view_->ShowFolderContent(static_cast<AppListFolderItem*>(item)); | |
xiyuan
2013/10/17 23:50:30
Per discussion, put to TODO here to achieve this v
jennyz
2013/10/18 22:09:02
Done.
| |
196 else | |
197 item->Activate(event_flags); | |
194 } | 198 } |
195 | 199 |
196 void AppListMainView::GetShortcutPathForApp( | 200 void AppListMainView::GetShortcutPathForApp( |
197 const std::string& app_id, | 201 const std::string& app_id, |
198 const base::Callback<void(const base::FilePath&)>& callback) { | 202 const base::Callback<void(const base::FilePath&)>& callback) { |
199 if (delegate_) { | 203 if (delegate_) { |
200 delegate_->GetShortcutPathForApp(app_id, callback); | 204 delegate_->GetShortcutPathForApp(app_id, callback); |
201 return; | 205 return; |
202 } | 206 } |
203 callback.Run(base::FilePath()); | 207 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 | 243 // Resubmit the query via a posted task so that all observers for the |
240 // uninstall notification are notified. | 244 // uninstall notification are notified. |
241 base::MessageLoop::current()->PostTask( | 245 base::MessageLoop::current()->PostTask( |
242 FROM_HERE, | 246 FROM_HERE, |
243 base::Bind(&AppListMainView::QueryChanged, | 247 base::Bind(&AppListMainView::QueryChanged, |
244 weak_ptr_factory_.GetWeakPtr(), | 248 weak_ptr_factory_.GetWeakPtr(), |
245 search_box_view_)); | 249 search_box_view_)); |
246 } | 250 } |
247 | 251 |
248 } // namespace app_list | 252 } // namespace app_list |
OLD | NEW |