Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(242)

Side by Side Diff: ui/app_list/views/app_list_main_view.cc

Issue 439703002: Allow app list tiles to show search results in the experimental app list. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 contents_view_->InitNamedPages(model_, delegate_); 144 contents_view_->InitNamedPages(model_, delegate_);
145 AddChildView(contents_view_); 145 AddChildView(contents_view_);
146 if (contents_switcher_view_) 146 if (contents_switcher_view_)
147 AddChildView(contents_switcher_view_); 147 AddChildView(contents_switcher_view_);
148 148
149 search_box_view_->set_contents_view(contents_view_); 149 search_box_view_->set_contents_view(contents_view_);
150 150
151 contents_view_->SetPaintToLayer(true); 151 contents_view_->SetPaintToLayer(true);
152 contents_view_->SetFillsBoundsOpaquely(false); 152 contents_view_->SetFillsBoundsOpaquely(false);
153 contents_view_->layer()->SetMasksToBounds(true); 153 contents_view_->layer()->SetMasksToBounds(true);
154
155 delegate_->StartSearch();
154 } 156 }
155 157
156 AppListMainView::~AppListMainView() { 158 AppListMainView::~AppListMainView() {
157 pending_icon_loaders_.clear(); 159 pending_icon_loaders_.clear();
158 } 160 }
159 161
160 void AppListMainView::ShowAppListWhenReady() { 162 void AppListMainView::ShowAppListWhenReady() {
161 if (pending_icon_loaders_.empty()) { 163 if (pending_icon_loaders_.empty()) {
162 icon_loading_wait_timer_.Stop(); 164 icon_loading_wait_timer_.Stop();
163 GetWidget()->Show(); 165 GetWidget()->Show();
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 delegate_->GetShortcutPathForApp(app_id, callback); 304 delegate_->GetShortcutPathForApp(app_id, callback);
303 } 305 }
304 306
305 void AppListMainView::QueryChanged(SearchBoxView* sender) { 307 void AppListMainView::QueryChanged(SearchBoxView* sender) {
306 base::string16 query; 308 base::string16 query;
307 base::TrimWhitespace(model_->search_box()->text(), base::TRIM_ALL, &query); 309 base::TrimWhitespace(model_->search_box()->text(), base::TRIM_ALL, &query);
308 bool should_show_search = !query.empty(); 310 bool should_show_search = !query.empty();
309 contents_view_->ShowSearchResults(should_show_search); 311 contents_view_->ShowSearchResults(should_show_search);
310 UpdateSearchBoxVisibility(); 312 UpdateSearchBoxVisibility();
311 313
312 if (should_show_search) 314 delegate_->StartSearch();
313 delegate_->StartSearch();
314 else
315 delegate_->StopSearch();
316 } 315 }
317 316
318 void AppListMainView::OnResultInstalled(SearchResult* result) { 317 void AppListMainView::OnResultInstalled(SearchResult* result) {
319 // Clears the search to show the apps grid. The last installed app 318 // Clears the search to show the apps grid. The last installed app
320 // should be highlighted and made visible already. 319 // should be highlighted and made visible already.
321 search_box_view_->ClearSearch(); 320 search_box_view_->ClearSearch();
322 } 321 }
323 322
324 void AppListMainView::OnResultUninstalled(SearchResult* result) { 323 void AppListMainView::OnResultUninstalled(SearchResult* result) {
325 // Resubmit the query via a posted task so that all observers for the 324 // Resubmit the query via a posted task so that all observers for the
326 // uninstall notification are notified. 325 // uninstall notification are notified.
327 base::MessageLoop::current()->PostTask( 326 base::MessageLoop::current()->PostTask(
328 FROM_HERE, 327 FROM_HERE,
329 base::Bind(&AppListMainView::QueryChanged, 328 base::Bind(&AppListMainView::QueryChanged,
330 weak_ptr_factory_.GetWeakPtr(), 329 weak_ptr_factory_.GetWeakPtr(),
331 search_box_view_)); 330 search_box_view_));
332 } 331 }
333 332
334 } // namespace app_list 333 } // namespace app_list
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698