Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / apps / ui / apps_client.h
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 APPS_UI_APPS_CLIENT_H_
6 #define APPS_UI_APPS_CLIENT_H_
7
8 #include <vector>
9
10 #include "apps/app_window.h"
11
12 namespace content {
13 class BrowserContext;
14 }
15
16 namespace extensions {
17 class Extension;
18 }
19
20 namespace apps {
21
22 class NativeAppWindow;
23
24 // Sets up global state for the apps system. Should be Set() once in each
25 // process. This should be implemented by the client of the apps system.
26 class AppsClient {
27  public:
28   // Get all loaded browser contexts.
29   virtual std::vector<content::BrowserContext*> GetLoadedBrowserContexts() = 0;
30
31   // Creates a new apps::AppWindow for the app in |extension| for |context|.
32   // Caller takes ownership.
33   virtual AppWindow* CreateAppWindow(
34       content::BrowserContext* context,
35       const extensions::Extension* extension) = 0;
36
37   // Creates a new apps::NativeAppWindow for |window|.
38   virtual NativeAppWindow* CreateNativeAppWindow(
39       AppWindow* window,
40       const AppWindow::CreateParams& params) = 0;
41
42   // A positive keep-alive count is a request for the embedding application to
43   // keep running after all windows are closed. The count starts at zero.
44   virtual void IncrementKeepAliveCount() = 0;
45   virtual void DecrementKeepAliveCount() = 0;
46
47   // Return the apps client.
48   static AppsClient* Get();
49
50   // Initialize the apps system with this apps client.
51   static void Set(AppsClient* client);
52 };
53
54 }  // namespace apps
55
56 #endif  // APPS_UI_APPS_CLIENT_H_