OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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_APPS_CLIENT_H_ | 5 #ifndef APPS_APPS_CLIENT_H_ |
6 #define APPS_APPS_CLIENT_H_ | 6 #define APPS_APPS_CLIENT_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 namespace content { | 10 namespace content { |
11 class BrowserContext; | 11 class BrowserContext; |
12 } | 12 } |
13 | 13 |
14 namespace extensions { | 14 namespace extensions { |
15 class Extension; | 15 class Extension; |
16 } | 16 } |
17 | 17 |
18 namespace apps { | 18 namespace apps { |
19 | 19 |
| 20 class AppWindow; |
| 21 |
20 // Sets up global state for the apps system. Should be Set() once in each | 22 // Sets up global state for the apps system. Should be Set() once in each |
21 // process. This should be implemented by the client of the apps system. | 23 // process. This should be implemented by the client of the apps system. |
22 class AppsClient { | 24 class AppsClient { |
23 public: | 25 public: |
24 // Get all loaded browser contexts. | 26 // Get all loaded browser contexts. |
25 virtual std::vector<content::BrowserContext*> GetLoadedBrowserContexts() = 0; | 27 virtual std::vector<content::BrowserContext*> GetLoadedBrowserContexts() = 0; |
26 | 28 |
27 // Do any pre app launch checks. Returns true if the app launch should proceed | 29 // Do any pre app launch checks. Returns true if the app launch should proceed |
28 // or false if the launch should be prevented. | 30 // or false if the launch should be prevented. |
29 virtual bool CheckAppLaunch(content::BrowserContext* context, | 31 virtual bool CheckAppLaunch(content::BrowserContext* context, |
30 const extensions::Extension* extension) = 0; | 32 const extensions::Extension* extension) = 0; |
31 | 33 |
| 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; |
| 39 |
| 40 // Tells the embedding application to stay running. The application may close |
| 41 // after a matching number of calls to EndKeepAlive() are made. |
| 42 virtual void StartKeepAlive() = 0; |
| 43 virtual void EndKeepAlive() = 0; |
| 44 |
32 // Return the apps client. | 45 // Return the apps client. |
33 static AppsClient* Get(); | 46 static AppsClient* Get(); |
34 | 47 |
35 // Initialize the apps system with this apps client. | 48 // Initialize the apps system with this apps client. |
36 static void Set(AppsClient* client); | 49 static void Set(AppsClient* client); |
37 }; | 50 }; |
38 | 51 |
39 } // namespace apps | 52 } // namespace apps |
40 | 53 |
41 #endif // APPS_APPS_CLIENT_H_ | 54 #endif // APPS_APPS_CLIENT_H_ |
OLD | NEW |