| 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_COMMON_TEST_TEST_SHELF_DELEGATE_H_ | 5 #ifndef ASH_COMMON_TEST_TEST_SHELF_DELEGATE_H_ |
| 6 #define ASH_COMMON_TEST_TEST_SHELF_DELEGATE_H_ | 6 #define ASH_COMMON_TEST_TEST_SHELF_DELEGATE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "ash/common/shelf/shelf_delegate.h" | 12 #include "ash/common/shelf/shelf_delegate.h" |
| 13 #include "ash/common/wm_window_observer.h" | 13 #include "ash/common/wm_window_observer.h" |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 | 15 |
| 16 namespace ash { | 16 namespace ash { |
| 17 namespace test { |
| 17 | 18 |
| 18 class ShelfModel; | 19 class ShelfInitializer; |
| 19 | |
| 20 namespace test { | |
| 21 | 20 |
| 22 // Test implementation of ShelfDelegate. | 21 // Test implementation of ShelfDelegate. |
| 23 // Tests may create icons for windows by calling AddShelfItem(). | 22 // Tests may create icons for windows by calling AddShelfItem(). |
| 24 class TestShelfDelegate : public ShelfDelegate, public WmWindowObserver { | 23 class TestShelfDelegate : public ShelfDelegate, public WmWindowObserver { |
| 25 public: | 24 public: |
| 26 explicit TestShelfDelegate(ShelfModel* model); | 25 TestShelfDelegate(); |
| 27 ~TestShelfDelegate() override; | 26 ~TestShelfDelegate() override; |
| 28 | 27 |
| 29 // Adds a ShelfItem for the given |window|. The ShelfItem's status will be | 28 // Adds a ShelfItem for the given |window|. The ShelfItem's status will be |
| 30 // STATUS_CLOSED. | 29 // STATUS_CLOSED. |
| 31 void AddShelfItem(WmWindow* window); | 30 void AddShelfItem(WmWindow* window); |
| 32 | 31 |
| 33 // Adds a ShelfItem for the given |window| and adds a mapping from the added | 32 // Adds a ShelfItem for the given |window| and adds a mapping from the added |
| 34 // ShelfItem's ShelfID to the given |app_id|. The ShelfItem's status will be | 33 // ShelfItem's ShelfID to the given |app_id|. The ShelfItem's status will be |
| 35 // STATUS_CLOSED. | 34 // STATUS_CLOSED. |
| 36 void AddShelfItem(WmWindow* window, const std::string& app_id); | 35 void AddShelfItem(WmWindow* window, const std::string& app_id); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 62 | 61 |
| 63 private: | 62 private: |
| 64 // Adds a mapping from a ShelfID to an app id. | 63 // Adds a mapping from a ShelfID to an app id. |
| 65 void AddShelfIDToAppIDMapping(ShelfID shelf_id, const std::string& app_id); | 64 void AddShelfIDToAppIDMapping(ShelfID shelf_id, const std::string& app_id); |
| 66 | 65 |
| 67 // Removes the mapping from a ShelfID to an app id. | 66 // Removes the mapping from a ShelfID to an app id. |
| 68 void RemoveShelfIDToAppIDMapping(ShelfID shelf_id); | 67 void RemoveShelfIDToAppIDMapping(ShelfID shelf_id); |
| 69 | 68 |
| 70 static TestShelfDelegate* instance_; | 69 static TestShelfDelegate* instance_; |
| 71 | 70 |
| 72 ShelfModel* model_; | 71 std::unique_ptr<ShelfInitializer> shelf_initializer_; |
| 73 | 72 |
| 74 std::set<std::string> pinned_apps_; | 73 std::set<std::string> pinned_apps_; |
| 75 | 74 |
| 76 // Tracks the ShelfID to app id mappings. | 75 // Tracks the ShelfID to app id mappings. |
| 77 std::map<ShelfID, std::string> shelf_id_to_app_id_map_; | 76 std::map<ShelfID, std::string> shelf_id_to_app_id_map_; |
| 78 | 77 |
| 79 DISALLOW_COPY_AND_ASSIGN(TestShelfDelegate); | 78 DISALLOW_COPY_AND_ASSIGN(TestShelfDelegate); |
| 80 }; | 79 }; |
| 81 | 80 |
| 82 } // namespace test | 81 } // namespace test |
| 83 } // namespace ash | 82 } // namespace ash |
| 84 | 83 |
| 85 #endif // ASH_COMMON_TEST_TEST_SHELF_DELEGATE_H_ | 84 #endif // ASH_COMMON_TEST_TEST_SHELF_DELEGATE_H_ |
| OLD | NEW |