| 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_folder_item.h" |
| 16 #include "ui/app_list/app_list_item.h" | 16 #include "ui/app_list/app_list_item.h" |
| 17 #include "ui/app_list/app_list_model.h" | 17 #include "ui/app_list/app_list_model.h" |
| 18 #include "ui/app_list/app_list_switches.h" | 18 #include "ui/app_list/app_list_switches.h" |
| 19 #include "ui/app_list/app_list_view_delegate.h" | 19 #include "ui/app_list/app_list_view_delegate.h" |
| 20 #include "ui/app_list/pagination_model.h" | 20 #include "ui/app_list/pagination_model.h" |
| 21 #include "ui/app_list/search_box_model.h" | 21 #include "ui/app_list/search_box_model.h" |
| 22 #include "ui/app_list/views/app_list_item_view.h" | 22 #include "ui/app_list/views/app_list_item_view.h" |
| 23 #include "ui/app_list/views/apps_container_view.h" |
| 23 #include "ui/app_list/views/contents_switcher_view.h" | 24 #include "ui/app_list/views/contents_switcher_view.h" |
| 24 #include "ui/app_list/views/contents_view.h" | 25 #include "ui/app_list/views/contents_view.h" |
| 25 #include "ui/app_list/views/search_box_view.h" | 26 #include "ui/app_list/views/search_box_view.h" |
| 26 #include "ui/views/controls/textfield/textfield.h" | 27 #include "ui/views/controls/textfield/textfield.h" |
| 27 #include "ui/views/layout/box_layout.h" | 28 #include "ui/views/layout/box_layout.h" |
| 28 #include "ui/views/widget/widget.h" | 29 #include "ui/views/widget/widget.h" |
| 29 | 30 |
| 30 namespace app_list { | 31 namespace app_list { |
| 31 | 32 |
| 32 namespace { | 33 namespace { |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 | 131 |
| 131 if (icon_loading_wait_timer_.IsRunning()) | 132 if (icon_loading_wait_timer_.IsRunning()) |
| 132 return; | 133 return; |
| 133 | 134 |
| 134 icon_loading_wait_timer_.Start( | 135 icon_loading_wait_timer_.Start( |
| 135 FROM_HERE, | 136 FROM_HERE, |
| 136 base::TimeDelta::FromMilliseconds(kMaxIconLoadingWaitTimeInMs), | 137 base::TimeDelta::FromMilliseconds(kMaxIconLoadingWaitTimeInMs), |
| 137 this, &AppListMainView::OnIconLoadingWaitTimer); | 138 this, &AppListMainView::OnIconLoadingWaitTimer); |
| 138 } | 139 } |
| 139 | 140 |
| 141 void AppListMainView::ResetForShow() { |
| 142 contents_view_->apps_container_view()->ResetForShow(); |
| 143 // We clear the search when hiding so when app list appears it is not showing |
| 144 // search results. |
| 145 search_box_view_->ClearSearch(); |
| 146 } |
| 147 |
| 140 void AppListMainView::Close() { | 148 void AppListMainView::Close() { |
| 141 icon_loading_wait_timer_.Stop(); | 149 icon_loading_wait_timer_.Stop(); |
| 142 contents_view_->CancelDrag(); | 150 contents_view_->CancelDrag(); |
| 143 } | 151 } |
| 144 | 152 |
| 145 void AppListMainView::Prerender() { | 153 void AppListMainView::Prerender() { |
| 146 contents_view_->Prerender(); | 154 contents_view_->Prerender(); |
| 147 } | 155 } |
| 148 | 156 |
| 149 void AppListMainView::ModelChanged() { | 157 void AppListMainView::ModelChanged() { |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 // Resubmit the query via a posted task so that all observers for the | 248 // Resubmit the query via a posted task so that all observers for the |
| 241 // uninstall notification are notified. | 249 // uninstall notification are notified. |
| 242 base::MessageLoop::current()->PostTask( | 250 base::MessageLoop::current()->PostTask( |
| 243 FROM_HERE, | 251 FROM_HERE, |
| 244 base::Bind(&AppListMainView::QueryChanged, | 252 base::Bind(&AppListMainView::QueryChanged, |
| 245 weak_ptr_factory_.GetWeakPtr(), | 253 weak_ptr_factory_.GetWeakPtr(), |
| 246 search_box_view_)); | 254 search_box_view_)); |
| 247 } | 255 } |
| 248 | 256 |
| 249 } // namespace app_list | 257 } // namespace app_list |
| OLD | NEW |