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