| 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/ash_switches.h" | 10 #include "ash/ash_switches.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 std::string result; | 33 std::string result; |
| 34 AddToResult("added=%d", added_count_, &result); | 34 AddToResult("added=%d", added_count_, &result); |
| 35 AddToResult("removed=%d", removed_count_, &result); | 35 AddToResult("removed=%d", removed_count_, &result); |
| 36 AddToResult("changed=%d", changed_count_, &result); | 36 AddToResult("changed=%d", changed_count_, &result); |
| 37 AddToResult("moved=%d", moved_count_, &result); | 37 AddToResult("moved=%d", moved_count_, &result); |
| 38 added_count_ = removed_count_ = changed_count_ = moved_count_ = 0; | 38 added_count_ = removed_count_ = changed_count_ = moved_count_ = 0; |
| 39 return result; | 39 return result; |
| 40 } | 40 } |
| 41 | 41 |
| 42 // ShelfModelObserver overrides: | 42 // ShelfModelObserver overrides: |
| 43 virtual void ShelfItemAdded(int index) OVERRIDE { | 43 virtual void ShelfItemAdded(int index) override { |
| 44 added_count_++; | 44 added_count_++; |
| 45 } | 45 } |
| 46 virtual void ShelfItemRemoved(int index, ShelfID id) OVERRIDE { | 46 virtual void ShelfItemRemoved(int index, ShelfID id) override { |
| 47 removed_count_++; | 47 removed_count_++; |
| 48 } | 48 } |
| 49 virtual void ShelfItemChanged(int index, | 49 virtual void ShelfItemChanged(int index, |
| 50 const ShelfItem& old_item) OVERRIDE { | 50 const ShelfItem& old_item) override { |
| 51 changed_count_++; | 51 changed_count_++; |
| 52 } | 52 } |
| 53 virtual void ShelfItemMoved(int start_index, int target_index) OVERRIDE { | 53 virtual void ShelfItemMoved(int start_index, int target_index) override { |
| 54 moved_count_++; | 54 moved_count_++; |
| 55 } | 55 } |
| 56 virtual void ShelfStatusChanged() OVERRIDE { | 56 virtual void ShelfStatusChanged() override { |
| 57 } | 57 } |
| 58 | 58 |
| 59 private: | 59 private: |
| 60 void AddToResult(const std::string& format, int count, std::string* result) { | 60 void AddToResult(const std::string& format, int count, std::string* result) { |
| 61 if (!count) | 61 if (!count) |
| 62 return; | 62 return; |
| 63 if (!result->empty()) | 63 if (!result->empty()) |
| 64 *result += " "; | 64 *result += " "; |
| 65 *result += base::StringPrintf(format.c_str(), count); | 65 *result += base::StringPrintf(format.c_str(), count); |
| 66 } | 66 } |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 // Now change the type of the second item and make sure that it is moving | 349 // Now change the type of the second item and make sure that it is moving |
| 350 // behind the shortcuts. | 350 // behind the shortcuts. |
| 351 item.type = TYPE_PLATFORM_APP; | 351 item.type = TYPE_PLATFORM_APP; |
| 352 model_->Set(app2_index, item); | 352 model_->Set(app2_index, item); |
| 353 | 353 |
| 354 // The item should have moved in front of the app launcher. | 354 // The item should have moved in front of the app launcher. |
| 355 EXPECT_EQ(TYPE_PLATFORM_APP, model_->items()[4].type); | 355 EXPECT_EQ(TYPE_PLATFORM_APP, model_->items()[4].type); |
| 356 } | 356 } |
| 357 | 357 |
| 358 } // namespace ash | 358 } // namespace ash |
| OLD | NEW |