OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/app_list/pagination_model.h" | 5 #include "ui/app_list/pagination_model.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 | 50 |
51 const std::string& selected_pages() const { return selected_pages_; } | 51 const std::string& selected_pages() const { return selected_pages_; } |
52 int selection_count() const { return selection_count_; } | 52 int selection_count() const { return selection_count_; } |
53 int transition_start_count() const { return transition_start_count_; } | 53 int transition_start_count() const { return transition_start_count_; } |
54 int transition_end_count() const { return transition_end_count_; } | 54 int transition_end_count() const { return transition_end_count_; } |
55 | 55 |
56 private: | 56 private: |
57 void AppendSelectedPage(int page) { | 57 void AppendSelectedPage(int page) { |
58 if (selected_pages_.length()) | 58 if (selected_pages_.length()) |
59 selected_pages_.append(std::string(" ")); | 59 selected_pages_.append(std::string(" ")); |
60 selected_pages_.append(StringPrintf("%d", page)); | 60 selected_pages_.append(base::StringPrintf("%d", page)); |
61 } | 61 } |
62 | 62 |
63 // PaginationModelObserver overrides: | 63 // PaginationModelObserver overrides: |
64 virtual void TotalPagesChanged() OVERRIDE {} | 64 virtual void TotalPagesChanged() OVERRIDE {} |
65 virtual void SelectedPageChanged(int old_selected, | 65 virtual void SelectedPageChanged(int old_selected, |
66 int new_selected) OVERRIDE { | 66 int new_selected) OVERRIDE { |
67 AppendSelectedPage(new_selected); | 67 AppendSelectedPage(new_selected); |
68 ++selection_count_; | 68 ++selection_count_; |
69 if (expected_page_selection_ && | 69 if (expected_page_selection_ && |
70 selection_count_ == expected_page_selection_) { | 70 selection_count_ == expected_page_selection_) { |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 EXPECT_EQ(1, pagination_.selected_page()); | 421 EXPECT_EQ(1, pagination_.selected_page()); |
422 | 422 |
423 // But if the currently selected_page exceeds the total number of pages, | 423 // But if the currently selected_page exceeds the total number of pages, |
424 // it automatically switches to the last page. | 424 // it automatically switches to the last page. |
425 pagination_.SetTotalPages(1); | 425 pagination_.SetTotalPages(1); |
426 EXPECT_EQ(0, pagination_.selected_page()); | 426 EXPECT_EQ(0, pagination_.selected_page()); |
427 } | 427 } |
428 | 428 |
429 } // namespace test | 429 } // namespace test |
430 } // namespace app_list | 430 } // namespace app_list |
OLD | NEW |