| OLD | NEW |
| 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/common/container_priorities.h" | 10 #include "athena/common/container_priorities.h" |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 // the home card. | 150 // the home card. |
| 151 // 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. |
| 152 main_view_ = new AthenaStartPageView(view_delegate); | 152 main_view_ = new AthenaStartPageView(view_delegate); |
| 153 AddChildView(main_view_); | 153 AddChildView(main_view_); |
| 154 } | 154 } |
| 155 | 155 |
| 156 void SetStateProgress(HomeCard::State from_state, | 156 void SetStateProgress(HomeCard::State from_state, |
| 157 HomeCard::State to_state, | 157 HomeCard::State to_state, |
| 158 float progress) { | 158 float progress) { |
| 159 // TODO(mukai): not clear the focus, but simply close the virtual keyboard. | 159 // TODO(mukai): not clear the focus, but simply close the virtual keyboard. |
| 160 if (from_state != HomeCard::VISIBLE_CENTERED || | 160 GetFocusManager()->ClearFocus(); |
| 161 to_state != HomeCard::VISIBLE_CENTERED) { | |
| 162 GetFocusManager()->ClearFocus(); | |
| 163 } | |
| 164 if (from_state == HomeCard::VISIBLE_CENTERED) | 161 if (from_state == HomeCard::VISIBLE_CENTERED) |
| 165 main_view_->SetLayoutState(1.0f - progress); | 162 main_view_->SetLayoutState(1.0f - progress); |
| 166 else if (to_state == HomeCard::VISIBLE_CENTERED) | 163 else if (to_state == HomeCard::VISIBLE_CENTERED) |
| 167 main_view_->SetLayoutState(progress); | 164 main_view_->SetLayoutState(progress); |
| 168 UpdateShadow(true); | 165 UpdateShadow(true); |
| 169 } | 166 } |
| 170 | 167 |
| 171 void SetStateWithAnimation(HomeCard::State state) { | 168 void SetStateWithAnimation(HomeCard::State state) { |
| 172 UpdateShadow(state != HomeCard::VISIBLE_MINIMIZED); | 169 UpdateShadow(state != HomeCard::VISIBLE_MINIMIZED); |
| 173 if (state == HomeCard::VISIBLE_CENTERED) | 170 if (state == HomeCard::VISIBLE_CENTERED) |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 instance = NULL; | 443 instance = NULL; |
| 447 } | 444 } |
| 448 | 445 |
| 449 // static | 446 // static |
| 450 HomeCard* HomeCard::Get() { | 447 HomeCard* HomeCard::Get() { |
| 451 DCHECK(instance); | 448 DCHECK(instance); |
| 452 return instance; | 449 return instance; |
| 453 } | 450 } |
| 454 | 451 |
| 455 } // namespace athena | 452 } // namespace athena |
| OLD | NEW |