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

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

Issue 2898743002: Draggable peeking/fullscreen launcher with transparent background. (Closed)
Patch Set: Migrated from wm_shelf to shelf and addressed comments! Created 3 years, 7 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/contents_view.h" 5 #include "ui/app_list/views/contents_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 } 54 }
55 55
56 private: 56 private:
57 views::View* const search_results_page_view_; 57 views::View* const search_results_page_view_;
58 58
59 DISALLOW_COPY_AND_ASSIGN(SearchAnswerContainerView); 59 DISALLOW_COPY_AND_ASSIGN(SearchAnswerContainerView);
60 }; 60 };
61 61
62 } // namespace 62 } // namespace
63 63
64 ContentsView::ContentsView(AppListMainView* app_list_main_view) 64 ContentsView::ContentsView(AppListMainView* app_list_main_view,
65 AppListView* app_list_view)
65 : model_(nullptr), 66 : model_(nullptr),
66 apps_container_view_(nullptr), 67 apps_container_view_(nullptr),
67 search_results_page_view_(nullptr), 68 search_results_page_view_(nullptr),
68 start_page_view_(nullptr), 69 start_page_view_(nullptr),
69 custom_page_view_(nullptr), 70 custom_page_view_(nullptr),
70 search_answer_container_view_(nullptr), 71 search_answer_container_view_(nullptr),
71 app_list_main_view_(app_list_main_view), 72 app_list_main_view_(app_list_main_view),
72 page_before_search_(0) { 73 page_before_search_(0) {
74 app_list_view_ = app_list_view;
73 pagination_model_.SetTransitionDurations(kPageTransitionDurationInMs, 75 pagination_model_.SetTransitionDurations(kPageTransitionDurationInMs,
74 kOverscrollPageTransitionDurationMs); 76 kOverscrollPageTransitionDurationMs);
75 pagination_model_.AddObserver(this); 77 pagination_model_.AddObserver(this);
76 } 78 }
77 79
78 ContentsView::~ContentsView() { 80 ContentsView::~ContentsView() {
79 pagination_model_.RemoveObserver(this); 81 pagination_model_.RemoveObserver(this);
80 if (model_) 82 if (model_)
81 model_->RemoveObserver(this); 83 model_->RemoveObserver(this);
82 } 84 }
83 85
84 void ContentsView::Init(AppListModel* model) { 86 void ContentsView::Init(AppListModel* model) {
85 DCHECK(model); 87 DCHECK(model);
86 model_ = model; 88 model_ = model;
87 89
88 AppListViewDelegate* view_delegate = app_list_main_view_->view_delegate(); 90 AppListViewDelegate* view_delegate = app_list_main_view_->view_delegate();
89 91
90 std::vector<views::View*> custom_page_views = 92 std::vector<views::View*> custom_page_views =
91 view_delegate->CreateCustomPageWebViews(GetLocalBounds().size()); 93 view_delegate->CreateCustomPageWebViews(GetLocalBounds().size());
92 // Only add the first custom page view as STATE_CUSTOM_LAUNCHER_PAGE. Ignore 94 // Only add the first custom page view as STATE_CUSTOM_LAUNCHER_PAGE. Ignore
93 // any subsequent custom pages. 95 // any subsequent custom pages.
94 if (!custom_page_views.empty()) { 96 if (!custom_page_views.empty()) {
95 custom_page_view_ = new CustomLauncherPageView(custom_page_views[0]); 97 custom_page_view_ = new CustomLauncherPageView(custom_page_views[0]);
96 98
97 AddLauncherPage(custom_page_view_, 99 AddLauncherPage(custom_page_view_,
98 AppListModel::STATE_CUSTOM_LAUNCHER_PAGE); 100 AppListModel::STATE_CUSTOM_LAUNCHER_PAGE);
99 } 101 }
100 102
101 // Start page. 103 // Start page.
102 start_page_view_ = new StartPageView(app_list_main_view_, view_delegate); 104 start_page_view_ =
105 new StartPageView(app_list_main_view_, view_delegate, app_list_view_);
103 AddLauncherPage(start_page_view_, AppListModel::STATE_START); 106 AddLauncherPage(start_page_view_, AppListModel::STATE_START);
104 107
105 // Search results UI. 108 // Search results UI.
106 search_results_page_view_ = new SearchResultPageView(); 109 search_results_page_view_ = new SearchResultPageView();
107 110
108 // Search answer container UI. 111 // Search answer container UI.
109 search_answer_container_view_ = 112 search_answer_container_view_ =
110 new SearchAnswerContainerView(search_results_page_view_); 113 new SearchAnswerContainerView(search_results_page_view_);
111 search_answer_container_view_->SetVisible(false); 114 search_answer_container_view_->SetVisible(false);
112 views::View* search_answer_view = view_delegate->GetSearchAnswerWebView(); 115 views::View* search_answer_view = view_delegate->GetSearchAnswerWebView();
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 530
528 void ContentsView::OnSearchAnswerAvailableChanged(bool has_answer) { 531 void ContentsView::OnSearchAnswerAvailableChanged(bool has_answer) {
529 if (has_answer == search_answer_container_view_->visible()) 532 if (has_answer == search_answer_container_view_->visible())
530 return; 533 return;
531 534
532 search_answer_container_view_->SetVisible(has_answer); 535 search_answer_container_view_->SetVisible(has_answer);
533 search_results_page_view_->Layout(); 536 search_results_page_view_->Layout();
534 } 537 }
535 538
536 } // namespace app_list 539 } // namespace app_list
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698