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 #include "ash/test/test_shelf_delegate.h" | 5 #include "ash/test/test_shelf_delegate.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "ash/common/shelf/shelf_item_delegate_manager.h" | 9 #include "ash/common/shelf/shelf_item_delegate_manager.h" |
10 #include "ash/common/shelf/shelf_model.h" | 10 #include "ash/common/shelf/shelf_model.h" |
11 #include "ash/shelf/shelf_util.h" | 11 #include "ash/shelf/shelf_util.h" |
12 #include "ash/shell.h" | 12 #include "ash/shell.h" |
13 #include "ash/test/test_shelf_item_delegate.h" | 13 #include "ash/test/test_shelf_item_delegate.h" |
14 #include "base/strings/string_util.h" | 14 #include "base/strings/string_util.h" |
15 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
16 #include "ui/aura/window.h" | 16 #include "ui/aura/window.h" |
17 | 17 |
18 namespace ash { | 18 namespace ash { |
19 namespace test { | 19 namespace test { |
20 | 20 |
21 TestShelfDelegate* TestShelfDelegate::instance_ = NULL; | 21 TestShelfDelegate* TestShelfDelegate::instance_ = NULL; |
22 | 22 |
23 TestShelfDelegate::TestShelfDelegate(ShelfModel* model) | 23 TestShelfDelegate::TestShelfDelegate(ShelfModel* model) : model_(model) { |
24 : model_(model) { | |
25 CHECK(!instance_); | 24 CHECK(!instance_); |
26 instance_ = this; | 25 instance_ = this; |
27 } | 26 } |
28 | 27 |
29 TestShelfDelegate::~TestShelfDelegate() { | 28 TestShelfDelegate::~TestShelfDelegate() { |
30 instance_ = NULL; | 29 instance_ = NULL; |
31 } | 30 } |
32 | 31 |
33 void TestShelfDelegate::AddShelfItem(aura::Window* window) { | 32 void TestShelfDelegate::AddShelfItem(aura::Window* window) { |
34 AddShelfItem(window, STATUS_CLOSED); | 33 AddShelfItem(window, STATUS_CLOSED); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 if (HasShelfIDToAppIDMapping(shelf_id)) | 75 if (HasShelfIDToAppIDMapping(shelf_id)) |
77 RemoveShelfIDToAppIDMapping(shelf_id); | 76 RemoveShelfIDToAppIDMapping(shelf_id); |
78 } | 77 } |
79 } | 78 } |
80 | 79 |
81 void TestShelfDelegate::OnWindowDestroying(aura::Window* window) { | 80 void TestShelfDelegate::OnWindowDestroying(aura::Window* window) { |
82 RemoveShelfItemForWindow(window); | 81 RemoveShelfItemForWindow(window); |
83 } | 82 } |
84 | 83 |
85 void TestShelfDelegate::OnWindowHierarchyChanging( | 84 void TestShelfDelegate::OnWindowHierarchyChanging( |
86 const HierarchyChangeParams& params) { | 85 const HierarchyChangeParams& params) { |
87 // The window may be legitimately reparented while staying open if it moves | 86 // The window may be legitimately reparented while staying open if it moves |
88 // to another display or container. If the window does not have a new parent | 87 // to another display or container. If the window does not have a new parent |
89 // then remove the shelf item. | 88 // then remove the shelf item. |
90 if (!params.new_parent) | 89 if (!params.new_parent) |
91 RemoveShelfItemForWindow(params.target); | 90 RemoveShelfItemForWindow(params.target); |
92 } | 91 } |
93 | 92 |
94 void TestShelfDelegate::OnShelfCreated(Shelf* shelf) {} | 93 void TestShelfDelegate::OnShelfCreated(Shelf* shelf) {} |
95 | 94 |
96 void TestShelfDelegate::OnShelfDestroyed(Shelf* shelf) {} | 95 void TestShelfDelegate::OnShelfDestroyed(Shelf* shelf) {} |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 const std::string& app_id) { | 135 const std::string& app_id) { |
137 shelf_id_to_app_id_map_[shelf_id] = app_id; | 136 shelf_id_to_app_id_map_[shelf_id] = app_id; |
138 } | 137 } |
139 | 138 |
140 void TestShelfDelegate::RemoveShelfIDToAppIDMapping(ShelfID shelf_id) { | 139 void TestShelfDelegate::RemoveShelfIDToAppIDMapping(ShelfID shelf_id) { |
141 shelf_id_to_app_id_map_.erase(shelf_id); | 140 shelf_id_to_app_id_map_.erase(shelf_id); |
142 } | 141 } |
143 | 142 |
144 } // namespace test | 143 } // namespace test |
145 } // namespace ash | 144 } // namespace ash |
OLD | NEW |