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