OLD | NEW |
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_CONTENT_PUBLIC_APP_REGISTRY_H_ | 5 #ifndef ATHENA_CONTENT_PUBLIC_APP_REGISTRY_H_ |
6 #define ATHENA_CONTENT_PUBLIC_APP_REGISTRY_H_ | 6 #define ATHENA_CONTENT_PUBLIC_APP_REGISTRY_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "athena/athena_export.h" | 11 #include "athena/athena_export.h" |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 | 14 |
15 namespace content { | 15 namespace content { |
16 class BrowserContext; | 16 class BrowserContext; |
17 } | 17 } |
18 | 18 |
19 namespace athena { | 19 namespace athena { |
20 | 20 |
21 class AppActivityRegistry; | 21 class AppActivityRegistry; |
22 class AppContentControlDelegate; | |
23 class AppRegistryImpl; | 22 class AppRegistryImpl; |
24 | 23 |
25 // This class holds for each application, held by a user, a list of activities. | 24 // This class holds for each application, held by a user, a list of activities. |
26 // The list of activities can be retrieved as |AppActivityRegistry|. It is used | 25 // The list of activities can be retrieved as |AppActivityRegistry|. It is used |
27 // to associate activities with applications and allow the resource manager to | 26 // to associate activities with applications and allow the resource manager to |
28 // (re)start and stop applications. | 27 // (re)start and stop applications. |
29 class ATHENA_EXPORT AppRegistry { | 28 class ATHENA_EXPORT AppRegistry { |
30 public: | 29 public: |
31 // Creates the AppRegistry instance. | 30 // Creates the AppRegistry instance. |
32 static void Create(); | 31 static void Create(); |
33 | 32 |
34 // Gets the instance of the controller. | 33 // Gets the instance of the controller. |
35 static AppRegistry* Get(); | 34 static AppRegistry* Get(); |
36 | 35 |
37 // Shuts down the registry (all applications should be shut down by then). | 36 // Shuts down the registry (all applications should be shut down by then). |
38 static void ShutDown(); | 37 static void ShutDown(); |
39 | 38 |
40 // Overrides the used AppContentDelegate. This function will own it | |
41 // afterwards. A value of NULL is invalid. | |
42 virtual void SetDelegate(AppContentControlDelegate* delegate) = 0; | |
43 | |
44 // Retrieves the application content delegate. The ownership remains with this | |
45 // class. | |
46 virtual AppContentControlDelegate* GetDelegate() = 0; | |
47 | |
48 // Returns an |AppActivityRegistry| for a given activity |app_id| and | 39 // Returns an |AppActivityRegistry| for a given activity |app_id| and |
49 // |browser_context|. | 40 // |browser_context|. |
50 virtual AppActivityRegistry* GetAppActivityRegistry( | 41 virtual AppActivityRegistry* GetAppActivityRegistry( |
51 const std::string& app_id, | 42 const std::string& app_id, |
52 content::BrowserContext* browser_context) = 0; | 43 content::BrowserContext* browser_context) = 0; |
53 | 44 |
54 // Returns the number of registered applications. | 45 // Returns the number of registered applications. |
55 virtual int NumberOfApplications() const = 0; | 46 virtual int NumberOfApplications() const = 0; |
56 | 47 |
57 protected: | 48 protected: |
58 // Only the |AppActivityRegistry| can remove itself. | 49 // Only the |AppActivityRegistry| can remove itself. |
59 friend AppActivityRegistry; | 50 friend AppActivityRegistry; |
60 | 51 |
61 // Removes an activity registry for an application from the list of known | 52 // Removes an activity registry for an application from the list of known |
62 // applications. | 53 // applications. |
63 virtual void RemoveAppActivityRegistry(AppActivityRegistry* registry) = 0; | 54 virtual void RemoveAppActivityRegistry(AppActivityRegistry* registry) = 0; |
64 | 55 |
65 // Constructor and destructor can only be called by the implementing class. | 56 // Constructor and destructor can only be called by the implementing class. |
66 AppRegistry(); | 57 AppRegistry(); |
67 virtual ~AppRegistry(); | 58 virtual ~AppRegistry(); |
68 }; | 59 }; |
69 | 60 |
70 } // namespace athena | 61 } // namespace athena |
71 | 62 |
72 #endif // ATHENA_CONTENT_PUBLIC_APP_REGISTRY_H_ | 63 #endif // ATHENA_CONTENT_PUBLIC_APP_REGISTRY_H_ |
OLD | NEW |