Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Side by Side Diff: ash/launcher/launcher_model.h

Issue 10827420: Revert 152221 - chromeos: Sync animation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ash/launcher/launcher_button.cc ('k') | ash/launcher/launcher_model.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 ASH_LAUNCHER_LAUNCHER_MODEL_H_ 5 #ifndef ASH_LAUNCHER_LAUNCHER_MODEL_H_
6 #define ASH_LAUNCHER_LAUNCHER_MODEL_H_ 6 #define ASH_LAUNCHER_LAUNCHER_MODEL_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "ash/ash_export.h" 10 #include "ash/ash_export.h"
11 #include "ash/launcher/launcher_types.h" 11 #include "ash/launcher/launcher_types.h"
12 #include "base/observer_list.h" 12 #include "base/observer_list.h"
13 13
14 namespace aura { 14 namespace aura {
15 class Window; 15 class Window;
16 } 16 }
17 17
18 namespace ash { 18 namespace ash {
19 19
20 class LauncherModelObserver; 20 class LauncherModelObserver;
21 21
22 // Model used by LauncherView. 22 // Model used by LauncherView.
23 class ASH_EXPORT LauncherModel { 23 class ASH_EXPORT LauncherModel {
24 public: 24 public:
25 enum Status {
26 STATUS_NORMAL,
27 // A status that indicates apps are syncing/loading.
28 STATUS_LOADING,
29 };
30
31 LauncherModel(); 25 LauncherModel();
32 ~LauncherModel(); 26 ~LauncherModel();
33 27
34 // Adds a new item to the model. Returns the resulting index. 28 // Adds a new item to the model. Returns the resulting index.
35 int Add(const LauncherItem& item); 29 int Add(const LauncherItem& item);
36 30
37 // Adds the item. |index| is the requested insertion index, which may be 31 // Adds the item. |index| is the requested insertion index, which may be
38 // modified to meet type-based ordering. Returns the actual insertion index. 32 // modified to meet type-based ordering. Returns the actual insertion index.
39 int AddAt(int index, const LauncherItem& item); 33 int AddAt(int index, const LauncherItem& item);
40 34
(...skipping 14 matching lines...) Expand all
55 // Returns the id assigned to the next item added. 49 // Returns the id assigned to the next item added.
56 LauncherID next_id() const { return next_id_; } 50 LauncherID next_id() const { return next_id_; }
57 51
58 // Returns an iterator into items() for the item with the specified id, or 52 // Returns an iterator into items() for the item with the specified id, or
59 // items().end() if there is no item with the specified id. 53 // items().end() if there is no item with the specified id.
60 LauncherItems::const_iterator ItemByID(LauncherID id) const; 54 LauncherItems::const_iterator ItemByID(LauncherID id) const;
61 55
62 const LauncherItems& items() const { return items_; } 56 const LauncherItems& items() const { return items_; }
63 int item_count() const { return static_cast<int>(items_.size()); } 57 int item_count() const { return static_cast<int>(items_.size()); }
64 58
65 void SetStatus(Status status);
66 Status status() const { return status_; }
67
68 void AddObserver(LauncherModelObserver* observer); 59 void AddObserver(LauncherModelObserver* observer);
69 void RemoveObserver(LauncherModelObserver* observer); 60 void RemoveObserver(LauncherModelObserver* observer);
70 61
71 private: 62 private:
72 // Makes sure |index| is in line with the type-based order of items. If that 63 // Makes sure |index| is in line with the type-based order of items. If that
73 // is not the case, adjusts index by shifting it to the valid range and 64 // is not the case, adjusts index by shifting it to the valid range and
74 // returns the new value. 65 // returns the new value.
75 int ValidateInsertionIndex(LauncherItemType type, int index) const; 66 int ValidateInsertionIndex(LauncherItemType type, int index) const;
76 67
77 // ID assigned to the next item. 68 // ID assigned to the next item.
78 LauncherID next_id_; 69 LauncherID next_id_;
79 LauncherItems items_; 70 LauncherItems items_;
80 Status status_;
81 ObserverList<LauncherModelObserver> observers_; 71 ObserverList<LauncherModelObserver> observers_;
82 72
83 DISALLOW_COPY_AND_ASSIGN(LauncherModel); 73 DISALLOW_COPY_AND_ASSIGN(LauncherModel);
84 }; 74 };
85 75
86 } // namespace ash 76 } // namespace ash
87 77
88 #endif // ASH_LAUNCHER_LAUNCHER_MODEL_H_ 78 #endif // ASH_LAUNCHER_LAUNCHER_MODEL_H_
OLDNEW
« no previous file with comments | « ash/launcher/launcher_button.cc ('k') | ash/launcher/launcher_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698