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