Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(344)

Side by Side Diff: athena/extensions/chrome/athena_apps_client.cc

Issue 514293003: Run athena on chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_apps_client.h" 5 #include "athena/extensions/chrome/athena_apps_client.h"
6 6
7 #include "apps/app_window.h" 7 #include "apps/app_window.h"
8 #include "athena/activity/public/activity_factory.h"
9 #include "athena/activity/public/activity_manager.h"
8 #include "base/memory/singleton.h" 10 #include "base/memory/singleton.h"
9 #include "chrome/browser/browser_process.h" 11 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/devtools/devtools_window.h" 12 #include "chrome/browser/devtools/devtools_window.h"
11 #include "chrome/browser/profiles/profile_manager.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"
12 #include "chrome/common/extensions/features/feature_channel.h" 16 #include "chrome/common/extensions/features/feature_channel.h"
13 #include "extensions/common/extension.h" 17 #include "extensions/common/extension.h"
14 18
15 // TODO(jamescook): We probably shouldn't compile this class at all on Android. 19 namespace athena {
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 20
22 ChromeAppsClient::ChromeAppsClient() { 21 AthenaAppsClient::AthenaAppsClient() {
23 } 22 }
24 23
25 ChromeAppsClient::~ChromeAppsClient() { 24 AthenaAppsClient::~AthenaAppsClient() {
26 }
27
28 // static
29 ChromeAppsClient* ChromeAppsClient::GetInstance() {
30 return Singleton<ChromeAppsClient,
31 LeakySingletonTraits<ChromeAppsClient> >::get();
32 } 25 }
33 26
34 std::vector<content::BrowserContext*> 27 std::vector<content::BrowserContext*>
35 ChromeAppsClient::GetLoadedBrowserContexts() { 28 AthenaAppsClient::GetLoadedBrowserContexts() {
36 std::vector<Profile*> profiles = 29 std::vector<Profile*> profiles =
37 g_browser_process->profile_manager()->GetLoadedProfiles(); 30 g_browser_process->profile_manager()->GetLoadedProfiles();
38 return std::vector<content::BrowserContext*>(profiles.begin(), 31 return std::vector<content::BrowserContext*>(profiles.begin(),
39 profiles.end()); 32 profiles.end());
40 } 33 }
41 34
42 apps::AppWindow* ChromeAppsClient::CreateAppWindow( 35 apps::AppWindow* AthenaAppsClient::CreateAppWindow(
43 content::BrowserContext* context, 36 content::BrowserContext* context,
44 const extensions::Extension* extension) { 37 const extensions::Extension* extension) {
45 #if defined(OS_ANDROID)
46 return NULL;
47 #else
48 return new apps::AppWindow(context, new ChromeAppDelegate, extension); 38 return new apps::AppWindow(context, new ChromeAppDelegate, extension);
49 #endif
50 } 39 }
51 40
52 extensions::NativeAppWindow* ChromeAppsClient::CreateNativeAppWindow( 41 extensions::NativeAppWindow* AthenaAppsClient::CreateNativeAppWindow(
53 apps::AppWindow* window, 42 apps::AppWindow* app_window,
54 const apps::AppWindow::CreateParams& params) { 43 const apps::AppWindow::CreateParams& params) {
55 #if defined(OS_ANDROID) 44 // TODO(oshima): Implement athena's native appwindow.
56 return NULL; 45 ChromeNativeAppWindowViews* window = new ChromeNativeAppWindowViews;
57 #else 46 window->Init(app_window, params);
58 return CreateNativeAppWindowImpl(window, params); 47 athena::ActivityManager::Get()->AddActivity(
59 #endif 48 athena::ActivityFactory::Get()->CreateAppActivity(app_window));
49 return window;
60 } 50 }
61 51
62 void ChromeAppsClient::IncrementKeepAliveCount() { 52 void AthenaAppsClient::IncrementKeepAliveCount() {
63 #if !defined(OS_ANDROID) 53 // No need to keep track of KeepAlive count on ChromeOS
64 chrome::IncrementKeepAliveCount();
65 #endif
66 } 54 }
67 55
68 void ChromeAppsClient::DecrementKeepAliveCount() { 56 void AthenaAppsClient::DecrementKeepAliveCount() {
69 #if !defined(OS_ANDROID) 57 // No need to keep track of KeepAlive count on ChromeOS
70 chrome::DecrementKeepAliveCount();
71 #endif
72 } 58 }
73 59
74 void ChromeAppsClient::OpenDevToolsWindow(content::WebContents* web_contents, 60 void AthenaAppsClient::OpenDevToolsWindow(content::WebContents* web_contents,
75 const base::Closure& callback) { 61 const base::Closure& callback) {
62 // TODO(oshima): Figure out what to do.
Mr4D (OOO till 08-26) 2014/08/29 00:09:58 Indeed. this feels rather odd. Do we want to have
oshima 2014/08/29 00:44:42 We definitely need dev tools even on athena. Quest
76 DevToolsWindow* devtools_window = DevToolsWindow::OpenDevToolsWindow( 63 DevToolsWindow* devtools_window = DevToolsWindow::OpenDevToolsWindow(
77 web_contents, DevToolsToggleAction::ShowConsole()); 64 web_contents, DevToolsToggleAction::ShowConsole());
78 devtools_window->SetLoadCompletedCallback(callback); 65 devtools_window->SetLoadCompletedCallback(callback);
79 } 66 }
80 67
81 bool ChromeAppsClient::IsCurrentChannelOlderThanDev() { 68 bool AthenaAppsClient::IsCurrentChannelOlderThanDev() {
82 return extensions::GetCurrentChannel() > chrome::VersionInfo::CHANNEL_DEV; 69 return extensions::GetCurrentChannel() > chrome::VersionInfo::CHANNEL_DEV;
83 } 70 }
71
72 } // namespace athena
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698