Index: athena/home/home_card_impl.cc |
diff --git a/athena/home/home_card_impl.cc b/athena/home/home_card_impl.cc |
index 2f1dd8ccd463f36b72df4101dfb163b3a0d1fca6..d78cd8b35c02ffecf285291e865dfaf9480a6aa9 100644 |
--- a/athena/home/home_card_impl.cc |
+++ b/athena/home/home_card_impl.cc |
@@ -4,11 +4,12 @@ |
#include "athena/home/public/home_card.h" |
-#include "athena/home/home_card_delegate_view.h" |
+#include "athena/home/app_list_view_delegate.h" |
#include "athena/screen/public/screen_manager.h" |
+#include "ui/app_list/pagination_model.h" |
+#include "ui/app_list/views/app_list_view.h" |
#include "ui/aura/layout_manager.h" |
#include "ui/aura/window.h" |
-#include "ui/views/widget/widget.h" |
#include "ui/wm/core/visibility_controller.h" |
#include "ui/wm/core/window_animations.h" |
@@ -41,8 +42,12 @@ class HomeCardLayoutManager : public aura::LayoutManager { |
} |
void Layout() { |
- const int kHomeCardHeight = 50; |
+ const int kHomeCardHeight = 150; |
const int kHomeCardHorizontalMargin = 50; |
+ // Currently the home card is provided as a bubble and the bounds has to be |
+ // increased to cancel the shadow. |
+ // TODO(mukai): stops using the bubble and remove this. |
+ const int kHomeCardShadowWidth = 30; |
if (container_->children().size() < 1) |
return; |
aura::Window* home_card = container_->children()[0]; |
@@ -54,6 +59,7 @@ class HomeCardLayoutManager : public aura::LayoutManager { |
screen_bounds.height() - kHomeCardHeight, |
kHomeCardHorizontalMargin, |
0); |
+ card_bounds.Inset(-kHomeCardShadowWidth, -kHomeCardShadowWidth); |
SetChildBoundsDirect(home_card, card_bounds); |
} |
@@ -71,11 +77,14 @@ class HomeCardImpl : public HomeCard { |
private: |
views::Widget* home_card_widget_; |
+ scoped_ptr<app_list::PaginationModel> pagination_model_; |
DISALLOW_COPY_AND_ASSIGN(HomeCardImpl); |
}; |
-HomeCardImpl::HomeCardImpl() : home_card_widget_(NULL) { |
+HomeCardImpl::HomeCardImpl() |
+ : home_card_widget_(NULL), |
+ pagination_model_(new app_list::PaginationModel) { |
DCHECK(!instance); |
instance = this; |
} |
@@ -92,23 +101,16 @@ void HomeCardImpl::Init() { |
container->SetLayoutManager(new HomeCardLayoutManager(container)); |
wm::SetChildWindowVisibilityChangesAnimated(container); |
- views::Widget::InitParams params( |
- views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); |
- params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; |
- params.delegate = new HomeCardDelegateView(); |
- params.parent = container; |
- |
- home_card_widget_ = new views::Widget; |
- home_card_widget_->Init(params); |
- home_card_widget_->GetNativeView()->SetName("HomeCardWidget"); |
- |
- aura::Window* home_card_window = home_card_widget_->GetNativeView(); |
- wm::SetWindowVisibilityAnimationType( |
- home_card_window, wm::WINDOW_VISIBILITY_ANIMATION_TYPE_FADE); |
- wm::SetWindowVisibilityAnimationTransition(home_card_window, |
- wm::ANIMATE_BOTH); |
- |
- home_card_widget_->Show(); |
+ app_list::AppListView* view = new app_list::AppListView( |
+ new AppListViewDelegate); |
+ view->InitAsBubbleAtFixedLocation( |
+ container, |
+ pagination_model_.get(), |
xiyuan
2014/06/02 17:24:34
fyi, https://codereview.chromium.org/302803002/ is
Jun Mukai
2014/06/02 17:37:37
Good to know. Then it's better to wait for that la
|
+ gfx::Point(), |
+ views::BubbleBorder::FLOAT, |
+ true /* border_accepts_events */); |
+ home_card_widget_ = view->GetWidget(); |
+ view->ShowWhenReady(); |
} |
} // namespace |