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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 contents_view_ = NULL; | 167 contents_view_ = NULL; |
168 if (contents_switcher_view_) { | 168 if (contents_switcher_view_) { |
169 delete contents_switcher_view_; | 169 delete contents_switcher_view_; |
170 contents_switcher_view_ = NULL; | 170 contents_switcher_view_ = NULL; |
171 } | 171 } |
172 AddContentsViews(); | 172 AddContentsViews(); |
173 Layout(); | 173 Layout(); |
174 } | 174 } |
175 | 175 |
176 void AppListMainView::UpdateSearchBoxVisibility() { | 176 void AppListMainView::UpdateSearchBoxVisibility() { |
177 search_box_view_->SetVisible( | 177 bool visible = |
178 !contents_view_->IsNamedPageActive(ContentsView::NAMED_PAGE_START) || | 178 !contents_view_->IsNamedPageActive(ContentsView::NAMED_PAGE_START) || |
179 contents_view_->IsShowingSearchResults()); | 179 contents_view_->IsShowingSearchResults(); |
| 180 search_box_view_->SetVisible(visible); |
| 181 if (visible) |
| 182 search_box_view_->search_box()->RequestFocus(); |
180 } | 183 } |
181 | 184 |
182 void AppListMainView::OnStartPageSearchButtonPressed() { | 185 void AppListMainView::OnStartPageSearchTextfieldChanged( |
| 186 const base::string16& new_contents) { |
183 search_box_view_->SetVisible(true); | 187 search_box_view_->SetVisible(true); |
184 search_box_view_->search_box()->SetText(base::string16()); | 188 search_box_view_->search_box()->SetText(new_contents); |
185 search_box_view_->RequestFocus(); | 189 search_box_view_->search_box()->RequestFocus(); |
186 } | 190 } |
187 | 191 |
188 void AppListMainView::SetDragAndDropHostOfCurrentAppList( | 192 void AppListMainView::SetDragAndDropHostOfCurrentAppList( |
189 ApplicationDragAndDropHost* drag_and_drop_host) { | 193 ApplicationDragAndDropHost* drag_and_drop_host) { |
190 contents_view_->SetDragAndDropHostOfCurrentAppList(drag_and_drop_host); | 194 contents_view_->SetDragAndDropHostOfCurrentAppList(drag_and_drop_host); |
191 } | 195 } |
192 | 196 |
193 bool AppListMainView::ShouldCenterWindow() const { | 197 bool AppListMainView::ShouldCenterWindow() const { |
194 return delegate_->ShouldCenterWindow(); | 198 return delegate_->ShouldCenterWindow(); |
195 } | 199 } |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 // Resubmit the query via a posted task so that all observers for the | 294 // Resubmit the query via a posted task so that all observers for the |
291 // uninstall notification are notified. | 295 // uninstall notification are notified. |
292 base::MessageLoop::current()->PostTask( | 296 base::MessageLoop::current()->PostTask( |
293 FROM_HERE, | 297 FROM_HERE, |
294 base::Bind(&AppListMainView::QueryChanged, | 298 base::Bind(&AppListMainView::QueryChanged, |
295 weak_ptr_factory_.GetWeakPtr(), | 299 weak_ptr_factory_.GetWeakPtr(), |
296 search_box_view_)); | 300 search_box_view_)); |
297 } | 301 } |
298 | 302 |
299 } // namespace app_list | 303 } // namespace app_list |
OLD | NEW |