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