| 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/common/shelf/shelf_model.h" | 5 #include "ash/common/shelf/shelf_model.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "ash/common/shelf/shelf_model_observer.h" | 10 #include "ash/common/shelf/shelf_model_observer.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 | 38 |
| 39 // ShelfModelObserver overrides: | 39 // ShelfModelObserver overrides: |
| 40 void ShelfItemAdded(int index) override { added_count_++; } | 40 void ShelfItemAdded(int index) override { added_count_++; } |
| 41 void ShelfItemRemoved(int index, ShelfID id) override { removed_count_++; } | 41 void ShelfItemRemoved(int index, ShelfID id) override { removed_count_++; } |
| 42 void ShelfItemChanged(int index, const ShelfItem& old_item) override { | 42 void ShelfItemChanged(int index, const ShelfItem& old_item) override { |
| 43 changed_count_++; | 43 changed_count_++; |
| 44 } | 44 } |
| 45 void ShelfItemMoved(int start_index, int target_index) override { | 45 void ShelfItemMoved(int start_index, int target_index) override { |
| 46 moved_count_++; | 46 moved_count_++; |
| 47 } | 47 } |
| 48 void OnSetShelfItemDelegate(ShelfID id, |
| 49 ShelfItemDelegate* item_delegate) override {} |
| 48 | 50 |
| 49 private: | 51 private: |
| 50 void AddToResult(const std::string& format, int count, std::string* result) { | 52 void AddToResult(const std::string& format, int count, std::string* result) { |
| 51 if (!count) | 53 if (!count) |
| 52 return; | 54 return; |
| 53 if (!result->empty()) | 55 if (!result->empty()) |
| 54 *result += " "; | 56 *result += " "; |
| 55 *result += base::StringPrintf(format.c_str(), count); | 57 *result += base::StringPrintf(format.c_str(), count); |
| 56 } | 58 } |
| 57 | 59 |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 // Now change the type of the second item and make sure that it is moving | 341 // Now change the type of the second item and make sure that it is moving |
| 340 // behind the shortcuts. | 342 // behind the shortcuts. |
| 341 item.type = TYPE_PLATFORM_APP; | 343 item.type = TYPE_PLATFORM_APP; |
| 342 model_->Set(app2_index, item); | 344 model_->Set(app2_index, item); |
| 343 | 345 |
| 344 // The item should have moved in front of the app launcher. | 346 // The item should have moved in front of the app launcher. |
| 345 EXPECT_EQ(TYPE_PLATFORM_APP, model_->items()[4].type); | 347 EXPECT_EQ(TYPE_PLATFORM_APP, model_->items()[4].type); |
| 346 } | 348 } |
| 347 | 349 |
| 348 } // namespace ash | 350 } // namespace ash |
| OLD | NEW |