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_app_window_client.h" | 5 #include "chrome/browser/ui/apps/chrome_app_window_client.h" |
6 | 6 |
7 #include "base/memory/singleton.h" | 7 #include "base/memory/singleton.h" |
8 #include "chrome/browser/apps/scoped_keep_alive.h" | 8 #include "chrome/browser/apps/scoped_keep_alive.h" |
9 #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" | |
12 #include "chrome/common/extensions/features/feature_channel.h" | 10 #include "chrome/common/extensions/features/feature_channel.h" |
13 #include "extensions/browser/app_window/app_window.h" | 11 #include "extensions/browser/app_window/app_window.h" |
14 #include "extensions/common/extension.h" | 12 #include "extensions/common/extension.h" |
15 | 13 |
16 // TODO(jamescook): We probably shouldn't compile this class at all on Android. | 14 // TODO(jamescook): We probably shouldn't compile this class at all on Android. |
17 // See http://crbug.com/343612 | 15 // See http://crbug.com/343612 |
18 #if !defined(OS_ANDROID) | 16 #if !defined(OS_ANDROID) |
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 ChromeAppWindowClient::ChromeAppWindowClient() { | 20 ChromeAppWindowClient::ChromeAppWindowClient() { |
23 } | 21 } |
24 | 22 |
25 ChromeAppWindowClient::~ChromeAppWindowClient() { | 23 ChromeAppWindowClient::~ChromeAppWindowClient() { |
26 } | 24 } |
27 | 25 |
28 // static | 26 // static |
29 ChromeAppWindowClient* ChromeAppWindowClient::GetInstance() { | 27 ChromeAppWindowClient* ChromeAppWindowClient::GetInstance() { |
30 return Singleton<ChromeAppWindowClient, | 28 return Singleton<ChromeAppWindowClient, |
31 LeakySingletonTraits<ChromeAppWindowClient> >::get(); | 29 LeakySingletonTraits<ChromeAppWindowClient> >::get(); |
32 } | 30 } |
33 | 31 |
34 std::vector<content::BrowserContext*> | |
35 ChromeAppWindowClient::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* ChromeAppWindowClient::CreateAppWindow( | 32 extensions::AppWindow* ChromeAppWindowClient::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( | 38 return new extensions::AppWindow( |
49 context, | 39 context, |
50 new ChromeAppDelegate(make_scoped_ptr(new ScopedKeepAlive)), | 40 new ChromeAppDelegate(make_scoped_ptr(new ScopedKeepAlive)), |
51 extension); | 41 extension); |
(...skipping 14 matching lines...) Expand all Loading... |
66 content::WebContents* web_contents, | 56 content::WebContents* web_contents, |
67 const base::Closure& callback) { | 57 const base::Closure& callback) { |
68 DevToolsWindow* devtools_window = DevToolsWindow::OpenDevToolsWindow( | 58 DevToolsWindow* devtools_window = DevToolsWindow::OpenDevToolsWindow( |
69 web_contents, DevToolsToggleAction::ShowConsole()); | 59 web_contents, DevToolsToggleAction::ShowConsole()); |
70 devtools_window->SetLoadCompletedCallback(callback); | 60 devtools_window->SetLoadCompletedCallback(callback); |
71 } | 61 } |
72 | 62 |
73 bool ChromeAppWindowClient::IsCurrentChannelOlderThanDev() { | 63 bool ChromeAppWindowClient::IsCurrentChannelOlderThanDev() { |
74 return extensions::GetCurrentChannel() > chrome::VersionInfo::CHANNEL_DEV; | 64 return extensions::GetCurrentChannel() > chrome::VersionInfo::CHANNEL_DEV; |
75 } | 65 } |
OLD | NEW |