Chromium Code Reviews| 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" |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 162 pending_icon_loaders_.clear(); | 162 pending_icon_loaders_.clear(); |
| 163 model_ = delegate_->GetModel(); | 163 model_ = delegate_->GetModel(); |
| 164 search_box_view_->ModelChanged(); | 164 search_box_view_->ModelChanged(); |
| 165 delete contents_view_; | 165 delete contents_view_; |
| 166 contents_view_ = NULL; | 166 contents_view_ = NULL; |
| 167 AddContentsView(); | 167 AddContentsView(); |
| 168 Layout(); | 168 Layout(); |
| 169 } | 169 } |
| 170 | 170 |
| 171 void AppListMainView::UpdateSearchBoxVisibility() { | 171 void AppListMainView::UpdateSearchBoxVisibility() { |
| 172 search_box_view_->SetVisible( | 172 bool visible = |
| 173 !contents_view_->IsNamedPageActive(ContentsView::NAMED_PAGE_START) || | 173 !contents_view_->IsNamedPageActive(ContentsView::NAMED_PAGE_START) || |
| 174 contents_view_->IsShowingSearchResults()); | 174 contents_view_->IsShowingSearchResults(); |
| 175 search_box_view_->SetVisible(visible); | |
| 176 if (visible) | |
| 177 search_box_view_->search_box()->RequestFocus(); | |
| 175 } | 178 } |
| 176 | 179 |
| 177 void AppListMainView::OnStartPageSearchButtonPressed() { | 180 void AppListMainView::OnStartPageSearchTextfieldChanged( |
| 181 const base::string16& new_contents) { | |
| 178 search_box_view_->SetVisible(true); | 182 search_box_view_->SetVisible(true); |
| 179 search_box_view_->search_box()->SetText(base::string16()); | 183 search_box_view_->search_box()->SetText(new_contents); |
|
tapted
2014/06/18 02:46:05
will this trigger AppListMainView::QueryChanged(Se
calamity
2014/06/18 06:49:40
Unfortunately QueryChanged() isn't triggered by Se
| |
| 180 search_box_view_->RequestFocus(); | 184 search_box_view_->search_box()->RequestFocus(); |
| 181 } | 185 } |
| 182 | 186 |
| 183 void AppListMainView::SetDragAndDropHostOfCurrentAppList( | 187 void AppListMainView::SetDragAndDropHostOfCurrentAppList( |
| 184 ApplicationDragAndDropHost* drag_and_drop_host) { | 188 ApplicationDragAndDropHost* drag_and_drop_host) { |
| 185 contents_view_->SetDragAndDropHostOfCurrentAppList(drag_and_drop_host); | 189 contents_view_->SetDragAndDropHostOfCurrentAppList(drag_and_drop_host); |
| 186 } | 190 } |
| 187 | 191 |
| 188 bool AppListMainView::ShouldCenterWindow() const { | 192 bool AppListMainView::ShouldCenterWindow() const { |
| 189 return delegate_->ShouldCenterWindow(); | 193 return delegate_->ShouldCenterWindow(); |
| 190 } | 194 } |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 285 // Resubmit the query via a posted task so that all observers for the | 289 // Resubmit the query via a posted task so that all observers for the |
| 286 // uninstall notification are notified. | 290 // uninstall notification are notified. |
| 287 base::MessageLoop::current()->PostTask( | 291 base::MessageLoop::current()->PostTask( |
| 288 FROM_HERE, | 292 FROM_HERE, |
| 289 base::Bind(&AppListMainView::QueryChanged, | 293 base::Bind(&AppListMainView::QueryChanged, |
| 290 weak_ptr_factory_.GetWeakPtr(), | 294 weak_ptr_factory_.GetWeakPtr(), |
| 291 search_box_view_)); | 295 search_box_view_)); |
| 292 } | 296 } |
| 293 | 297 |
| 294 } // namespace app_list | 298 } // namespace app_list |
| OLD | NEW |