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
3 // found in the LICENSE file.
5 #ifndef ATHENA_HOME_HOME_CARD_IMPL_H_
6 #define ATHENA_HOME_HOME_CARD_IMPL_H_
8 #include "athena/athena_export.h"
9 #include "athena/home/home_card_gesture_manager.h"
10 #include "athena/home/public/home_card.h"
11 #include "athena/home/public/search_controller_factory.h"
12 #include "athena/input/public/accelerator_manager.h"
13 #include "athena/wm/public/window_manager_observer.h"
14 #include "base/gtest_prod_util.h"
15 #include "ui/app_list/app_list_model_observer.h"
18 class AppListViewDelegate
;
38 class AppModelBuilder
;
39 class HomeCardLayoutManager
;
42 class ATHENA_EXPORT HomeCardImpl
: public HomeCard
,
43 public AcceleratorHandler
,
44 public HomeCardGestureManager::Delegate
,
45 public WindowManagerObserver
,
46 public app_list::AppListModelObserver
{
48 HomeCardImpl(scoped_ptr
<AppModelBuilder
> model_builder
,
49 scoped_ptr
<SearchControllerFactory
> search_factory
);
50 ~HomeCardImpl() override
;
54 aura::Window
* GetHomeCardWindowForTest() const;
57 FRIEND_TEST_ALL_PREFIXES(HomeCardTest
, AppListStates
);
60 COMMAND_SHOW_HOME_CARD
,
62 void InstallAccelerators();
66 // Overridden from HomeCard:
67 void SetState(HomeCard::State state
) override
;
68 State
GetState() override
;
69 void UpdateVirtualKeyboardBounds(const gfx::Rect
& bounds
) override
;
71 // AcceleratorHandler:
72 bool IsCommandEnabled(int command_id
) const override
;
73 bool OnAcceleratorFired(int command_id
,
74 const ui::Accelerator
& accelerator
) override
;
76 // HomeCardGestureManager::Delegate:
77 void OnGestureEnded(HomeCard::State final_state
, bool is_fling
) override
;
78 void OnGestureProgressed(HomeCard::State from_state
,
79 HomeCard::State to_state
,
80 float progress
) override
;
82 // WindowManagerObserver:
83 void OnOverviewModeEnter() override
;
84 void OnOverviewModeExit() override
;
85 void OnSplitViewModeEnter() override
;
86 void OnSplitViewModeExit() override
;
88 // app_list::AppListModelObserver:
89 void OnAppListModelStateChanged(
90 app_list::AppListModel::State old_state
,
91 app_list::AppListModel::State new_state
) override
;
93 scoped_ptr
<AppModelBuilder
> model_builder_
;
94 scoped_ptr
<SearchControllerFactory
> search_factory_
;
96 HomeCard::State state_
;
98 // original_state_ is the state which the home card should go back to after
99 // the virtual keyboard is hidden.
100 HomeCard::State original_state_
;
102 views::Widget
* home_card_widget_
;
103 HomeCardView
* home_card_view_
;
104 scoped_ptr
<app_list::AppListViewDelegate
> view_delegate_
;
105 HomeCardLayoutManager
* layout_manager_
;
107 DISALLOW_COPY_AND_ASSIGN(HomeCardImpl
);
110 } // namespace athena
112 #endif // ATHENA_HOME_HOME_CARD_IMPL_H_