Chromium Code Reviews| Index: athena/content/public/app_registry.h |
| diff --git a/athena/content/public/app_registry.h b/athena/content/public/app_registry.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..93a75769c649d81524d8f71c39ebd1795ea42a9f |
| --- /dev/null |
| +++ b/athena/content/public/app_registry.h |
| @@ -0,0 +1,76 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef ATHENA_CONTENT_PUBLIC_APP_REGISTRY_H_ |
| +#define ATHENA_CONTENT_PUBLIC_APP_REGISTRY_H_ |
| + |
| +#include <string> |
| +#include <vector> |
| + |
| +#include "base/macros.h" |
| +#include "base/memory/scoped_ptr.h" |
| + |
| +namespace content { |
| +class BrowserContext; |
| +} |
| + |
| +namespace athena { |
| + |
| +class AppActivityRegistry; |
| +class AppContentDelegate; |
| + |
| +// This class holds for each application, held by a user, a list of activities. |
| +// The list of activities can be retrieved as |AppActivityRegistry|. It is used |
| +// to associate activities with applications and allow the resource manager to |
| +// (re)start and stop applications. |
| +class AppRegistry { |
| + public: |
| + // Creates the AppRegistry instance. |
| + static void Create(); |
| + |
| + // Gets the instance of the controller. |
| + static AppRegistry* Get(); |
| + |
| + // Shuts down the registry (all applications should be shut down by then). |
| + static void ShutDown(); |
| + |
| + // Overrides the used AppContentDelegate. This function will own it |
| + // afterwards. A value of NULL is invalid. |
| + void SetDelegate(AppContentDelegate* delegate); |
| + |
| + // Retrieves the application content delegate. The ownership remains with this |
| + // class. |
| + AppContentDelegate* GetDelegate(); |
| + |
| + // Returns an |AppActivityRegistry| for a given activity |app_id| and |
| + // |browser_context|. |
| + AppActivityRegistry* GetAppActivityRegistry( |
| + const std::string& app_id, |
| + content::BrowserContext* browser_context); |
| + |
| + // Returns the number of registered applications. |
| + int NumberOfApplications() const { return app_list_.size(); } |
| + |
| + protected: |
| + // Only the |AppActivityRegistry| can remove itself. |
| + friend AppActivityRegistry; |
| + |
| + // Removes an activity registry for an application from the list of known |
| + // applications. |
| + void RemoveAppActivityRegistry(AppActivityRegistry* registry); |
| + |
| + private: |
| + AppRegistry(); |
| + virtual ~AppRegistry(); |
| + |
| + std::vector<AppActivityRegistry*> app_list_; |
| + |
| + 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.
|
| + |
| + DISALLOW_COPY_AND_ASSIGN(AppRegistry); |
| +}; |
| + |
| +} // namespace athena |
| + |
| +#endif // ATHENA_CONTENT_PUBLIC_APP_REGISTRY_H_ |