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 | |
sky
2012/04/13 17:32:15
nit: no newlines between override lines.
| |
39 virtual int GetBrowserShortcutResourceId() OVERRIDE; | |
40 | |
41 virtual string16 GetTitle(const LauncherItem& item) OVERRIDE; | |
42 | |
43 virtual ui::MenuModel* CreateContextMenu(const LauncherItem& item) OVERRIDE; | |
44 | |
45 virtual ui::MenuModel* CreateContextMenuForLauncher() OVERRIDE; | |
46 | |
47 virtual ash::LauncherID GetIDByWindow(aura::Window* window) OVERRIDE; | |
48 | |
49 private: | |
50 aura::Window* GetWindowByID(ash::LauncherID id); | |
51 | |
52 LauncherModel* model_; | |
53 | |
54 typedef std::map<aura::Window*, ash::LauncherID> WindowToID; | |
sky
2012/04/13 17:32:15
typedefs should be before methods (style guide has
| |
55 typedef std::set<aura::Window*> ObservedWindows; | |
56 | |
57 // Maps from window to the id we gave it. | |
58 WindowToID window_to_id_; | |
59 | |
60 // Parent windows we are watching. | |
61 ObservedWindows observed_windows_; | |
62 | |
63 DISALLOW_COPY_AND_ASSIGN(TestLauncherDelegate); | |
64 }; | |
65 | |
66 } // namespace test | |
67 } // namespace ash | |
68 | |
69 #endif // ASH_TEST_TEST_LAUNCHER_DELEGATE | |
OLD | NEW |