| 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/shelf/shelf_model.h" | 5 #include "ash/shelf/shelf_model.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "ash/shelf/shelf_model_observer.h" | 10 #include "ash/shelf/shelf_model_observer.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 AddToResult("moved=%d", moved_count_, &result); | 32 AddToResult("moved=%d", moved_count_, &result); |
| 33 added_count_ = removed_count_ = changed_count_ = moved_count_ = 0; | 33 added_count_ = removed_count_ = changed_count_ = moved_count_ = 0; |
| 34 return result; | 34 return result; |
| 35 } | 35 } |
| 36 | 36 |
| 37 // ShelfModelObserver overrides: | 37 // ShelfModelObserver overrides: |
| 38 void ShelfItemAdded(int) override { added_count_++; } | 38 void ShelfItemAdded(int) override { added_count_++; } |
| 39 void ShelfItemRemoved(int, const ShelfItem&) override { removed_count_++; } | 39 void ShelfItemRemoved(int, const ShelfItem&) override { removed_count_++; } |
| 40 void ShelfItemChanged(int, const ShelfItem&) override { changed_count_++; } | 40 void ShelfItemChanged(int, const ShelfItem&) override { changed_count_++; } |
| 41 void ShelfItemMoved(int, int) override { moved_count_++; } | 41 void ShelfItemMoved(int, int) override { moved_count_++; } |
| 42 void ShelfItemDelegateChanged(const ShelfID&, ShelfItemDelegate*) override {} |
| 42 | 43 |
| 43 private: | 44 private: |
| 44 void AddToResult(const std::string& format, int count, std::string* result) { | 45 void AddToResult(const std::string& format, int count, std::string* result) { |
| 45 if (!count) | 46 if (!count) |
| 46 return; | 47 return; |
| 47 if (!result->empty()) | 48 if (!result->empty()) |
| 48 *result += " "; | 49 *result += " "; |
| 49 *result += base::StringPrintf(format.c_str(), count); | 50 *result += base::StringPrintf(format.c_str(), count); |
| 50 } | 51 } |
| 51 | 52 |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 424 | 425 |
| 425 // Unpinning the same app id again should have no change. | 426 // Unpinning the same app id again should have no change. |
| 426 model_->UnpinAppWithID(app_id); | 427 model_->UnpinAppWithID(app_id); |
| 427 EXPECT_FALSE(model_->IsAppPinned(app_id)); | 428 EXPECT_FALSE(model_->IsAppPinned(app_id)); |
| 428 EXPECT_EQ(2, model_->item_count()); | 429 EXPECT_EQ(2, model_->item_count()); |
| 429 EXPECT_EQ(TYPE_APP, model_->items()[index].type); | 430 EXPECT_EQ(TYPE_APP, model_->items()[index].type); |
| 430 EXPECT_EQ(item.id, model_->items()[index].id); | 431 EXPECT_EQ(item.id, model_->items()[index].id); |
| 431 } | 432 } |
| 432 | 433 |
| 433 } // namespace ash | 434 } // namespace ash |
| OLD | NEW |