OLD | NEW |
(Empty) | |
| 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. |
| 4 |
| 5 #ifndef ATHENA_HOME_HOME_CARD_IMPL_H_ |
| 6 #define ATHENA_HOME_HOME_CARD_IMPL_H_ |
| 7 |
| 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/input/public/accelerator_manager.h" |
| 12 #include "athena/wm/public/window_manager_observer.h" |
| 13 #include "ui/wm/public/activation_change_observer.h" |
| 14 |
| 15 namespace app_list { |
| 16 class SearchProvider; |
| 17 } |
| 18 |
| 19 namespace aura { |
| 20 class Window; |
| 21 |
| 22 namespace client { |
| 23 class ActivationClient; |
| 24 } |
| 25 } |
| 26 |
| 27 namespace gfx { |
| 28 class Rect; |
| 29 } |
| 30 |
| 31 namespace ui { |
| 32 class LayerOwner; |
| 33 } |
| 34 |
| 35 namespace views { |
| 36 class Widget; |
| 37 } |
| 38 |
| 39 namespace athena { |
| 40 class AppModelBuilder; |
| 41 class AppListViewDelegate; |
| 42 class HomeCardLayoutManager; |
| 43 class HomeCardView; |
| 44 |
| 45 class ATHENA_EXPORT HomeCardImpl |
| 46 : public HomeCard, |
| 47 public AcceleratorHandler, |
| 48 public HomeCardGestureManager::Delegate, |
| 49 public WindowManagerObserver, |
| 50 public aura::client::ActivationChangeObserver { |
| 51 public: |
| 52 explicit HomeCardImpl(AppModelBuilder* model_builder); |
| 53 virtual ~HomeCardImpl(); |
| 54 |
| 55 void Init(); |
| 56 |
| 57 aura::Window* GetHomeCardWindowForTest() const; |
| 58 |
| 59 private: |
| 60 enum Command { |
| 61 COMMAND_SHOW_HOME_CARD, |
| 62 }; |
| 63 void InstallAccelerators(); |
| 64 |
| 65 // Overridden from HomeCard: |
| 66 virtual void SetState(HomeCard::State state) OVERRIDE; |
| 67 virtual State GetState() OVERRIDE; |
| 68 virtual void RegisterSearchProvider( |
| 69 app_list::SearchProvider* search_provider) OVERRIDE; |
| 70 virtual void UpdateVirtualKeyboardBounds( |
| 71 const gfx::Rect& bounds) OVERRIDE; |
| 72 |
| 73 // AcceleratorHandler: |
| 74 virtual bool IsCommandEnabled(int command_id) const OVERRIDE; |
| 75 virtual bool OnAcceleratorFired(int command_id, |
| 76 const ui::Accelerator& accelerator) OVERRIDE; |
| 77 |
| 78 // HomeCardGestureManager::Delegate: |
| 79 virtual void OnGestureEnded(HomeCard::State final_state) OVERRIDE; |
| 80 virtual void OnGestureProgressed( |
| 81 HomeCard::State from_state, |
| 82 HomeCard::State to_state, |
| 83 float progress) OVERRIDE; |
| 84 |
| 85 // WindowManagerObserver: |
| 86 virtual void OnOverviewModeEnter() OVERRIDE; |
| 87 virtual void OnOverviewModeExit() OVERRIDE; |
| 88 virtual void OnActivityOrderHasChanged() OVERRIDE; |
| 89 |
| 90 // aura::client::ActivationChangeObserver: |
| 91 virtual void OnWindowActivated(aura::Window* gained_active, |
| 92 aura::Window* lost_active) OVERRIDE; |
| 93 |
| 94 scoped_ptr<AppModelBuilder> model_builder_; |
| 95 |
| 96 HomeCard::State state_; |
| 97 |
| 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_; |
| 101 |
| 102 views::Widget* home_card_widget_; |
| 103 HomeCardView* home_card_view_; |
| 104 scoped_ptr<AppListViewDelegate> view_delegate_; |
| 105 HomeCardLayoutManager* layout_manager_; |
| 106 aura::client::ActivationClient* activation_client_; // Not owned |
| 107 scoped_ptr<ui::LayerOwner> minimized_home_; |
| 108 |
| 109 // Right now HomeCard allows only one search provider. |
| 110 // TODO(mukai): port app-list's SearchController and Mixer. |
| 111 scoped_ptr<app_list::SearchProvider> search_provider_; |
| 112 |
| 113 DISALLOW_COPY_AND_ASSIGN(HomeCardImpl); |
| 114 }; |
| 115 |
| 116 } // namespace athena |
| 117 |
| 118 #endif // ATHENA_HOME_HOME_CARD_IMPL_H_ |
OLD | NEW |