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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 contents_view_ = NULL; | 171 contents_view_ = NULL; |
172 if (contents_switcher_view_) { | 172 if (contents_switcher_view_) { |
173 delete contents_switcher_view_; | 173 delete contents_switcher_view_; |
174 contents_switcher_view_ = NULL; | 174 contents_switcher_view_ = NULL; |
175 } | 175 } |
176 AddContentsViews(); | 176 AddContentsViews(); |
177 Layout(); | 177 Layout(); |
178 } | 178 } |
179 | 179 |
180 void AppListMainView::UpdateSearchBoxVisibility() { | 180 void AppListMainView::UpdateSearchBoxVisibility() { |
181 bool visible = !contents_view_->IsStateActive(AppListModel::STATE_START) || | 181 bool visible = !contents_view_->IsStateActive(AppListModel::STATE_START); |
182 contents_view_->IsShowingSearchResults(); | |
183 search_box_view_->SetVisible(visible); | 182 search_box_view_->SetVisible(visible); |
184 if (visible && GetWidget() && GetWidget()->IsVisible()) | 183 if (visible && GetWidget() && GetWidget()->IsVisible()) |
185 search_box_view_->search_box()->RequestFocus(); | 184 search_box_view_->search_box()->RequestFocus(); |
186 } | 185 } |
187 | 186 |
188 void AppListMainView::OnStartPageSearchTextfieldChanged( | 187 void AppListMainView::OnStartPageSearchTextfieldChanged( |
189 const base::string16& new_contents) { | 188 const base::string16& new_contents) { |
190 search_box_view_->SetVisible(true); | 189 search_box_view_->SetVisible(true); |
191 search_box_view_->search_box()->SetText(new_contents); | 190 search_box_view_->search_box()->SetText(new_contents); |
192 search_box_view_->search_box()->RequestFocus(); | 191 search_box_view_->search_box()->RequestFocus(); |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 // Resubmit the query via a posted task so that all observers for the | 301 // Resubmit the query via a posted task so that all observers for the |
303 // uninstall notification are notified. | 302 // uninstall notification are notified. |
304 base::MessageLoop::current()->PostTask( | 303 base::MessageLoop::current()->PostTask( |
305 FROM_HERE, | 304 FROM_HERE, |
306 base::Bind(&AppListMainView::QueryChanged, | 305 base::Bind(&AppListMainView::QueryChanged, |
307 weak_ptr_factory_.GetWeakPtr(), | 306 weak_ptr_factory_.GetWeakPtr(), |
308 search_box_view_)); | 307 search_box_view_)); |
309 } | 308 } |
310 | 309 |
311 } // namespace app_list | 310 } // namespace app_list |
OLD | NEW |