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

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

Issue 336313010: App List: Refactor ContentsSwitcherView so it doesn't hard-code pages. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 // Switch the apps grid view to the specified page. 102 // Switch the apps grid view to the specified page.
103 app_list::PaginationModel* pagination_model = GetAppsPaginationModel(); 103 app_list::PaginationModel* pagination_model = GetAppsPaginationModel();
104 if (pagination_model->is_valid_page(initial_apps_page)) 104 if (pagination_model->is_valid_page(initial_apps_page))
105 pagination_model->SelectPage(initial_apps_page, false); 105 pagination_model->SelectPage(initial_apps_page, false);
106 106
107 // Starts icon loading early. 107 // Starts icon loading early.
108 PreloadIcons(parent); 108 PreloadIcons(parent);
109 } 109 }
110 110
111 void AppListMainView::AddContentsView() { 111 void AppListMainView::AddContentsView() {
112 contents_view_ = new ContentsView(this, model_, delegate_); 112 if (app_list::switches::IsExperimentalAppListEnabled())
113 contents_switcher_view_ = new ContentsSwitcherView();
114 contents_view_ =
115 new ContentsView(this, contents_switcher_view_, model_, delegate_);
calamity 2014/06/18 05:22:29 I think ContentsSwitcherView should take ContentsV
Matt Giuca 2014/06/18 06:47:02 Done. Good suggestion.
113 DCHECK_EQ(1, child_count()); 116 DCHECK_EQ(1, child_count());
114 AddChildView(contents_view_); 117 AddChildView(contents_view_);
115 if (app_list::switches::IsExperimentalAppListEnabled()) { 118 if (contents_switcher_view_) {
116 contents_switcher_view_ = new ContentsSwitcherView(contents_view_); 119 contents_switcher_view_->Init(contents_view_);
117 AddChildView(contents_switcher_view_); 120 AddChildView(contents_switcher_view_);
118 } 121 }
119 122
120 search_box_view_->set_contents_view(contents_view_); 123 search_box_view_->set_contents_view(contents_view_);
121 124
122 contents_view_->SetPaintToLayer(true); 125 contents_view_->SetPaintToLayer(true);
123 contents_view_->SetFillsBoundsOpaquely(false); 126 contents_view_->SetFillsBoundsOpaquely(false);
124 contents_view_->layer()->SetMasksToBounds(true); 127 contents_view_->layer()->SetMasksToBounds(true);
125 } 128 }
126 129
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 // Resubmit the query via a posted task so that all observers for the 293 // Resubmit the query via a posted task so that all observers for the
291 // uninstall notification are notified. 294 // uninstall notification are notified.
292 base::MessageLoop::current()->PostTask( 295 base::MessageLoop::current()->PostTask(
293 FROM_HERE, 296 FROM_HERE,
294 base::Bind(&AppListMainView::QueryChanged, 297 base::Bind(&AppListMainView::QueryChanged,
295 weak_ptr_factory_.GetWeakPtr(), 298 weak_ptr_factory_.GetWeakPtr(),
296 search_box_view_)); 299 search_box_view_));
297 } 300 }
298 301
299 } // namespace app_list 302 } // namespace app_list
OLDNEW
« no previous file with comments | « no previous file | ui/app_list/views/contents_switcher_view.h » ('j') | ui/app_list/views/contents_switcher_view.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698