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

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

Issue 2898743002: Draggable peeking/fullscreen launcher with transparent background. (Closed)
Patch Set: adressed comments. Created 3 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
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 25 matching lines...) Expand all
36 #include "ui/views/controls/textfield/textfield.h" 36 #include "ui/views/controls/textfield/textfield.h"
37 #include "ui/views/layout/box_layout.h" 37 #include "ui/views/layout/box_layout.h"
38 #include "ui/views/layout/fill_layout.h" 38 #include "ui/views/layout/fill_layout.h"
39 #include "ui/views/widget/widget.h" 39 #include "ui/views/widget/widget.h"
40 40
41 namespace app_list { 41 namespace app_list {
42 42
43 //////////////////////////////////////////////////////////////////////////////// 43 ////////////////////////////////////////////////////////////////////////////////
44 // AppListMainView: 44 // AppListMainView:
45 45
46 AppListMainView::AppListMainView(AppListViewDelegate* delegate) 46 AppListMainView::AppListMainView(AppListViewDelegate* delegate,
47 AppListView* app_list_view)
47 : delegate_(delegate), 48 : delegate_(delegate),
48 model_(delegate->GetModel()), 49 model_(delegate->GetModel()),
49 search_box_view_(nullptr), 50 search_box_view_(nullptr),
50 contents_view_(nullptr) { 51 contents_view_(nullptr),
52 app_list_view_(app_list_view) {
51 SetLayoutManager( 53 SetLayoutManager(
52 features::IsAnswerCardEnabled() 54 features::IsAnswerCardEnabled()
53 ? static_cast<views::LayoutManager*>(new views::FillLayout) 55 ? static_cast<views::LayoutManager*>(new views::FillLayout)
54 : static_cast<views::LayoutManager*>( 56 : static_cast<views::LayoutManager*>(
55 new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0))); 57 new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0)));
56 model_->AddObserver(this); 58 model_->AddObserver(this);
57 } 59 }
58 60
59 AppListMainView::~AppListMainView() { 61 AppListMainView::~AppListMainView() {
60 model_->RemoveObserver(this); 62 model_->RemoveObserver(this);
61 } 63 }
62 64
63 void AppListMainView::Init(gfx::NativeView parent, 65 void AppListMainView::Init(gfx::NativeView parent,
64 int initial_apps_page, 66 int initial_apps_page,
65 SearchBoxView* search_box_view) { 67 SearchBoxView* search_box_view) {
66 search_box_view_ = search_box_view; 68 search_box_view_ = search_box_view;
67 AddContentsViews(); 69 AddContentsViews();
68 70
69 // Switch the apps grid view to the specified page. 71 // Switch the apps grid view to the specified page.
70 app_list::PaginationModel* pagination_model = GetAppsPaginationModel(); 72 app_list::PaginationModel* pagination_model = GetAppsPaginationModel();
71 if (pagination_model->is_valid_page(initial_apps_page)) 73 if (pagination_model->is_valid_page(initial_apps_page))
72 pagination_model->SelectPage(initial_apps_page, false); 74 pagination_model->SelectPage(initial_apps_page, false);
73 75
74 OnSearchEngineIsGoogleChanged(model_->search_engine_is_google()); 76 OnSearchEngineIsGoogleChanged(model_->search_engine_is_google());
75 } 77 }
76 78
77 void AppListMainView::AddContentsViews() { 79 void AppListMainView::AddContentsViews() {
78 DCHECK(search_box_view_); 80 DCHECK(search_box_view_);
79 81 contents_view_ = new ContentsView(this, app_list_view_);
80 contents_view_ = new ContentsView(this);
81 contents_view_->Init(model_); 82 contents_view_->Init(model_);
82 AddChildView(contents_view_); 83 AddChildView(contents_view_);
83 84
84 search_box_view_->set_contents_view(contents_view_); 85 search_box_view_->set_contents_view(contents_view_);
85 86
86 contents_view_->SetPaintToLayer(); 87 contents_view_->SetPaintToLayer();
87 contents_view_->layer()->SetFillsBoundsOpaquely(false); 88 contents_view_->layer()->SetFillsBoundsOpaquely(false);
88 contents_view_->layer()->SetMasksToBounds(true); 89 contents_view_->layer()->SetMasksToBounds(true);
89 90
90 // Clear the old query and start search. 91 // Clear the old query and start search.
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 contents_view_->search_results_page_view()->SetSelection(select); 214 contents_view_->search_results_page_view()->SetSelection(select);
214 } 215 }
215 216
216 void AppListMainView::OnResultInstalled(SearchResult* result) { 217 void AppListMainView::OnResultInstalled(SearchResult* result) {
217 // Clears the search to show the apps grid. The last installed app 218 // Clears the search to show the apps grid. The last installed app
218 // should be highlighted and made visible already. 219 // should be highlighted and made visible already.
219 search_box_view_->ClearSearch(); 220 search_box_view_->ClearSearch();
220 } 221 }
221 222
222 } // namespace app_list 223 } // namespace app_list
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698