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 EXTENSIONS_BROWSER_APP_WINDOW_APPS_CLIENT_H_ | 5 #ifndef EXTENSIONS_BROWSER_APP_WINDOW_APP_WINDOW_CLIENT_H_ |
6 #define EXTENSIONS_BROWSER_APP_WINDOW_APPS_CLIENT_H_ | 6 #define EXTENSIONS_BROWSER_APP_WINDOW_APP_WINDOW_CLIENT_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
11 #include "extensions/browser/app_window/app_window.h" | 11 #include "extensions/browser/app_window/app_window.h" |
12 | 12 |
13 namespace content { | 13 namespace content { |
14 class BrowserContext; | 14 class BrowserContext; |
15 class WebContents; | 15 class WebContents; |
16 } | 16 } |
17 | 17 |
18 namespace extensions { | 18 namespace extensions { |
19 | 19 |
20 class Extension; | 20 class Extension; |
21 class NativeAppWindow; | 21 class NativeAppWindow; |
22 | 22 |
23 // 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 |
hashimoto
2014/09/19 02:44:38
Please replace "apps system" with an appropriate t
| |
24 // 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. |
25 // TODO(hashimoto): Move some functions to ExtensionsClient and rename this to | 25 // TODO(hashimoto): Move some functions to ExtensionsClient. |
26 // AppWindowClient. | 26 class AppWindowClient { |
27 class AppsClient { | |
28 public: | 27 public: |
29 virtual ~AppsClient() {} | 28 virtual ~AppWindowClient() {} |
30 | 29 |
31 // Get all loaded browser contexts. | 30 // Get all loaded browser contexts. |
32 virtual std::vector<content::BrowserContext*> GetLoadedBrowserContexts() = 0; | 31 virtual std::vector<content::BrowserContext*> GetLoadedBrowserContexts() = 0; |
33 | 32 |
34 // Creates a new AppWindow for the app in |extension| for |context|. | 33 // Creates a new AppWindow for the app in |extension| for |context|. |
35 // Caller takes ownership. | 34 // Caller takes ownership. |
36 virtual AppWindow* CreateAppWindow(content::BrowserContext* context, | 35 virtual AppWindow* CreateAppWindow(content::BrowserContext* context, |
37 const Extension* extension) = 0; | 36 const Extension* extension) = 0; |
38 | 37 |
39 // Creates a new extensions::NativeAppWindow for |window|. | 38 // Creates a new extensions::NativeAppWindow for |window|. |
40 virtual NativeAppWindow* CreateNativeAppWindow( | 39 virtual NativeAppWindow* CreateNativeAppWindow( |
41 AppWindow* window, | 40 AppWindow* window, |
42 const AppWindow::CreateParams& params) = 0; | 41 const AppWindow::CreateParams& params) = 0; |
43 | 42 |
44 // A positive keep-alive count is a request for the embedding application to | 43 // A positive keep-alive count is a request for the embedding application to |
45 // keep running after all windows are closed. The count starts at zero. | 44 // keep running after all windows are closed. The count starts at zero. |
46 virtual void IncrementKeepAliveCount() = 0; | 45 virtual void IncrementKeepAliveCount() = 0; |
47 virtual void DecrementKeepAliveCount() = 0; | 46 virtual void DecrementKeepAliveCount() = 0; |
48 | 47 |
49 // Opens DevTools window and runs the callback. | 48 // Opens DevTools window and runs the callback. |
50 virtual void OpenDevToolsWindow(content::WebContents* web_contents, | 49 virtual void OpenDevToolsWindow(content::WebContents* web_contents, |
51 const base::Closure& callback) = 0; | 50 const base::Closure& callback) = 0; |
52 | 51 |
53 // Returns true if the current channel is older than dev. | 52 // Returns true if the current channel is older than dev. |
54 virtual bool IsCurrentChannelOlderThanDev() = 0; | 53 virtual bool IsCurrentChannelOlderThanDev() = 0; |
55 | 54 |
56 // Return the apps client. | 55 // Return the apps client. |
hashimoto
2014/09/19 02:44:38
Please replace "apps client" with an appropriate t
| |
57 static AppsClient* Get(); | 56 static AppWindowClient* Get(); |
58 | 57 |
59 // Initialize the apps system with this apps client. | 58 // Initialize the apps system with this apps client. |
60 static void Set(AppsClient* client); | 59 static void Set(AppWindowClient* client); |
61 }; | 60 }; |
62 | 61 |
63 } // namespace extensions | 62 } // namespace extensions |
64 | 63 |
65 #endif // EXTENSIONS_BROWSER_APP_WINDOW_APPS_CLIENT_H_ | 64 #endif // EXTENSIONS_BROWSER_APP_WINDOW_APP_WINDOW_CLIENT_H_ |
OLD | NEW |