| 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 "athena/extensions/chrome/athena_apps_client.h" | 5 #include "athena/extensions/chrome/athena_apps_client.h" |
| 6 | 6 |
| 7 #include "athena/activity/public/activity_factory.h" | 7 #include "athena/activity/public/activity_factory.h" |
| 8 #include "athena/activity/public/activity_manager.h" | 8 #include "athena/activity/public/activity_manager.h" |
| 9 #include "athena/extensions/chrome/athena_app_delegate.h" |
| 9 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
| 10 #include "chrome/browser/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
| 11 #include "chrome/browser/devtools/devtools_window.h" | 12 #include "chrome/browser/devtools/devtools_window.h" |
| 12 #include "chrome/browser/profiles/profile_manager.h" | 13 #include "chrome/browser/profiles/profile_manager.h" |
| 13 #include "chrome/browser/ui/apps/chrome_app_delegate.h" | |
| 14 #include "chrome/browser/ui/views/apps/chrome_native_app_window_views.h" | 14 #include "chrome/browser/ui/views/apps/chrome_native_app_window_views.h" |
| 15 #include "chrome/common/extensions/features/feature_channel.h" | 15 #include "chrome/common/extensions/features/feature_channel.h" |
| 16 #include "extensions/browser/app_window/app_window.h" | 16 #include "extensions/browser/app_window/app_window.h" |
| 17 #include "extensions/common/extension.h" | 17 #include "extensions/common/extension.h" |
| 18 | 18 |
| 19 namespace athena { | 19 namespace athena { |
| 20 | 20 |
| 21 AthenaAppsClient::AthenaAppsClient() { | 21 AthenaAppsClient::AthenaAppsClient() { |
| 22 } | 22 } |
| 23 | 23 |
| 24 AthenaAppsClient::~AthenaAppsClient() { | 24 AthenaAppsClient::~AthenaAppsClient() { |
| 25 } | 25 } |
| 26 | 26 |
| 27 std::vector<content::BrowserContext*> | 27 std::vector<content::BrowserContext*> |
| 28 AthenaAppsClient::GetLoadedBrowserContexts() { | 28 AthenaAppsClient::GetLoadedBrowserContexts() { |
| 29 std::vector<Profile*> profiles = | 29 std::vector<Profile*> profiles = |
| 30 g_browser_process->profile_manager()->GetLoadedProfiles(); | 30 g_browser_process->profile_manager()->GetLoadedProfiles(); |
| 31 return std::vector<content::BrowserContext*>(profiles.begin(), | 31 return std::vector<content::BrowserContext*>(profiles.begin(), |
| 32 profiles.end()); | 32 profiles.end()); |
| 33 } | 33 } |
| 34 | 34 |
| 35 extensions::AppWindow* AthenaAppsClient::CreateAppWindow( | 35 extensions::AppWindow* AthenaAppsClient::CreateAppWindow( |
| 36 content::BrowserContext* context, | 36 content::BrowserContext* context, |
| 37 const extensions::Extension* extension) { | 37 const extensions::Extension* extension) { |
| 38 return new extensions::AppWindow(context, new ChromeAppDelegate, extension); | 38 return new extensions::AppWindow(context, new AthenaAppDelegate, extension); |
| 39 } | 39 } |
| 40 | 40 |
| 41 extensions::NativeAppWindow* AthenaAppsClient::CreateNativeAppWindow( | 41 extensions::NativeAppWindow* AthenaAppsClient::CreateNativeAppWindow( |
| 42 extensions::AppWindow* app_window, | 42 extensions::AppWindow* app_window, |
| 43 const extensions::AppWindow::CreateParams& params) { | 43 const extensions::AppWindow::CreateParams& params) { |
| 44 // TODO(oshima): Implement athena's native appwindow. | 44 // TODO(oshima): Implement athena's native appwindow. |
| 45 ChromeNativeAppWindowViews* window = new ChromeNativeAppWindowViews; | 45 ChromeNativeAppWindowViews* window = new ChromeNativeAppWindowViews; |
| 46 window->Init(app_window, params); | 46 window->Init(app_window, params); |
| 47 athena::ActivityManager::Get()->AddActivity( | 47 athena::ActivityManager::Get()->AddActivity( |
| 48 athena::ActivityFactory::Get()->CreateAppActivity(app_window)); | 48 athena::ActivityFactory::Get()->CreateAppActivity(app_window)); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 63 DevToolsWindow* devtools_window = DevToolsWindow::OpenDevToolsWindow( | 63 DevToolsWindow* devtools_window = DevToolsWindow::OpenDevToolsWindow( |
| 64 web_contents, DevToolsToggleAction::ShowConsole()); | 64 web_contents, DevToolsToggleAction::ShowConsole()); |
| 65 devtools_window->SetLoadCompletedCallback(callback); | 65 devtools_window->SetLoadCompletedCallback(callback); |
| 66 } | 66 } |
| 67 | 67 |
| 68 bool AthenaAppsClient::IsCurrentChannelOlderThanDev() { | 68 bool AthenaAppsClient::IsCurrentChannelOlderThanDev() { |
| 69 return extensions::GetCurrentChannel() > chrome::VersionInfo::CHANNEL_DEV; | 69 return extensions::GetCurrentChannel() > chrome::VersionInfo::CHANNEL_DEV; |
| 70 } | 70 } |
| 71 | 71 |
| 72 } // namespace athena | 72 } // namespace athena |
| OLD | NEW |