Revert of Componentize SigninManager. (https://codereview.chromium.org/218713002/)
[chromium-blink-merge.git] / apps / apps_client.h
blob9af8afb65b2c46b86019f3f909de34d4497b600b
1 // Copyright 2013 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.
5 #ifndef APPS_APPS_CLIENT_H_
6 #define APPS_APPS_CLIENT_H_
8 #include <vector>
10 namespace content {
11 class BrowserContext;
14 namespace extensions {
15 class Extension;
18 namespace apps {
20 class AppWindow;
22 // Sets up global state for the apps system. Should be Set() once in each
23 // process. This should be implemented by the client of the apps system.
24 class AppsClient {
25 public:
26 // Get all loaded browser contexts.
27 virtual std::vector<content::BrowserContext*> GetLoadedBrowserContexts() = 0;
29 // Do any pre app launch checks. Returns true if the app launch should proceed
30 // or false if the launch should be prevented.
31 virtual bool CheckAppLaunch(content::BrowserContext* context,
32 const extensions::Extension* extension) = 0;
34 // Creates a new apps::AppWindow for the app in |extension| for |context|.
35 // Caller takes ownership.
36 virtual AppWindow* CreateAppWindow(
37 content::BrowserContext* context,
38 const extensions::Extension* extension) = 0;
40 // A positive keep-alive count is a request for the embedding application to
41 // keep running after all windows are closed. The count starts at zero.
42 virtual void IncrementKeepAliveCount() = 0;
43 virtual void DecrementKeepAliveCount() = 0;
45 // Return the apps client.
46 static AppsClient* Get();
48 // Initialize the apps system with this apps client.
49 static void Set(AppsClient* client);
52 } // namespace apps
54 #endif // APPS_APPS_CLIENT_H_