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

Side by Side Diff: athena/content/public/app_registry.h

Issue 477523002: Athena: Adding basic resource management framework (un-/re-loading) of V2 applications (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef ATHENA_CONTENT_PUBLIC_APP_REGISTRY_H_
6 #define ATHENA_CONTENT_PUBLIC_APP_REGISTRY_H_
7
8 #include <string>
9 #include <vector>
10
11 #include "base/macros.h"
12 #include "base/memory/scoped_ptr.h"
13
14 namespace content {
15 class BrowserContext;
16 }
17
18 namespace athena {
19
20 class AppActivityRegistry;
21 class AppContentDelegate;
22
23 // This class holds for each application, held by a user, a list of activities.
24 // The list of activities can be retrieved as |AppActivityRegistry|. It is used
25 // to associate activities with applications and allow the resource manager to
26 // (re)start and stop applications.
27 class AppRegistry {
28 public:
29 // Creates the AppRegistry instance.
30 static void Create();
31
32 // Gets the instance of the controller.
33 static AppRegistry* Get();
34
35 // Shuts down the registry (all applications should be shut down by then).
36 static void ShutDown();
37
38 // Overrides the used AppContentDelegate. This function will own it
39 // afterwards. A value of NULL is invalid.
40 void SetDelegate(AppContentDelegate* delegate);
41
42 // Retrieves the application content delegate. The ownership remains with this
43 // class.
44 AppContentDelegate* GetDelegate();
45
46 // Returns an |AppActivityRegistry| for a given activity |app_id| and
47 // |browser_context|.
48 AppActivityRegistry* GetAppActivityRegistry(
49 const std::string& app_id,
50 content::BrowserContext* browser_context);
51
52 // Returns the number of registered applications.
53 int NumberOfApplications() const { return app_list_.size(); }
54
55 protected:
56 // Only the |AppActivityRegistry| can remove itself.
57 friend AppActivityRegistry;
58
59 // Removes an activity registry for an application from the list of known
60 // applications.
61 void RemoveAppActivityRegistry(AppActivityRegistry* registry);
62
63 private:
64 AppRegistry();
65 virtual ~AppRegistry();
66
67 std::vector<AppActivityRegistry*> app_list_;
68
69 scoped_ptr<AppContentDelegate> delegate_;
oshima 2014/08/15 15:15:59 public interface should be kept minimul. Can you m
Mr4D (OOO till 08-26) 2014/08/18 16:09:32 Done.
70
71 DISALLOW_COPY_AND_ASSIGN(AppRegistry);
72 };
73
74 } // namespace athena
75
76 #endif // ATHENA_CONTENT_PUBLIC_APP_REGISTRY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698