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