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_APP_WINDOW_CLIENT_H_ | 5 #ifndef EXTENSIONS_BROWSER_APP_WINDOW_APP_WINDOW_CLIENT_H_ |
6 #define EXTENSIONS_BROWSER_APP_WINDOW_APP_WINDOW_CLIENT_H_ | 6 #define EXTENSIONS_BROWSER_APP_WINDOW_APP_WINDOW_CLIENT_H_ |
7 | 7 |
8 #include "base/callback_forward.h" | 8 #include "base/callback_forward.h" |
9 #include "extensions/browser/app_window/app_window.h" | 9 #include "extensions/browser/app_window/app_window.h" |
| 10 #include "extensions/common/api/app_runtime.h" |
10 | 11 |
11 namespace content { | 12 namespace content { |
12 class BrowserContext; | 13 class BrowserContext; |
13 class WebContents; | 14 class WebContents; |
14 } | 15 } |
15 | 16 |
16 namespace extensions { | 17 namespace extensions { |
17 | 18 |
18 class Extension; | 19 class Extension; |
19 class NativeAppWindow; | 20 class NativeAppWindow; |
20 | 21 |
21 // Sets up global state for the app window system. Should be Set() once in each | 22 // Sets up global state for the app window system. Should be Set() once in each |
22 // process. This should be implemented by the client of the app window system. | 23 // process. This should be implemented by the client of the app window system. |
23 // TODO(hashimoto): Move some functions to ExtensionsClient. | 24 // TODO(hashimoto): Move some functions to ExtensionsClient. |
24 class AppWindowClient { | 25 class AppWindowClient { |
25 public: | 26 public: |
26 virtual ~AppWindowClient() {} | 27 virtual ~AppWindowClient() {} |
27 | 28 |
28 // Creates a new AppWindow for the app in |extension| for |context|. | 29 // Creates a new AppWindow for the app in |extension| for |context|. |
29 // Caller takes ownership. | 30 // Caller takes ownership. |
30 virtual AppWindow* CreateAppWindow(content::BrowserContext* context, | 31 virtual AppWindow* CreateAppWindow(content::BrowserContext* context, |
31 const Extension* extension) = 0; | 32 const Extension* extension) = 0; |
32 | 33 |
| 34 // Creates a new AppWindow for |extension| as lock screen action handler for |
| 35 // |action|. This should be used to create windows that will be used to handle |
| 36 // |action| on lock screen. The method should return null window if the app |
| 37 // was not requested to handle the action. |
| 38 virtual AppWindow* CreateAppWindowForLockScreenAction( |
| 39 content::BrowserContext* context, |
| 40 const Extension* extension, |
| 41 api::app_runtime::ActionType action) = 0; |
| 42 |
33 // Creates a new extensions::NativeAppWindow for |window|. | 43 // Creates a new extensions::NativeAppWindow for |window|. |
34 virtual NativeAppWindow* CreateNativeAppWindow( | 44 virtual NativeAppWindow* CreateNativeAppWindow( |
35 AppWindow* window, | 45 AppWindow* window, |
36 AppWindow::CreateParams* params) = 0; | 46 AppWindow::CreateParams* params) = 0; |
37 | 47 |
38 // Opens DevTools window and runs the callback. | 48 // Opens DevTools window and runs the callback. |
39 virtual void OpenDevToolsWindow(content::WebContents* web_contents, | 49 virtual void OpenDevToolsWindow(content::WebContents* web_contents, |
40 const base::Closure& callback) = 0; | 50 const base::Closure& callback) = 0; |
41 | 51 |
42 // Returns true if the current channel is older than dev. | 52 // Returns true if the current channel is older than dev. |
43 virtual bool IsCurrentChannelOlderThanDev() = 0; | 53 virtual bool IsCurrentChannelOlderThanDev() = 0; |
44 | 54 |
45 // Return the app window client. | 55 // Return the app window client. |
46 static AppWindowClient* Get(); | 56 static AppWindowClient* Get(); |
47 | 57 |
48 // Initialize the app window system with this app window client. | 58 // Initialize the app window system with this app window client. |
49 static void Set(AppWindowClient* client); | 59 static void Set(AppWindowClient* client); |
50 }; | 60 }; |
51 | 61 |
52 } // namespace extensions | 62 } // namespace extensions |
53 | 63 |
54 #endif // EXTENSIONS_BROWSER_APP_WINDOW_APP_WINDOW_CLIENT_H_ | 64 #endif // EXTENSIONS_BROWSER_APP_WINDOW_APP_WINDOW_CLIENT_H_ |
OLD | NEW |