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

Side by Side Diff: athena/activity/public/activity_manager.h

Issue 707603002: athena: Use ActivityList where appropriate, and fix AppActivity tests. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 6 years, 1 month 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
« no previous file with comments | « athena/activity/public/DEPS ('k') | athena/content/app_activity.h » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 ATHENA_ACTIVITY_PUBLIC_ACTIVITY_MANAGER_H_ 5 #ifndef ATHENA_ACTIVITY_PUBLIC_ACTIVITY_MANAGER_H_
6 #define ATHENA_ACTIVITY_PUBLIC_ACTIVITY_MANAGER_H_ 6 #define ATHENA_ACTIVITY_PUBLIC_ACTIVITY_MANAGER_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "athena/activity/public/activity.h"
10 #include "athena/athena_export.h" 11 #include "athena/athena_export.h"
12 #include "base/memory/scoped_ptr.h"
11 13
12 namespace aura { 14 namespace aura {
13 class Window; 15 class Window;
14 } 16 }
15 17
16 namespace athena { 18 namespace athena {
17 19
18 class Activity; 20 class Activity;
19 class ActivityManagerObserver; 21 class ActivityManagerObserver;
20 22
23 struct ActivityDeleter {
24 inline void operator()(Activity* activity) const {
25 Activity::Delete(activity);
26 }
27 };
28
21 using ActivityList = std::vector<Activity*>; 29 using ActivityList = std::vector<Activity*>;
30 using ScopedActivity = scoped_ptr<Activity, ActivityDeleter>;
22 31
23 // Manages a set of activities. 32 // Manages a set of activities.
24 class ATHENA_EXPORT ActivityManager { 33 class ATHENA_EXPORT ActivityManager {
25 public: 34 public:
26 static ActivityManager* Create(); 35 static ActivityManager* Create();
27 static ActivityManager* Get(); 36 static ActivityManager* Get();
28 static void Shutdown(); 37 static void Shutdown();
29 38
30 virtual ~ActivityManager() {} 39 virtual ~ActivityManager() {}
31 40
32 // Adds/Removes an activity. ActivityManager owns the activities. 41 // Adds/Removes an activity. ActivityManager owns the activities.
33 virtual void AddActivity(Activity* activity) = 0; 42 virtual void AddActivity(Activity* activity) = 0;
34 virtual void RemoveActivity(Activity* activity) = 0; 43 virtual void RemoveActivity(Activity* activity) = 0;
35 44
45 virtual ScopedActivity ReplaceActivity(Activity* to_replace,
46 Activity* replace_with) = 0;
47
36 // Returns a list of activities, sorted in their activation order (the most 48 // Returns a list of activities, sorted in their activation order (the most
37 // recently used activity is at the front of the returned list). 49 // recently used activity is at the front of the returned list).
38 virtual const ActivityList& GetActivityList() = 0; 50 virtual const ActivityList& GetActivityList() = 0;
39 51
40 // Returns the activity that has a |window| as toplevel window, or 52 // Returns the activity that has a |window| as toplevel window, or
41 // nullptr if such activity does not exist. 53 // nullptr if such activity does not exist.
42 virtual Activity* GetActivityForWindow(aura::Window* window) = 0; 54 virtual Activity* GetActivityForWindow(aura::Window* window) = 0;
43 55
44 virtual void AddObserver(ActivityManagerObserver* observer) = 0; 56 virtual void AddObserver(ActivityManagerObserver* observer) = 0;
45 virtual void RemoveObserver(ActivityManagerObserver* observer) = 0; 57 virtual void RemoveObserver(ActivityManagerObserver* observer) = 0;
46 }; 58 };
47 59
48 } // namespace athena 60 } // namespace athena
49 61
50 #endif // ATHENA_ACTIVITY_PUBLIC_ACTIVITY_MANAGER_H_ 62 #endif // ATHENA_ACTIVITY_PUBLIC_ACTIVITY_MANAGER_H_
OLDNEW
« no previous file with comments | « athena/activity/public/DEPS ('k') | athena/content/app_activity.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698