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.
5 #ifndef ASH_TEST_TEST_LAUNCHER_DELEGATE_H_
6 #define ASH_TEST_TEST_LAUNCHER_DELEGATE_H_
11 #include "ash/launcher/launcher_delegate.h"
12 #include "base/compiler_specific.h"
13 #include "ui/aura/window_observer.h"
21 // Test implementation of LauncherDelegate.
22 // Tests may create icons for windows by calling AddLauncherItem
23 class TestLauncherDelegate : public LauncherDelegate,
24 public aura::WindowObserver {
26 explicit TestLauncherDelegate(LauncherModel* model);
27 virtual ~TestLauncherDelegate();
29 void AddLauncherItem(aura::Window* window);
30 void AddLauncherItem(aura::Window* window, LauncherItemStatus status);
31 void RemoveLauncherItemForWindow(aura::Window* window);
33 static TestLauncherDelegate* instance() { return instance_; }
35 // WindowObserver implementation
36 virtual void OnWindowDestroying(aura::Window* window) OVERRIDE;
37 virtual void OnWindowHierarchyChanging(
38 const HierarchyChangeParams& params) OVERRIDE;
40 // LauncherDelegate implementation.
41 virtual ash::LauncherID GetIDByWindow(aura::Window* window) OVERRIDE;
42 virtual void OnLauncherCreated(Launcher* launcher) OVERRIDE;
43 virtual void OnLauncherDestroyed(Launcher* launcher) OVERRIDE;
44 virtual LauncherID GetLauncherIDForAppID(const std::string& app_id) OVERRIDE;
45 virtual const std::string& GetAppIDForLauncherID(LauncherID id) OVERRIDE;
46 virtual void PinAppWithID(const std::string& app_id) OVERRIDE;
47 virtual bool CanPin() const OVERRIDE;
48 virtual bool IsAppPinned(const std::string& app_id) OVERRIDE;
49 virtual void UnpinAppWithID(const std::string& app_id) OVERRIDE;
52 typedef std::map<aura::Window*, ash::LauncherID> WindowToID;
53 typedef std::set<aura::Window*> ObservedWindows;
55 static TestLauncherDelegate* instance_;
57 LauncherModel* model_;
59 // Maps from window to the id we gave it.
60 WindowToID window_to_id_;
62 DISALLOW_COPY_AND_ASSIGN(TestLauncherDelegate);
68 #endif // ASH_TEST_TEST_LAUNCHER_DELEGATE_H_