| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef ASH_TEST_TEST_SHELF_DELEGATE_H_ | 5 #ifndef ASH_TEST_TEST_SHELF_DELEGATE_H_ |
| 6 #define ASH_TEST_TEST_SHELF_DELEGATE_H_ | 6 #define ASH_TEST_TEST_SHELF_DELEGATE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| 11 #include "ash/shelf/shelf_delegate.h" | 11 #include "ash/shelf/shelf_delegate.h" |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "ui/aura/window_observer.h" | 13 #include "ui/aura/window_observer.h" |
| 14 | 14 |
| 15 namespace ash { | 15 namespace ash { |
| 16 | 16 |
| 17 class ShelfModel; | 17 class ShelfModel; |
| 18 | 18 |
| 19 namespace test { | 19 namespace test { |
| 20 | 20 |
| 21 // Test implementation of ShelfDelegate. | 21 // Test implementation of ShelfDelegate. |
| 22 // Tests may create icons for windows by calling AddShelfItem(). | 22 // Tests may create icons for windows by calling AddShelfItem(). |
| 23 class TestShelfDelegate : public ShelfDelegate, public aura::WindowObserver { | 23 class TestShelfDelegate : public ShelfDelegate, public aura::WindowObserver { |
| 24 public: | 24 public: |
| 25 explicit TestShelfDelegate(ShelfModel* model); | 25 explicit TestShelfDelegate(ShelfModel* model); |
| 26 virtual ~TestShelfDelegate(); | 26 ~TestShelfDelegate() override; |
| 27 | 27 |
| 28 void AddShelfItem(aura::Window* window); | 28 void AddShelfItem(aura::Window* window); |
| 29 void AddShelfItem(aura::Window* window, ShelfItemStatus status); | 29 void AddShelfItem(aura::Window* window, ShelfItemStatus status); |
| 30 void RemoveShelfItemForWindow(aura::Window* window); | 30 void RemoveShelfItemForWindow(aura::Window* window); |
| 31 | 31 |
| 32 static TestShelfDelegate* instance() { return instance_; } | 32 static TestShelfDelegate* instance() { return instance_; } |
| 33 | 33 |
| 34 // WindowObserver implementation | 34 // WindowObserver implementation |
| 35 virtual void OnWindowDestroying(aura::Window* window) override; | 35 void OnWindowDestroying(aura::Window* window) override; |
| 36 virtual void OnWindowHierarchyChanging( | 36 void OnWindowHierarchyChanging(const HierarchyChangeParams& params) override; |
| 37 const HierarchyChangeParams& params) override; | |
| 38 | 37 |
| 39 // ShelfDelegate implementation. | 38 // ShelfDelegate implementation. |
| 40 virtual void OnShelfCreated(Shelf* shelf) override; | 39 void OnShelfCreated(Shelf* shelf) override; |
| 41 virtual void OnShelfDestroyed(Shelf* shelf) override; | 40 void OnShelfDestroyed(Shelf* shelf) override; |
| 42 virtual ShelfID GetShelfIDForAppID(const std::string& app_id) override; | 41 ShelfID GetShelfIDForAppID(const std::string& app_id) override; |
| 43 virtual const std::string& GetAppIDForShelfID(ShelfID id) override; | 42 const std::string& GetAppIDForShelfID(ShelfID id) override; |
| 44 virtual void PinAppWithID(const std::string& app_id) override; | 43 void PinAppWithID(const std::string& app_id) override; |
| 45 virtual bool CanPin() const override; | 44 bool CanPin() const override; |
| 46 virtual bool IsAppPinned(const std::string& app_id) override; | 45 bool IsAppPinned(const std::string& app_id) override; |
| 47 virtual void UnpinAppWithID(const std::string& app_id) override; | 46 void UnpinAppWithID(const std::string& app_id) override; |
| 48 | 47 |
| 49 private: | 48 private: |
| 50 static TestShelfDelegate* instance_; | 49 static TestShelfDelegate* instance_; |
| 51 | 50 |
| 52 ShelfModel* model_; | 51 ShelfModel* model_; |
| 53 | 52 |
| 54 DISALLOW_COPY_AND_ASSIGN(TestShelfDelegate); | 53 DISALLOW_COPY_AND_ASSIGN(TestShelfDelegate); |
| 55 }; | 54 }; |
| 56 | 55 |
| 57 } // namespace test | 56 } // namespace test |
| 58 } // namespace ash | 57 } // namespace ash |
| 59 | 58 |
| 60 #endif // ASH_TEST_TEST_SHELF_DELEGATE_H_ | 59 #endif // ASH_TEST_TEST_SHELF_DELEGATE_H_ |
| OLD | NEW |