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

Side by Side Diff: athena/home/athena_start_page_view.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.h ('k') | athena/home/athena_start_page_view_unittest.cc » ('j') | 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/athena_start_page_view.h" 5 #include "athena/home/athena_start_page_view.h"
6 6
7 #include "athena/home/home_card_constants.h" 7 #include "athena/home/home_card_constants.h"
8 #include "athena/system/public/system_ui.h" 8 #include "athena/system/public/system_ui.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 237
238 AthenaStartPageView::~AthenaStartPageView() {} 238 AthenaStartPageView::~AthenaStartPageView() {}
239 239
240 void AthenaStartPageView::RequestFocusOnSearchBox() { 240 void AthenaStartPageView::RequestFocusOnSearchBox() {
241 search_box_view_->search_box()->RequestFocus(); 241 search_box_view_->search_box()->RequestFocus();
242 } 242 }
243 243
244 void AthenaStartPageView::SetLayoutState(float layout_state) { 244 void AthenaStartPageView::SetLayoutState(float layout_state) {
245 layout_state_ = layout_state; 245 layout_state_ = layout_state;
246 Layout(); 246 Layout();
247 FOR_EACH_OBSERVER(Observer, observers_, OnLayoutStateChanged(layout_state));
247 } 248 }
248 249
249 void AthenaStartPageView::SetLayoutStateWithAnimation( 250 void AthenaStartPageView::SetLayoutStateWithAnimation(
250 float layout_state, 251 float layout_state,
251 gfx::Tween::Type tween_type) { 252 gfx::Tween::Type tween_type) {
252 ui::ScopedLayerAnimationSettings system_info( 253 ui::ScopedLayerAnimationSettings system_info(
253 system_info_view_->layer()->GetAnimator()); 254 system_info_view_->layer()->GetAnimator());
254 ui::ScopedLayerAnimationSettings logo(logo_->layer()->GetAnimator()); 255 ui::ScopedLayerAnimationSettings logo(logo_->layer()->GetAnimator());
255 ui::ScopedLayerAnimationSettings search_box( 256 ui::ScopedLayerAnimationSettings search_box(
256 search_box_container_->layer()->GetAnimator()); 257 search_box_container_->layer()->GetAnimator());
257 ui::ScopedLayerAnimationSettings icons( 258 ui::ScopedLayerAnimationSettings icons(
258 app_icon_container_->layer()->GetAnimator()); 259 app_icon_container_->layer()->GetAnimator());
259 ui::ScopedLayerAnimationSettings controls( 260 ui::ScopedLayerAnimationSettings controls(
260 control_icon_container_->layer()->GetAnimator()); 261 control_icon_container_->layer()->GetAnimator());
261 262
262 system_info.SetTweenType(tween_type); 263 system_info.SetTweenType(tween_type);
263 logo.SetTweenType(tween_type); 264 logo.SetTweenType(tween_type);
264 search_box.SetTweenType(tween_type); 265 search_box.SetTweenType(tween_type);
265 icons.SetTweenType(tween_type); 266 icons.SetTweenType(tween_type);
266 controls.SetTweenType(tween_type); 267 controls.SetTweenType(tween_type);
267 268
268 SetLayoutState(layout_state); 269 SetLayoutState(layout_state);
269 } 270 }
270 271
272 void AthenaStartPageView::AddObserver(AthenaStartPageView::Observer* observer) {
273 observers_.AddObserver(observer);
274 }
275
276 void AthenaStartPageView::RemoveObserver(
277 AthenaStartPageView::Observer* observer) {
278 observers_.RemoveObserver(observer);
279 }
280
271 AthenaStartPageView::LayoutData AthenaStartPageView::CreateBottomBounds( 281 AthenaStartPageView::LayoutData AthenaStartPageView::CreateBottomBounds(
272 int width) { 282 int width) {
273 LayoutData state; 283 LayoutData state;
274 state.icons.set_size(app_icon_container_->size()); 284 state.icons.set_size(app_icon_container_->size());
275 state.icons.set_x(kIconMargin); 285 state.icons.set_x(kIconMargin);
276 state.icons.set_y(kIconMargin); 286 state.icons.set_y(kIconMargin);
277 287
278 state.controls.set_size(control_icon_container_->size()); 288 state.controls.set_size(control_icon_container_->size());
279 state.controls.set_x(width - kIconMargin - state.controls.width()); 289 state.controls.set_x(width - kIconMargin - state.controls.width());
280 state.controls.set_y(kIconMargin); 290 state.controls.set_y(kIconMargin);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 state.logo_opacity = 1.0f; 322 state.logo_opacity = 1.0f;
313 state.background_opacity = 1.0f; 323 state.background_opacity = 1.0f;
314 return state; 324 return state;
315 } 325 }
316 326
317 void AthenaStartPageView::LayoutSearchResults(bool should_show_search_results) { 327 void AthenaStartPageView::LayoutSearchResults(bool should_show_search_results) {
318 if (should_show_search_results == 328 if (should_show_search_results ==
319 search_results_view_->layer()->GetTargetVisibility()) { 329 search_results_view_->layer()->GetTargetVisibility()) {
320 return; 330 return;
321 } 331 }
322 if (GetContentsBounds().height() <= kHomeCardHeight) { 332 if (should_show_search_results && layout_state_ != 1.0f)
323 search_results_view_->SetVisible(false); 333 SetLayoutState(1.0f);
324 Layout();
325 return;
326 }
327 334
328 gfx::Rect search_box_bounds = search_box_container_->bounds(); 335 gfx::Rect search_box_bounds = search_box_container_->bounds();
329 if (!search_results_view_->visible()) { 336 if (!search_results_view_->visible()) {
330 search_results_view_->SetVisible(true); 337 search_results_view_->SetVisible(true);
331 search_results_view_->SetBounds( 338 search_results_view_->SetBounds(
332 search_box_bounds.x(), search_box_bounds.bottom(), 339 search_box_bounds.x(), search_box_bounds.bottom(),
333 search_box_bounds.width(), 0); 340 search_box_bounds.width(), 0);
334 } 341 }
335 logo_->SetVisible(true); 342 logo_->SetVisible(true);
336 343
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 base::TrimWhitespace( 439 base::TrimWhitespace(
433 delegate_->GetModel()->search_box()->text(), base::TRIM_ALL, &query); 440 delegate_->GetModel()->search_box()->text(), base::TRIM_ALL, &query);
434 441
435 if (!query.empty()) 442 if (!query.empty())
436 search_results_view_->SetSelectedIndex(0); 443 search_results_view_->SetSelectedIndex(0);
437 444
438 LayoutSearchResults(!query.empty()); 445 LayoutSearchResults(!query.empty());
439 } 446 }
440 447
441 } // namespace athena 448 } // namespace athena
OLDNEW
« no previous file with comments | « athena/home/athena_start_page_view.h ('k') | athena/home/athena_start_page_view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698