Chromium Code Reviews| Index: athena/extensions/chrome/athena_apps_client.cc |
| diff --git a/athena/extensions/chrome/athena_apps_client.cc b/athena/extensions/chrome/athena_apps_client.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..a408087b08d042d8d70656d27f554d3e87581fb5 |
| --- /dev/null |
| +++ b/athena/extensions/chrome/athena_apps_client.cc |
| @@ -0,0 +1,72 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "athena/extensions/chrome/athena_apps_client.h" |
| + |
| +#include "apps/app_window.h" |
| +#include "athena/activity/public/activity_factory.h" |
| +#include "athena/activity/public/activity_manager.h" |
| +#include "base/memory/singleton.h" |
| +#include "chrome/browser/browser_process.h" |
| +#include "chrome/browser/devtools/devtools_window.h" |
| +#include "chrome/browser/profiles/profile_manager.h" |
| +#include "chrome/browser/ui/apps/chrome_app_delegate.h" |
| +#include "chrome/browser/ui/views/apps/chrome_native_app_window_views.h" |
| +#include "chrome/common/extensions/features/feature_channel.h" |
| +#include "extensions/common/extension.h" |
| + |
| +namespace athena { |
| + |
| +AthenaAppsClient::AthenaAppsClient() { |
| +} |
| + |
| +AthenaAppsClient::~AthenaAppsClient() { |
| +} |
| + |
| +std::vector<content::BrowserContext*> |
| +AthenaAppsClient::GetLoadedBrowserContexts() { |
| + std::vector<Profile*> profiles = |
| + g_browser_process->profile_manager()->GetLoadedProfiles(); |
| + return std::vector<content::BrowserContext*>(profiles.begin(), |
| + profiles.end()); |
| +} |
| + |
| +apps::AppWindow* AthenaAppsClient::CreateAppWindow( |
| + content::BrowserContext* context, |
| + const extensions::Extension* extension) { |
| + return new apps::AppWindow(context, new ChromeAppDelegate, extension); |
| +} |
| + |
| +extensions::NativeAppWindow* AthenaAppsClient::CreateNativeAppWindow( |
| + apps::AppWindow* app_window, |
| + const apps::AppWindow::CreateParams& params) { |
| + // TODO(oshima): Implement athena's native appwindow. |
| + ChromeNativeAppWindowViews* window = new ChromeNativeAppWindowViews; |
| + window->Init(app_window, params); |
| + athena::ActivityManager::Get()->AddActivity( |
| + athena::ActivityFactory::Get()->CreateAppActivity(app_window)); |
| + return window; |
| +} |
| + |
| +void AthenaAppsClient::IncrementKeepAliveCount() { |
| + // No need to keep track of KeepAlive count on ChromeOS |
|
Yoyo Zhou
2014/08/29 22:23:29
nit: end comments in .
oshima
2014/08/29 23:25:26
Done.
|
| +} |
| + |
| +void AthenaAppsClient::DecrementKeepAliveCount() { |
| + // No need to keep track of KeepAlive count on ChromeOS |
| +} |
| + |
| +void AthenaAppsClient::OpenDevToolsWindow(content::WebContents* web_contents, |
| + const base::Closure& callback) { |
| + // TODO(oshima): Figure out what to do. |
| + DevToolsWindow* devtools_window = DevToolsWindow::OpenDevToolsWindow( |
| + web_contents, DevToolsToggleAction::ShowConsole()); |
| + devtools_window->SetLoadCompletedCallback(callback); |
| +} |
| + |
| +bool AthenaAppsClient::IsCurrentChannelOlderThanDev() { |
| + return extensions::GetCurrentChannel() > chrome::VersionInfo::CHANNEL_DEV; |
| +} |
| + |
| +} // namespace athena |