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

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

Issue 947903002: Change ContentsView::SetActivePage to use States rather than indexes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more_rebase Created 5 years, 9 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
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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 if (icon_loading_wait_timer_.IsRunning()) 137 if (icon_loading_wait_timer_.IsRunning())
138 return; 138 return;
139 139
140 icon_loading_wait_timer_.Start( 140 icon_loading_wait_timer_.Start(
141 FROM_HERE, 141 FROM_HERE,
142 base::TimeDelta::FromMilliseconds(kMaxIconLoadingWaitTimeInMs), 142 base::TimeDelta::FromMilliseconds(kMaxIconLoadingWaitTimeInMs),
143 this, &AppListMainView::OnIconLoadingWaitTimer); 143 this, &AppListMainView::OnIconLoadingWaitTimer);
144 } 144 }
145 145
146 void AppListMainView::ResetForShow() { 146 void AppListMainView::ResetForShow() {
147 if (switches::IsExperimentalAppListEnabled()) { 147 if (switches::IsExperimentalAppListEnabled())
148 contents_view_->SetActivePage( 148 contents_view_->SetActiveState(AppListModel::STATE_START);
149 contents_view_->GetPageIndexForState(AppListModel::STATE_START)); 149
150 }
151 contents_view_->apps_container_view()->ResetForShowApps(); 150 contents_view_->apps_container_view()->ResetForShowApps();
152 // We clear the search when hiding so when app list appears it is not showing 151 // We clear the search when hiding so when app list appears it is not showing
153 // search results. 152 // search results.
154 search_box_view_->ClearSearch(); 153 search_box_view_->ClearSearch();
155 } 154 }
156 155
157 void AppListMainView::Close() { 156 void AppListMainView::Close() {
158 icon_loading_wait_timer_.Stop(); 157 icon_loading_wait_timer_.Stop();
159 contents_view_->CancelDrag(); 158 contents_view_->CancelDrag();
160 } 159 }
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 if (!custom_page) 254 if (!custom_page)
256 return; 255 return;
257 256
258 if (ShouldShowCustomLauncherPage()) { 257 if (ShouldShowCustomLauncherPage()) {
259 // Make the custom page view visible again. 258 // Make the custom page view visible again.
260 custom_page->SetVisible(true); 259 custom_page->SetVisible(true);
261 } else if (contents_view_->IsStateActive( 260 } else if (contents_view_->IsStateActive(
262 AppListModel::STATE_CUSTOM_LAUNCHER_PAGE)) { 261 AppListModel::STATE_CUSTOM_LAUNCHER_PAGE)) {
263 // Animate to the start page if currently on the custom page view. The view 262 // Animate to the start page if currently on the custom page view. The view
264 // will hide on animation completion. 263 // will hide on animation completion.
265 contents_view_->SetActivePage( 264 contents_view_->SetActiveState(AppListModel::STATE_START);
266 contents_view_->GetPageIndexForState(AppListModel::STATE_START));
267 } else { 265 } else {
268 // Hide the view immediately otherwise. 266 // Hide the view immediately otherwise.
269 custom_page->SetVisible(false); 267 custom_page->SetVisible(false);
270 } 268 }
271 } 269 }
272 270
273 void AppListMainView::OnCustomLauncherPageEnabledStateChanged(bool enabled) { 271 void AppListMainView::OnCustomLauncherPageEnabledStateChanged(bool enabled) {
274 UpdateCustomLauncherPageVisibility(); 272 UpdateCustomLauncherPageVisibility();
275 } 273 }
276 274
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 contents_view_->search_results_page_view()->SetSelection(select); 321 contents_view_->search_results_page_view()->SetSelection(select);
324 } 322 }
325 323
326 void AppListMainView::OnResultInstalled(SearchResult* result) { 324 void AppListMainView::OnResultInstalled(SearchResult* result) {
327 // Clears the search to show the apps grid. The last installed app 325 // Clears the search to show the apps grid. The last installed app
328 // should be highlighted and made visible already. 326 // should be highlighted and made visible already.
329 search_box_view_->ClearSearch(); 327 search_box_view_->ClearSearch();
330 } 328 }
331 329
332 } // namespace app_list 330 } // namespace app_list
OLDNEW
« no previous file with comments | « ui/app_list/views/all_apps_tile_item_view.cc ('k') | ui/app_list/views/app_list_main_view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698