OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2012 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 ASH_TEST_TEST_LAUNCHER_DELEGATE_H_ |
| 6 #define ASH_TEST_TEST_LAUNCHER_DELEGATE_H_ |
| 7 #pragma once |
| 8 |
| 9 #include <map> |
| 10 #include <set> |
| 11 |
| 12 #include "ash/launcher/launcher_delegate.h" |
| 13 #include "base/compiler_specific.h" |
| 14 #include "ui/aura/window_observer.h" |
| 15 |
| 16 namespace ash { |
| 17 |
| 18 class LauncherModel; |
| 19 |
| 20 namespace test { |
| 21 |
| 22 // Test implementation of LauncherDelegate. |
| 23 // Tests may create icons for windows by calling AddLauncherItem |
| 24 class TestLauncherDelegate : public LauncherDelegate, |
| 25 public aura::WindowObserver { |
| 26 public: |
| 27 TestLauncherDelegate(LauncherModel* model); |
| 28 |
| 29 void AddLauncherItem(aura::Window* window); |
| 30 |
| 31 // WindowObserver implementation |
| 32 void OnWillRemoveWindow(aura::Window* window); |
| 33 |
| 34 // LauncherDelegate implementation. |
| 35 virtual void CreateNewTab() OVERRIDE; |
| 36 virtual void CreateNewWindow() OVERRIDE; |
| 37 virtual void ItemClicked(const LauncherItem& item) OVERRIDE; |
| 38 virtual int GetBrowserShortcutResourceId() OVERRIDE; |
| 39 virtual string16 GetTitle(const LauncherItem& item) OVERRIDE; |
| 40 virtual ui::MenuModel* CreateContextMenu(const LauncherItem& item) OVERRIDE; |
| 41 virtual ui::MenuModel* CreateContextMenuForLauncher() OVERRIDE; |
| 42 virtual ash::LauncherID GetIDByWindow(aura::Window* window) OVERRIDE; |
| 43 |
| 44 private: |
| 45 typedef std::map<aura::Window*, ash::LauncherID> WindowToID; |
| 46 typedef std::set<aura::Window*> ObservedWindows; |
| 47 |
| 48 aura::Window* GetWindowByID(ash::LauncherID id); |
| 49 |
| 50 LauncherModel* model_; |
| 51 |
| 52 // Maps from window to the id we gave it. |
| 53 WindowToID window_to_id_; |
| 54 |
| 55 // Parent windows we are watching. |
| 56 ObservedWindows observed_windows_; |
| 57 |
| 58 DISALLOW_COPY_AND_ASSIGN(TestLauncherDelegate); |
| 59 }; |
| 60 |
| 61 } // namespace test |
| 62 } // namespace ash |
| 63 |
| 64 #endif // ASH_TEST_TEST_LAUNCHER_DELEGATE |
OLD | NEW |