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> |
| 8 |
7 #include "ash/shelf/shelf_item_delegate_manager.h" | 9 #include "ash/shelf/shelf_item_delegate_manager.h" |
8 #include "ash/shelf/shelf_model.h" | 10 #include "ash/shelf/shelf_model.h" |
9 #include "ash/shelf/shelf_util.h" | 11 #include "ash/shelf/shelf_util.h" |
10 #include "ash/shell.h" | 12 #include "ash/shell.h" |
11 #include "ash/test/test_shelf_item_delegate.h" | 13 #include "ash/test/test_shelf_item_delegate.h" |
12 #include "base/strings/string_util.h" | 14 #include "base/strings/string_util.h" |
13 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
14 #include "ui/aura/window.h" | 16 #include "ui/aura/window.h" |
15 | 17 |
16 namespace ash { | 18 namespace ash { |
(...skipping 30 matching lines...) Expand all Loading... |
47 item.type = TYPE_PLATFORM_APP; | 49 item.type = TYPE_PLATFORM_APP; |
48 ShelfID id = model_->next_id(); | 50 ShelfID id = model_->next_id(); |
49 item.status = status; | 51 item.status = status; |
50 model_->Add(item); | 52 model_->Add(item); |
51 window->AddObserver(this); | 53 window->AddObserver(this); |
52 | 54 |
53 ShelfItemDelegateManager* manager = | 55 ShelfItemDelegateManager* manager = |
54 Shell::GetInstance()->shelf_item_delegate_manager(); | 56 Shell::GetInstance()->shelf_item_delegate_manager(); |
55 // |manager| owns TestShelfItemDelegate. | 57 // |manager| owns TestShelfItemDelegate. |
56 scoped_ptr<ShelfItemDelegate> delegate(new TestShelfItemDelegate(window)); | 58 scoped_ptr<ShelfItemDelegate> delegate(new TestShelfItemDelegate(window)); |
57 manager->SetShelfItemDelegate(id, delegate.Pass()); | 59 manager->SetShelfItemDelegate(id, std::move(delegate)); |
58 SetShelfIDForWindow(id, window); | 60 SetShelfIDForWindow(id, window); |
59 } | 61 } |
60 | 62 |
61 void TestShelfDelegate::RemoveShelfItemForWindow(aura::Window* window) { | 63 void TestShelfDelegate::RemoveShelfItemForWindow(aura::Window* window) { |
62 ShelfID shelf_id = GetShelfIDForWindow(window); | 64 ShelfID shelf_id = GetShelfIDForWindow(window); |
63 if (shelf_id == 0) | 65 if (shelf_id == 0) |
64 return; | 66 return; |
65 int index = model_->ItemIndexByID(shelf_id); | 67 int index = model_->ItemIndexByID(shelf_id); |
66 DCHECK_NE(-1, index); | 68 DCHECK_NE(-1, index); |
67 model_->RemoveItemAt(index); | 69 model_->RemoveItemAt(index); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 const std::string& app_id) { | 129 const std::string& app_id) { |
128 shelf_id_to_app_id_map_[shelf_id] = app_id; | 130 shelf_id_to_app_id_map_[shelf_id] = app_id; |
129 } | 131 } |
130 | 132 |
131 void TestShelfDelegate::RemoveShelfIDToAppIDMapping(ShelfID shelf_id) { | 133 void TestShelfDelegate::RemoveShelfIDToAppIDMapping(ShelfID shelf_id) { |
132 shelf_id_to_app_id_map_.erase(shelf_id); | 134 shelf_id_to_app_id_map_.erase(shelf_id); |
133 } | 135 } |
134 | 136 |
135 } // namespace test | 137 } // namespace test |
136 } // namespace ash | 138 } // namespace ash |
OLD | NEW |