Chromium Code Reviews| 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 "athena/extensions/chrome/athena_apps_client.h" | |
| 6 | |
| 7 #include "apps/app_window.h" | |
| 8 #include "athena/activity/public/activity_factory.h" | |
| 9 #include "athena/activity/public/activity_manager.h" | |
| 10 #include "base/memory/singleton.h" | |
| 11 #include "chrome/browser/browser_process.h" | |
| 12 #include "chrome/browser/devtools/devtools_window.h" | |
| 13 #include "chrome/browser/profiles/profile_manager.h" | |
| 14 #include "chrome/browser/ui/apps/chrome_app_delegate.h" | |
| 15 #include "chrome/browser/ui/views/apps/chrome_native_app_window_views.h" | |
| 16 #include "chrome/common/extensions/features/feature_channel.h" | |
| 17 #include "extensions/common/extension.h" | |
| 18 | |
| 19 namespace athena { | |
| 20 | |
| 21 AthenaAppsClient::AthenaAppsClient() { | |
| 22 } | |
| 23 | |
| 24 AthenaAppsClient::~AthenaAppsClient() { | |
| 25 } | |
| 26 | |
| 27 std::vector<content::BrowserContext*> | |
| 28 AthenaAppsClient::GetLoadedBrowserContexts() { | |
| 29 std::vector<Profile*> profiles = | |
| 30 g_browser_process->profile_manager()->GetLoadedProfiles(); | |
| 31 return std::vector<content::BrowserContext*>(profiles.begin(), | |
| 32 profiles.end()); | |
| 33 } | |
| 34 | |
| 35 apps::AppWindow* AthenaAppsClient::CreateAppWindow( | |
| 36 content::BrowserContext* context, | |
| 37 const extensions::Extension* extension) { | |
| 38 return new apps::AppWindow(context, new ChromeAppDelegate, extension); | |
| 39 } | |
| 40 | |
| 41 extensions::NativeAppWindow* AthenaAppsClient::CreateNativeAppWindow( | |
| 42 apps::AppWindow* app_window, | |
| 43 const apps::AppWindow::CreateParams& params) { | |
| 44 // TODO(oshima): Implement athena's native appwindow. | |
| 45 ChromeNativeAppWindowViews* window = new ChromeNativeAppWindowViews; | |
| 46 window->Init(app_window, params); | |
| 47 athena::ActivityManager::Get()->AddActivity( | |
| 48 athena::ActivityFactory::Get()->CreateAppActivity(app_window)); | |
| 49 return window; | |
| 50 } | |
| 51 | |
| 52 void AthenaAppsClient::IncrementKeepAliveCount() { | |
| 53 // 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.
| |
| 54 } | |
| 55 | |
| 56 void AthenaAppsClient::DecrementKeepAliveCount() { | |
| 57 // No need to keep track of KeepAlive count on ChromeOS | |
| 58 } | |
| 59 | |
| 60 void AthenaAppsClient::OpenDevToolsWindow(content::WebContents* web_contents, | |
| 61 const base::Closure& callback) { | |
| 62 // TODO(oshima): Figure out what to do. | |
| 63 DevToolsWindow* devtools_window = DevToolsWindow::OpenDevToolsWindow( | |
| 64 web_contents, DevToolsToggleAction::ShowConsole()); | |
| 65 devtools_window->SetLoadCompletedCallback(callback); | |
| 66 } | |
| 67 | |
| 68 bool AthenaAppsClient::IsCurrentChannelOlderThanDev() { | |
| 69 return extensions::GetCurrentChannel() > chrome::VersionInfo::CHANNEL_DEV; | |
| 70 } | |
| 71 | |
| 72 } // namespace athena | |
| OLD | NEW |