| Index: athena/wm/window_manager_impl.cc
|
| diff --git a/athena/wm/window_manager_impl.cc b/athena/wm/window_manager_impl.cc
|
| index 37e7dcee736519c054e369e4ee286096a19ae6ca..93a7ef8650bdfc54e0cededeb20b0fbcf496574a 100644
|
| --- a/athena/wm/window_manager_impl.cc
|
| +++ b/athena/wm/window_manager_impl.cc
|
| @@ -28,67 +28,29 @@ class WindowManagerImpl : public WindowManager,
|
| void Layout();
|
|
|
| // WindowManager:
|
| - virtual void ToggleOverview() OVERRIDE {
|
| - if (overview_) {
|
| - overview_.reset();
|
| - FOR_EACH_OBSERVER(WindowManagerObserver, observers_,
|
| - OnOverviewModeExit());
|
| - } else {
|
| - overview_ = WindowOverviewMode::Create(container_.get(), this);
|
| - FOR_EACH_OBSERVER(WindowManagerObserver, observers_,
|
| - OnOverviewModeEnter());
|
| - }
|
| - }
|
| + virtual void ToggleOverview() OVERRIDE;
|
|
|
| private:
|
| enum Command {
|
| COMMAND_TOGGLE_OVERVIEW,
|
| };
|
|
|
| - void InstallAccelerators() {
|
| - const AcceleratorData accelerator_data[] = {
|
| - {TRIGGER_ON_PRESS, ui::VKEY_F6, ui::EF_NONE, COMMAND_TOGGLE_OVERVIEW,
|
| - AF_NONE},
|
| - };
|
| - AcceleratorManager::Get()->RegisterAccelerators(
|
| - accelerator_data, arraysize(accelerator_data), this);
|
| - }
|
| + void InstallAccelerators();
|
|
|
| // WindowManager:
|
| - virtual void AddObserver(WindowManagerObserver* observer) OVERRIDE {
|
| - observers_.AddObserver(observer);
|
| - }
|
| -
|
| - virtual void RemoveObserver(WindowManagerObserver* observer) OVERRIDE {
|
| - observers_.RemoveObserver(observer);
|
| - }
|
| + virtual void AddObserver(WindowManagerObserver* observer) OVERRIDE;
|
| + virtual void RemoveObserver(WindowManagerObserver* observer) OVERRIDE;
|
|
|
| // WindowOverviewModeDelegate:
|
| - virtual void OnSelectWindow(aura::Window* window) OVERRIDE {
|
| - CHECK_EQ(container_.get(), window->parent());
|
| - container_->StackChildAtTop(window);
|
| - overview_.reset();
|
| - FOR_EACH_OBSERVER(WindowManagerObserver, observers_,
|
| - OnOverviewModeExit());
|
| - }
|
| + virtual void OnSelectWindow(aura::Window* window) OVERRIDE;
|
|
|
| // aura::WindowObserver
|
| - virtual void OnWindowDestroying(aura::Window* window) OVERRIDE {
|
| - if (window == container_)
|
| - container_.reset();
|
| - }
|
| + virtual void OnWindowDestroying(aura::Window* window) OVERRIDE;
|
|
|
| // AcceleratorHandler:
|
| - virtual bool IsCommandEnabled(int command_id) const OVERRIDE { return true; }
|
| + virtual bool IsCommandEnabled(int command_id) const OVERRIDE;
|
| virtual bool OnAcceleratorFired(int command_id,
|
| - const ui::Accelerator& accelerator) OVERRIDE {
|
| - switch (command_id) {
|
| - case COMMAND_TOGGLE_OVERVIEW:
|
| - ToggleOverview();
|
| - break;
|
| - }
|
| - return true;
|
| - }
|
| + const ui::Accelerator& accelerator) OVERRIDE;
|
|
|
| scoped_ptr<aura::Window> container_;
|
| scoped_ptr<WindowOverviewMode> overview_;
|
| @@ -158,6 +120,62 @@ void WindowManagerImpl::Layout() {
|
| }
|
| }
|
|
|
| +void WindowManagerImpl::ToggleOverview() {
|
| + if (overview_) {
|
| + overview_.reset();
|
| + FOR_EACH_OBSERVER(WindowManagerObserver, observers_,
|
| + OnOverviewModeExit());
|
| + } else {
|
| + overview_ = WindowOverviewMode::Create(container_.get(), this);
|
| + FOR_EACH_OBSERVER(WindowManagerObserver, observers_,
|
| + OnOverviewModeEnter());
|
| + }
|
| +}
|
| +
|
| +void WindowManagerImpl::InstallAccelerators() {
|
| + const AcceleratorData accelerator_data[] = {
|
| + {TRIGGER_ON_PRESS, ui::VKEY_F6, ui::EF_NONE, COMMAND_TOGGLE_OVERVIEW,
|
| + AF_NONE},
|
| + };
|
| + AcceleratorManager::Get()->RegisterAccelerators(
|
| + accelerator_data, arraysize(accelerator_data), this);
|
| +}
|
| +
|
| +void WindowManagerImpl::AddObserver(WindowManagerObserver* observer) {
|
| + observers_.AddObserver(observer);
|
| +}
|
| +
|
| +void WindowManagerImpl::RemoveObserver(WindowManagerObserver* observer) {
|
| + observers_.RemoveObserver(observer);
|
| +}
|
| +
|
| +void WindowManagerImpl::OnSelectWindow(aura::Window* window) {
|
| + CHECK_EQ(container_.get(), window->parent());
|
| + container_->StackChildAtTop(window);
|
| + overview_.reset();
|
| + FOR_EACH_OBSERVER(WindowManagerObserver, observers_,
|
| + OnOverviewModeExit());
|
| +}
|
| +
|
| +void WindowManagerImpl::OnWindowDestroying(aura::Window* window) {
|
| + if (window == container_)
|
| + container_.reset();
|
| +}
|
| +
|
| +bool WindowManagerImpl::IsCommandEnabled(int command_id) const {
|
| + return true;
|
| +}
|
| +
|
| +bool WindowManagerImpl::OnAcceleratorFired(int command_id,
|
| + const ui::Accelerator& accelerator) {
|
| + switch (command_id) {
|
| + case COMMAND_TOGGLE_OVERVIEW:
|
| + ToggleOverview();
|
| + break;
|
| + }
|
| + return true;
|
| +}
|
| +
|
| } // namespace
|
|
|
| // static
|
|
|