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