OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "chrome/browser/apps/chrome_apps_client.h" | 5 #include "chrome/browser/ui/apps/chrome_apps_client.h" |
6 | 6 |
7 #include "apps/app_window.h" | 7 #include "apps/app_window.h" |
8 #include "base/memory/singleton.h" | 8 #include "base/memory/singleton.h" |
9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/profiles/profile_manager.h" | 10 #include "chrome/browser/profiles/profile_manager.h" |
11 #include "extensions/common/extension.h" | 11 #include "extensions/common/extension.h" |
12 | 12 |
13 // TODO(jamescook): We probably shouldn't compile this class at all on Android. | 13 // TODO(jamescook): We probably shouldn't compile this class at all on Android. |
14 // See http://crbug.com/343612 | 14 // See http://crbug.com/343612 |
15 #if !defined(OS_ANDROID) | 15 #if !defined(OS_ANDROID) |
16 #include "chrome/browser/lifetime/application_lifetime.h" | 16 #include "chrome/browser/lifetime/application_lifetime.h" |
17 #include "chrome/browser/ui/apps/chrome_app_delegate.h" | 17 #include "chrome/browser/ui/apps/chrome_app_delegate.h" |
18 #include "chrome/browser/ui/apps/chrome_app_window_delegate.h" | |
19 #endif | 18 #endif |
20 | 19 |
21 ChromeAppsClient::ChromeAppsClient() {} | 20 ChromeAppsClient::ChromeAppsClient() { |
| 21 } |
22 | 22 |
23 ChromeAppsClient::~ChromeAppsClient() {} | 23 ChromeAppsClient::~ChromeAppsClient() { |
| 24 } |
24 | 25 |
25 // static | 26 // static |
26 ChromeAppsClient* ChromeAppsClient::GetInstance() { | 27 ChromeAppsClient* ChromeAppsClient::GetInstance() { |
27 return Singleton<ChromeAppsClient, | 28 return Singleton<ChromeAppsClient, |
28 LeakySingletonTraits<ChromeAppsClient> >::get(); | 29 LeakySingletonTraits<ChromeAppsClient> >::get(); |
29 } | 30 } |
30 | 31 |
31 std::vector<content::BrowserContext*> | 32 std::vector<content::BrowserContext*> |
32 ChromeAppsClient::GetLoadedBrowserContexts() { | 33 ChromeAppsClient::GetLoadedBrowserContexts() { |
33 std::vector<Profile*> profiles = | 34 std::vector<Profile*> profiles = |
34 g_browser_process->profile_manager()->GetLoadedProfiles(); | 35 g_browser_process->profile_manager()->GetLoadedProfiles(); |
35 return std::vector<content::BrowserContext*>(profiles.begin(), | 36 return std::vector<content::BrowserContext*>(profiles.begin(), |
36 profiles.end()); | 37 profiles.end()); |
37 } | 38 } |
38 | 39 |
39 apps::AppWindow* ChromeAppsClient::CreateAppWindow( | 40 apps::AppWindow* ChromeAppsClient::CreateAppWindow( |
40 content::BrowserContext* context, | 41 content::BrowserContext* context, |
41 const extensions::Extension* extension) { | 42 const extensions::Extension* extension) { |
42 #if defined(OS_ANDROID) | 43 #if defined(OS_ANDROID) |
43 return NULL; | 44 return NULL; |
44 #else | 45 #else |
45 return new apps::AppWindow( | 46 return new apps::AppWindow(context, new ChromeAppDelegate, extension); |
46 context, new ChromeAppDelegate, new ChromeAppWindowDelegate, extension); | |
47 #endif | 47 #endif |
48 } | 48 } |
49 | 49 |
| 50 apps::NativeAppWindow* ChromeAppsClient::CreateNativeAppWindow( |
| 51 apps::AppWindow* window, |
| 52 const apps::AppWindow::CreateParams& params) { |
| 53 #if defined(OS_ANDROID) |
| 54 return NULL; |
| 55 #else |
| 56 return CreateNativeAppWindowImpl(window, params); |
| 57 #endif |
| 58 } |
| 59 |
50 void ChromeAppsClient::IncrementKeepAliveCount() { | 60 void ChromeAppsClient::IncrementKeepAliveCount() { |
51 #if !defined(OS_ANDROID) | 61 #if !defined(OS_ANDROID) |
52 chrome::IncrementKeepAliveCount(); | 62 chrome::IncrementKeepAliveCount(); |
53 #endif | 63 #endif |
54 } | 64 } |
55 | 65 |
56 void ChromeAppsClient::DecrementKeepAliveCount() { | 66 void ChromeAppsClient::DecrementKeepAliveCount() { |
57 #if !defined(OS_ANDROID) | 67 #if !defined(OS_ANDROID) |
58 chrome::DecrementKeepAliveCount(); | 68 chrome::DecrementKeepAliveCount(); |
59 #endif | 69 #endif |
60 } | 70 } |
OLD | NEW |