Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(501)

Side by Side Diff: ash/test/test_shelf_delegate.h

Issue 2825533003: mash: Prerequisites for removing ShelfDelegate. (Closed)
Patch Set: Expand CheckWindowAndItemPlacement comment. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ash/test/ash_test_base.cc ('k') | ash/test/test_shelf_delegate.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <memory>
9 #include <set>
10 #include <string> 8 #include <string>
11 9
12 #include "ash/shelf/shelf_delegate.h" 10 #include "ash/shelf/shelf_delegate.h"
13 #include "base/macros.h" 11 #include "base/macros.h"
14 #include "ui/aura/window_observer.h"
15 12
16 namespace ash { 13 namespace ash {
17
18 class WmWindow;
19
20 namespace test { 14 namespace test {
21 15
22 class ShelfInitializer;
23
24 // Test implementation of ShelfDelegate. 16 // Test implementation of ShelfDelegate.
25 // Tests may create icons for windows by calling AddShelfItem(). 17 class TestShelfDelegate : public ShelfDelegate {
26 class TestShelfDelegate : public ShelfDelegate, public aura::WindowObserver {
27 public: 18 public:
28 TestShelfDelegate(); 19 TestShelfDelegate();
29 ~TestShelfDelegate() override; 20 ~TestShelfDelegate() override;
30 21
31 // Adds a ShelfItem for the given |window|. The ShelfItem's status will be
32 // STATUS_CLOSED.
33 void AddShelfItem(WmWindow* window);
34
35 // Adds a ShelfItem for the given |window| and |app_id|. The ShelfItem's
36 // status will be STATUS_CLOSED.
37 void AddShelfItem(WmWindow* window, const std::string& app_id);
38
39 // Removes the ShelfItem for the specified |window| and unpins it if it was
40 // pinned. The |window|'s ShelfID to app id mapping will be removed if it
41 // exists.
42 void RemoveShelfItemForWindow(WmWindow* window);
43
44 static TestShelfDelegate* instance() { return instance_; } 22 static TestShelfDelegate* instance() { return instance_; }
45 23
46 // WindowObserver implementation
47 void OnWindowDestroying(aura::Window* window) override;
48 void OnWindowHierarchyChanging(const HierarchyChangeParams& params) override;
49
50 // ShelfDelegate implementation. 24 // ShelfDelegate implementation.
51 ShelfID GetShelfIDForAppID(const std::string& app_id) override; 25 ShelfID GetShelfIDForAppID(const std::string& app_id) override;
52 ShelfID GetShelfIDForAppIDAndLaunchID(const std::string& app_id, 26 ShelfID GetShelfIDForAppIDAndLaunchID(const std::string& app_id,
53 const std::string& launch_id) override; 27 const std::string& launch_id) override;
54 const std::string& GetAppIDForShelfID(ShelfID id) override; 28 const std::string& GetAppIDForShelfID(ShelfID id) override;
55 void PinAppWithID(const std::string& app_id) override; 29 void PinAppWithID(const std::string& app_id) override;
56 bool IsAppPinned(const std::string& app_id) override; 30 bool IsAppPinned(const std::string& app_id) override;
57 void UnpinAppWithID(const std::string& app_id) override; 31 void UnpinAppWithID(const std::string& app_id) override;
58 32
59 private: 33 private:
60 static TestShelfDelegate* instance_; 34 static TestShelfDelegate* instance_;
61 35
62 std::unique_ptr<ShelfInitializer> shelf_initializer_;
63
64 std::set<std::string> pinned_apps_;
65
66 DISALLOW_COPY_AND_ASSIGN(TestShelfDelegate); 36 DISALLOW_COPY_AND_ASSIGN(TestShelfDelegate);
67 }; 37 };
68 38
69 } // namespace test 39 } // namespace test
70 } // namespace ash 40 } // namespace ash
71 41
72 #endif // ASH_TEST_TEST_SHELF_DELEGATE_H_ 42 #endif // ASH_TEST_TEST_SHELF_DELEGATE_H_
OLDNEW
« no previous file with comments | « ash/test/ash_test_base.cc ('k') | ash/test/test_shelf_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698