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 #ifndef UI_APP_LIST_VIEWS_APPS_GRID_VIEW_H_ | 5 #ifndef UI_APP_LIST_VIEWS_APPS_GRID_VIEW_H_ |
6 #define UI_APP_LIST_VIEWS_APPS_GRID_VIEW_H_ | 6 #define UI_APP_LIST_VIEWS_APPS_GRID_VIEW_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
| 10 #include <tuple> |
10 | 11 |
11 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
12 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
13 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
14 #include "base/timer/timer.h" | 15 #include "base/timer/timer.h" |
15 #include "ui/app_list/app_list_export.h" | 16 #include "ui/app_list/app_list_export.h" |
16 #include "ui/app_list/app_list_model.h" | 17 #include "ui/app_list/app_list_model.h" |
17 #include "ui/app_list/app_list_model_observer.h" | 18 #include "ui/app_list/app_list_model_observer.h" |
18 #include "ui/app_list/pagination_model.h" | 19 #include "ui/app_list/pagination_model.h" |
19 #include "ui/app_list/pagination_model_observer.h" | 20 #include "ui/app_list/pagination_model_observer.h" |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 Index() : page(-1), slot(-1) {} | 237 Index() : page(-1), slot(-1) {} |
237 Index(int page, int slot) : page(page), slot(slot) {} | 238 Index(int page, int slot) : page(page), slot(slot) {} |
238 | 239 |
239 bool operator==(const Index& other) const { | 240 bool operator==(const Index& other) const { |
240 return page == other.page && slot == other.slot; | 241 return page == other.page && slot == other.slot; |
241 } | 242 } |
242 bool operator!=(const Index& other) const { | 243 bool operator!=(const Index& other) const { |
243 return page != other.page || slot != other.slot; | 244 return page != other.page || slot != other.slot; |
244 } | 245 } |
245 bool operator<(const Index& other) const { | 246 bool operator<(const Index& other) const { |
246 if (page != other.page) | 247 return std::tie(page, slot) < std::tie(other.page, other.slot); |
247 return page < other.page; | |
248 | |
249 return slot < other.slot; | |
250 } | 248 } |
251 | 249 |
252 int page; // Which page an item view is on. | 250 int page; // Which page an item view is on. |
253 int slot; // Which slot in the page an item view is in. | 251 int slot; // Which slot in the page an item view is in. |
254 }; | 252 }; |
255 | 253 |
256 int tiles_per_page() const { return cols_ * rows_per_page_; } | 254 int tiles_per_page() const { return cols_ * rows_per_page_; } |
257 | 255 |
258 // Updates from model. | 256 // Updates from model. |
259 void Update(); | 257 void Update(); |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
574 | 572 |
575 // True if the drag_view_ item is a folder item being dragged for reparenting. | 573 // True if the drag_view_ item is a folder item being dragged for reparenting. |
576 bool dragging_for_reparent_item_; | 574 bool dragging_for_reparent_item_; |
577 | 575 |
578 DISALLOW_COPY_AND_ASSIGN(AppsGridView); | 576 DISALLOW_COPY_AND_ASSIGN(AppsGridView); |
579 }; | 577 }; |
580 | 578 |
581 } // namespace app_list | 579 } // namespace app_list |
582 | 580 |
583 #endif // UI_APP_LIST_VIEWS_APPS_GRID_VIEW_H_ | 581 #endif // UI_APP_LIST_VIEWS_APPS_GRID_VIEW_H_ |
OLD | NEW |