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/shelf/shelf_item_delegate_manager.h" | 9 #include "ash/shelf/shelf_item_delegate_manager.h" |
10 #include "ash/shelf/shelf_model.h" | 10 #include "ash/shelf/shelf_model.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 else | 48 else |
49 item.type = TYPE_PLATFORM_APP; | 49 item.type = TYPE_PLATFORM_APP; |
50 ShelfID id = model_->next_id(); | 50 ShelfID id = model_->next_id(); |
51 item.status = status; | 51 item.status = status; |
52 model_->Add(item); | 52 model_->Add(item); |
53 window->AddObserver(this); | 53 window->AddObserver(this); |
54 | 54 |
55 ShelfItemDelegateManager* manager = | 55 ShelfItemDelegateManager* manager = |
56 Shell::GetInstance()->shelf_item_delegate_manager(); | 56 Shell::GetInstance()->shelf_item_delegate_manager(); |
57 // |manager| owns TestShelfItemDelegate. | 57 // |manager| owns TestShelfItemDelegate. |
58 scoped_ptr<ShelfItemDelegate> delegate(new TestShelfItemDelegate(window)); | 58 std::unique_ptr<ShelfItemDelegate> delegate( |
| 59 new TestShelfItemDelegate(window)); |
59 manager->SetShelfItemDelegate(id, std::move(delegate)); | 60 manager->SetShelfItemDelegate(id, std::move(delegate)); |
60 SetShelfIDForWindow(id, window); | 61 SetShelfIDForWindow(id, window); |
61 } | 62 } |
62 | 63 |
63 void TestShelfDelegate::RemoveShelfItemForWindow(aura::Window* window) { | 64 void TestShelfDelegate::RemoveShelfItemForWindow(aura::Window* window) { |
64 ShelfID shelf_id = GetShelfIDForWindow(window); | 65 ShelfID shelf_id = GetShelfIDForWindow(window); |
65 if (shelf_id == 0) | 66 if (shelf_id == 0) |
66 return; | 67 return; |
67 int index = model_->ItemIndexByID(shelf_id); | 68 int index = model_->ItemIndexByID(shelf_id); |
68 DCHECK_NE(-1, index); | 69 DCHECK_NE(-1, index); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 const std::string& app_id) { | 132 const std::string& app_id) { |
132 shelf_id_to_app_id_map_[shelf_id] = app_id; | 133 shelf_id_to_app_id_map_[shelf_id] = app_id; |
133 } | 134 } |
134 | 135 |
135 void TestShelfDelegate::RemoveShelfIDToAppIDMapping(ShelfID shelf_id) { | 136 void TestShelfDelegate::RemoveShelfIDToAppIDMapping(ShelfID shelf_id) { |
136 shelf_id_to_app_id_map_.erase(shelf_id); | 137 shelf_id_to_app_id_map_.erase(shelf_id); |
137 } | 138 } |
138 | 139 |
139 } // namespace test | 140 } // namespace test |
140 } // namespace ash | 141 } // namespace ash |
OLD | NEW |