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
15namespace content {
16class BrowserContext;
17}
18
19namespace athena {
20
21class AppActivityRegistry;
22class AppRegistryImpl;
23
24// This class holds for each application, held by a user, a list of activities.
25// The list of activities can be retrieved as |AppActivityRegistry|. It is used
26// to associate activities with applications and allow the resource manager to
27// (re)start and stop applications.
28class ATHENA_EXPORT AppRegistry {
29 public:
30  // Creates the AppRegistry instance.
31  static void Create();
32
33  // Gets the instance of the controller.
34  static AppRegistry* Get();
35
36  // Shuts down the registry (all applications should be shut down by then).
37  static void ShutDown();
38
39  // Returns an |AppActivityRegistry| for a given activity |app_id| and
40  // |browser_context|.
41  virtual AppActivityRegistry* GetAppActivityRegistry(
42      const std::string& app_id,
43      content::BrowserContext* browser_context) = 0;
44
45  // Returns the number of registered applications.
46  virtual int NumberOfApplications() const = 0;
47
48 protected:
49  // Only the |AppActivityRegistry| can remove itself.
50  friend AppActivityRegistry;
51
52  // Removes an activity registry for an application from the list of known
53  // applications.
54  virtual void RemoveAppActivityRegistry(AppActivityRegistry* registry) = 0;
55
56  // Constructor and destructor can only be called by the implementing class.
57  AppRegistry();
58  virtual ~AppRegistry();
59};
60
61}  // namespace athena
62
63#endif  // ATHENA_CONTENT_PUBLIC_APP_REGISTRY_H_
64