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

Side by Side Diff: athena/home/home_card_impl.cc

Issue 668443002: Changes HomeCard to fullscreen from bottom when typing a query. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git/+/master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « athena/home/athena_start_page_view_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "athena/home/home_card_impl.h" 5 #include "athena/home/home_card_impl.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <limits> 8 #include <limits>
9 9
10 #include "athena/env/public/athena_env.h" 10 #include "athena/env/public/athena_env.h"
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 SetChildBoundsDirect(child, requested_bounds); 130 SetChildBoundsDirect(child, requested_bounds);
131 } 131 }
132 132
133 aura::Window* home_card_; 133 aura::Window* home_card_;
134 ui::Layer* minimized_layer_; 134 ui::Layer* minimized_layer_;
135 135
136 DISALLOW_COPY_AND_ASSIGN(HomeCardLayoutManager); 136 DISALLOW_COPY_AND_ASSIGN(HomeCardLayoutManager);
137 }; 137 };
138 138
139 // The container view of home card contents of each state. 139 // The container view of home card contents of each state.
140 class HomeCardView : public views::WidgetDelegateView { 140 class HomeCardView : public views::WidgetDelegateView,
141 public AthenaStartPageView::Observer {
141 public: 142 public:
142 HomeCardView(app_list::AppListViewDelegate* view_delegate, 143 HomeCardView(app_list::AppListViewDelegate* view_delegate,
143 aura::Window* container, 144 aura::Window* container,
144 HomeCardGestureManager::Delegate* gesture_delegate) 145 HomeCardGestureManager::Delegate* gesture_delegate)
145 : gesture_delegate_(gesture_delegate) { 146 : gesture_delegate_(gesture_delegate) {
146 SetLayoutManager(new views::FillLayout()); 147 SetLayoutManager(new views::FillLayout());
147 // Ideally AppListMainView should be used here and have AthenaStartPageView 148 // Ideally AppListMainView should be used here and have AthenaStartPageView
148 // as its child view, so that custom pages and apps grid are available in 149 // as its child view, so that custom pages and apps grid are available in
149 // the home card. 150 // the home card.
150 // TODO(mukai): make it so after the detailed UI has been fixed. 151 // TODO(mukai): make it so after the detailed UI has been fixed.
151 main_view_ = new AthenaStartPageView(view_delegate); 152 main_view_ = new AthenaStartPageView(view_delegate);
153 main_view_->AddObserver(this);
152 AddChildView(main_view_); 154 AddChildView(main_view_);
153 } 155 }
154 156
157 virtual ~HomeCardView() { main_view_->RemoveObserver(this); }
158
155 void SetStateProgress(HomeCard::State from_state, 159 void SetStateProgress(HomeCard::State from_state,
156 HomeCard::State to_state, 160 HomeCard::State to_state,
157 float progress) { 161 float progress) {
158 // TODO(mukai): not clear the focus, but simply close the virtual keyboard. 162 // TODO(mukai): not clear the focus, but simply close the virtual keyboard.
159 GetFocusManager()->ClearFocus(); 163 GetFocusManager()->ClearFocus();
160 if (from_state == HomeCard::VISIBLE_CENTERED) 164 if (from_state == HomeCard::VISIBLE_CENTERED)
161 main_view_->SetLayoutState(1.0f - progress); 165 main_view_->SetLayoutState(1.0f - progress);
162 else if (to_state == HomeCard::VISIBLE_CENTERED) 166 else if (to_state == HomeCard::VISIBLE_CENTERED)
163 main_view_->SetLayoutState(progress); 167 main_view_->SetLayoutState(progress);
164 UpdateShadow(true); 168 UpdateShadow(true);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 wm::SetShadowType( 210 wm::SetShadowType(
207 GetWidget()->GetNativeWindow(), 211 GetWidget()->GetNativeWindow(),
208 should_show ? wm::SHADOW_TYPE_RECTANGULAR : wm::SHADOW_TYPE_NONE); 212 should_show ? wm::SHADOW_TYPE_RECTANGULAR : wm::SHADOW_TYPE_NONE);
209 } 213 }
210 214
211 // views::WidgetDelegate: 215 // views::WidgetDelegate:
212 virtual views::View* GetContentsView() override { 216 virtual views::View* GetContentsView() override {
213 return this; 217 return this;
214 } 218 }
215 219
220 // AthenaStartPageView::Observer:
221 virtual void OnLayoutStateChanged(float new_state) override {
222 if (new_state == 1.0f)
223 HomeCard::Get()->SetState(HomeCard::VISIBLE_CENTERED);
224 }
225
216 AthenaStartPageView* main_view_; 226 AthenaStartPageView* main_view_;
217 scoped_ptr<HomeCardGestureManager> gesture_manager_; 227 scoped_ptr<HomeCardGestureManager> gesture_manager_;
218 HomeCardGestureManager::Delegate* gesture_delegate_; 228 HomeCardGestureManager::Delegate* gesture_delegate_;
219 229
220 DISALLOW_COPY_AND_ASSIGN(HomeCardView); 230 DISALLOW_COPY_AND_ASSIGN(HomeCardView);
221 }; 231 };
222 232
223 HomeCardImpl::HomeCardImpl(scoped_ptr<AppModelBuilder> model_builder, 233 HomeCardImpl::HomeCardImpl(scoped_ptr<AppModelBuilder> model_builder,
224 scoped_ptr<SearchControllerFactory> search_factory) 234 scoped_ptr<SearchControllerFactory> search_factory)
225 : model_builder_(model_builder.Pass()), 235 : model_builder_(model_builder.Pass()),
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 instance = NULL; 442 instance = NULL;
433 } 443 }
434 444
435 // static 445 // static
436 HomeCard* HomeCard::Get() { 446 HomeCard* HomeCard::Get() {
437 DCHECK(instance); 447 DCHECK(instance);
438 return instance; 448 return instance;
439 } 449 }
440 450
441 } // namespace athena 451 } // namespace athena
OLDNEW
« no previous file with comments | « athena/home/athena_start_page_view_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698