Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / apps / ui / apps_client.h
blobf601e679a9f6dba2ff410a74f91640b68e71b7f2
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
3 // found in the LICENSE file.
5 #ifndef APPS_UI_APPS_CLIENT_H_
6 #define APPS_UI_APPS_CLIENT_H_
8 #include <vector>
10 #include "apps/app_window.h"
11 #include "base/callback_forward.h"
13 namespace content {
14 class BrowserContext;
15 class WebContents;
18 namespace extensions {
19 class Extension;
20 class NativeAppWindow;
23 namespace apps {
25 // 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.
27 class AppsClient {
28 public:
29 // Get all loaded browser contexts.
30 virtual std::vector<content::BrowserContext*> GetLoadedBrowserContexts() = 0;
32 // Creates a new apps::AppWindow for the app in |extension| for |context|.
33 // Caller takes ownership.
34 virtual AppWindow* CreateAppWindow(
35 content::BrowserContext* context,
36 const extensions::Extension* extension) = 0;
38 // Creates a new extensions::NativeAppWindow for |window|.
39 virtual extensions::NativeAppWindow* CreateNativeAppWindow(
40 AppWindow* window,
41 const AppWindow::CreateParams& params) = 0;
43 // 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.
45 virtual void IncrementKeepAliveCount() = 0;
46 virtual void DecrementKeepAliveCount() = 0;
48 // Opens DevTools window and runs the callback.
49 virtual void OpenDevToolsWindow(content::WebContents* web_contents,
50 const base::Closure& callback) = 0;
52 // Returns true if the current channel is older than dev.
53 virtual bool IsCurrentChannelOlderThanDev() = 0;
55 // Return the apps client.
56 static AppsClient* Get();
58 // Initialize the apps system with this apps client.
59 static void Set(AppsClient* client);
62 } // namespace apps
64 #endif // APPS_UI_APPS_CLIENT_H_