| OLD | NEW |
| (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 "athena/athena_export.h" | |
| 12 #include "base/macros.h" | |
| 13 #include "base/memory/scoped_ptr.h" | |
| 14 | |
| 15 namespace content { | |
| 16 class BrowserContext; | |
| 17 } | |
| 18 | |
| 19 namespace athena { | |
| 20 | |
| 21 class AppActivityRegistry; | |
| 22 class AppContentControlDelegate; | |
| 23 class AppRegistryImpl; | |
| 24 | |
| 25 // 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 | |
| 27 // to associate activities with applications and allow the resource manager to | |
| 28 // (re)start and stop applications. | |
| 29 class ATHENA_EXPORT AppRegistry { | |
| 30 public: | |
| 31 // Creates the AppRegistry instance. | |
| 32 static void Create(); | |
| 33 | |
| 34 // Gets the instance of the controller. | |
| 35 static AppRegistry* Get(); | |
| 36 | |
| 37 // Shuts down the registry (all applications should be shut down by then). | |
| 38 static void ShutDown(); | |
| 39 | |
| 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 | |
| 49 // |browser_context|. | |
| 50 virtual AppActivityRegistry* GetAppActivityRegistry( | |
| 51 const std::string& app_id, | |
| 52 content::BrowserContext* browser_context) = 0; | |
| 53 | |
| 54 // Returns the number of registered applications. | |
| 55 virtual int NumberOfApplications() const = 0; | |
| 56 | |
| 57 protected: | |
| 58 // Only the |AppActivityRegistry| can remove itself. | |
| 59 friend AppActivityRegistry; | |
| 60 | |
| 61 // Removes an activity registry for an application from the list of known | |
| 62 // applications. | |
| 63 virtual void RemoveAppActivityRegistry(AppActivityRegistry* registry) = 0; | |
| 64 | |
| 65 // Constructor and destructor can only be called by the implementing class. | |
| 66 AppRegistry(); | |
| 67 virtual ~AppRegistry(); | |
| 68 }; | |
| 69 | |
| 70 } // namespace athena | |
| 71 | |
| 72 #endif // ATHENA_CONTENT_PUBLIC_APP_REGISTRY_H_ | |
| OLD | NEW |