Chromium Code Reviews| 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_view.h" | 5 #include "athena/home/home_card_view.h" |
| 6 | 6 |
| 7 #include "athena/home/home_card_constants.h" | 7 #include "athena/home/home_card_constants.h" |
| 8 #include "athena/util/athena_constants.h" | |
| 8 #include "athena/wm/public/window_manager.h" | 9 #include "athena/wm/public/window_manager.h" |
| 9 #include "ui/app_list/app_list_view_delegate.h" | 10 #include "ui/app_list/app_list_view_delegate.h" |
| 10 #include "ui/app_list/views/app_list_main_view.h" | 11 #include "ui/app_list/views/app_list_main_view.h" |
| 11 #include "ui/app_list/views/contents_view.h" | 12 #include "ui/app_list/views/contents_view.h" |
| 12 #include "ui/app_list/views/search_box_view.h" | 13 #include "ui/app_list/views/search_box_view.h" |
| 13 #include "ui/aura/window.h" | 14 #include "ui/aura/window.h" |
| 14 #include "ui/compositor/closure_animation_observer.h" | 15 #include "ui/compositor/closure_animation_observer.h" |
| 15 #include "ui/compositor/scoped_layer_animation_settings.h" | 16 #include "ui/compositor/scoped_layer_animation_settings.h" |
| 16 #include "ui/views/background.h" | 17 #include "ui/views/background.h" |
| 17 #include "ui/views/focus/focus_manager.h" | 18 #include "ui/views/focus/focus_manager.h" |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 226 search_box_view_->GetHeightForWidth(main_bounds.width())); | 227 search_box_view_->GetHeightForWidth(main_bounds.width())); |
| 227 search_box_view_->SetBoundsRect(main_bounds); | 228 search_box_view_->SetBoundsRect(main_bounds); |
| 228 } | 229 } |
| 229 | 230 |
| 230 gfx::Rect HomeCardView::GetDragIndicatorBounds(HomeCard::State state) { | 231 gfx::Rect HomeCardView::GetDragIndicatorBounds(HomeCard::State state) { |
| 231 gfx::Rect drag_indicator_bounds( | 232 gfx::Rect drag_indicator_bounds( |
| 232 GetContentsBounds().CenterPoint().x() - kHomeCardDragIndicatorWidth / 2, | 233 GetContentsBounds().CenterPoint().x() - kHomeCardDragIndicatorWidth / 2, |
| 233 kHomeCardDragIndicatorMarginHeight, kHomeCardDragIndicatorWidth, | 234 kHomeCardDragIndicatorMarginHeight, kHomeCardDragIndicatorWidth, |
| 234 kHomeCardDragIndicatorHeight); | 235 kHomeCardDragIndicatorHeight); |
| 235 if (state == HomeCard::VISIBLE_CENTERED) | 236 if (state == HomeCard::VISIBLE_CENTERED) |
| 236 drag_indicator_bounds.Offset(0, kSystemUIHeight); | 237 drag_indicator_bounds.Offset(0, kSystemUIHeight); |
|
oshima
2014/11/12 20:35:02
This is ok for now, but we probably should update
| |
| 237 return drag_indicator_bounds; | 238 return drag_indicator_bounds; |
| 238 } | 239 } |
| 239 | 240 |
| 240 gfx::Rect HomeCardView::GetMainViewBounds(HomeCard::State state) { | 241 gfx::Rect HomeCardView::GetMainViewBounds(HomeCard::State state) { |
| 241 const gfx::Rect contents_bounds = GetContentsBounds(); | 242 const gfx::Rect contents_bounds = GetContentsBounds(); |
| 242 const int main_width = main_view_->GetPreferredSize().width(); | 243 const int main_width = main_view_->GetPreferredSize().width(); |
| 243 gfx::Rect main_bounds( | 244 gfx::Rect main_bounds( |
| 244 contents_bounds.CenterPoint().x() - main_width / 2, | 245 contents_bounds.CenterPoint().x() - main_width / 2, |
| 245 GetDragIndicatorBounds(state).bottom() + kIndicatorOffset, main_width, | 246 GetDragIndicatorBounds(state).bottom() + kIndicatorOffset, main_width, |
| 246 contents_bounds.height()); | 247 contents_bounds.height()); |
| 247 // This is a bit hacky but slightly shifting up the main_view to fit | 248 // This is a bit hacky but slightly shifting up the main_view to fit |
| 248 // the search box and app icons in the home card. | 249 // the search box and app icons in the home card. |
| 249 if (state != HomeCard::VISIBLE_CENTERED) | 250 if (state != HomeCard::VISIBLE_CENTERED) |
| 250 main_bounds.set_y(kAppListOffset); | 251 main_bounds.set_y(kAppListOffset); |
| 251 return main_bounds; | 252 return main_bounds; |
| 252 } | 253 } |
| 253 | 254 |
| 254 void HomeCardView::UpdateMinimizedBackgroundVisibility() { | 255 void HomeCardView::UpdateMinimizedBackgroundVisibility() { |
| 255 minimized_background_->SetVisible( | 256 minimized_background_->SetVisible( |
| 256 minimized_background_->layer()->GetTargetOpacity() != 0.0f); | 257 minimized_background_->layer()->GetTargetOpacity() != 0.0f); |
| 257 } | 258 } |
| 258 | 259 |
| 259 views::View* HomeCardView::GetContentsView() { | 260 views::View* HomeCardView::GetContentsView() { |
| 260 return this; | 261 return this; |
| 261 } | 262 } |
| 262 | 263 |
| 263 } // namespace athena | 264 } // namespace athena |
| OLD | NEW |