blob: 0f7b330503c2ee757deeff28f1da714c9cdb445f [file] [log] [blame]
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "athena/athena_export.h"
#include "athena/home/home_card_gesture_manager.h"
#include "athena/home/public/home_card.h"
#include "athena/input/public/accelerator_manager.h"
#include "athena/wm/public/window_manager_observer.h"
#include "ui/wm/public/activation_change_observer.h"
namespace app_list {
class SearchProvider;
namespace aura {
class Window;
namespace client {
class ActivationClient;
namespace gfx {
class Rect;
namespace ui {
class LayerOwner;
namespace views {
class Widget;
namespace athena {
class AppModelBuilder;
class AppListViewDelegate;
class HomeCardLayoutManager;
class HomeCardView;
class ATHENA_EXPORT HomeCardImpl
: public HomeCard,
public AcceleratorHandler,
public HomeCardGestureManager::Delegate,
public WindowManagerObserver,
public aura::client::ActivationChangeObserver {
explicit HomeCardImpl(AppModelBuilder* model_builder);
virtual ~HomeCardImpl();
void Init();
aura::Window* GetHomeCardWindowForTest() const;
enum Command {
void InstallAccelerators();
// Overridden from HomeCard:
virtual void SetState(HomeCard::State state) override;
virtual State GetState() override;
virtual void RegisterSearchProvider(
app_list::SearchProvider* search_provider) override;
virtual void UpdateVirtualKeyboardBounds(
const gfx::Rect& bounds) override;
// AcceleratorHandler:
virtual bool IsCommandEnabled(int command_id) const override;
virtual bool OnAcceleratorFired(int command_id,
const ui::Accelerator& accelerator) override;
// HomeCardGestureManager::Delegate:
virtual void OnGestureEnded(HomeCard::State final_state,
bool is_fling) override;
virtual void OnGestureProgressed(
HomeCard::State from_state,
HomeCard::State to_state,
float progress) override;
// WindowManagerObserver:
virtual void OnOverviewModeEnter() override;
virtual void OnOverviewModeExit() override;
virtual void OnSplitViewModeEnter() override;
virtual void OnSplitViewModeExit() override;
// aura::client::ActivationChangeObserver:
virtual void OnWindowActivated(aura::Window* gained_active,
aura::Window* lost_active) override;
scoped_ptr<AppModelBuilder> model_builder_;
HomeCard::State state_;
// original_state_ is the state which the home card should go back to after
// the virtual keyboard is hidden.
HomeCard::State original_state_;
views::Widget* home_card_widget_;
HomeCardView* home_card_view_;
scoped_ptr<AppListViewDelegate> view_delegate_;
HomeCardLayoutManager* layout_manager_;
aura::client::ActivationClient* activation_client_; // Not owned
scoped_ptr<ui::LayerOwner> minimized_home_;
// Right now HomeCard allows only one search provider.
// TODO(mukai): port app-list's SearchController and Mixer.
scoped_ptr<app_list::SearchProvider> search_provider_;
} // namespace athena