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

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

Issue 563083003: V2 app support step3: Athena's NativeAppWindow (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 "athena/extensions/chrome/athena_apps_client.h" 5 #include "athena/extensions/chrome/athena_chrome_apps_client.h"
6 6
7 #include "athena/activity/public/activity_factory.h" 7 #include "athena/extensions/chrome/athena_chrome_app_delegate.h"
8 #include "athena/activity/public/activity_manager.h"
9 #include "athena/extensions/chrome/athena_app_delegate.h"
10 #include "base/memory/singleton.h" 8 #include "base/memory/singleton.h"
11 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
12 #include "chrome/browser/devtools/devtools_window.h" 10 #include "chrome/browser/devtools/devtools_window.h"
13 #include "chrome/browser/profiles/profile_manager.h" 11 #include "chrome/browser/profiles/profile_manager.h"
14 #include "chrome/browser/ui/views/apps/chrome_native_app_window_views.h"
15 #include "chrome/common/extensions/features/feature_channel.h" 12 #include "chrome/common/extensions/features/feature_channel.h"
16 #include "extensions/browser/app_window/app_window.h" 13 #include "extensions/browser/app_window/app_window.h"
17 #include "extensions/common/extension.h" 14 //#include "extensions/common/extension.h"
Jun Mukai 2014/09/18 17:38:05 remove commented-out includes
oshima 2014/09/18 18:16:28 Done.
18 15
19 namespace athena { 16 namespace athena {
20 namespace {
21 17
22 // A short term hack to get WebView from ChromeNativeAppWindowViews. 18 AthenaChromeAppsClient::AthenaChromeAppsClient() {
23 // TODO(oshima): Implement athena's NativeAppWindow.
24 class AthenaNativeAppWindowViews : public ChromeNativeAppWindowViews {
25 public:
26 AthenaNativeAppWindowViews() {}
27 virtual ~AthenaNativeAppWindowViews() {}
28
29 views::WebView* GetWebView() {
30 return web_view();
31 }
32
33 private:
34 DISALLOW_COPY_AND_ASSIGN(AthenaNativeAppWindowViews);
35 };
36
37 } // namespace
38
39 AthenaAppsClient::AthenaAppsClient() {
40 } 19 }
41 20
42 AthenaAppsClient::~AthenaAppsClient() { 21 AthenaChromeAppsClient::~AthenaChromeAppsClient() {
43 } 22 }
44 23
45 std::vector<content::BrowserContext*> 24 std::vector<content::BrowserContext*>
46 AthenaAppsClient::GetLoadedBrowserContexts() { 25 AthenaChromeAppsClient::GetLoadedBrowserContexts() {
47 std::vector<Profile*> profiles = 26 std::vector<Profile*> profiles =
48 g_browser_process->profile_manager()->GetLoadedProfiles(); 27 g_browser_process->profile_manager()->GetLoadedProfiles();
49 return std::vector<content::BrowserContext*>(profiles.begin(), 28 return std::vector<content::BrowserContext*>(profiles.begin(),
50 profiles.end()); 29 profiles.end());
51 } 30 }
52 31
53 extensions::AppWindow* AthenaAppsClient::CreateAppWindow( 32 extensions::AppWindow* AthenaChromeAppsClient::CreateAppWindow(
54 content::BrowserContext* context, 33 content::BrowserContext* context,
55 const extensions::Extension* extension) { 34 const extensions::Extension* extension) {
56 return new extensions::AppWindow(context, new AthenaAppDelegate, extension); 35 return new extensions::AppWindow(
36 context, new AthenaChromeAppDelegate, extension);
57 } 37 }
58 38
59 extensions::NativeAppWindow* AthenaAppsClient::CreateNativeAppWindow( 39 void AthenaChromeAppsClient::OpenDevToolsWindow(
60 extensions::AppWindow* app_window, 40 content::WebContents* web_contents,
61 const extensions::AppWindow::CreateParams& params) { 41 const base::Closure& callback) {
62 AthenaNativeAppWindowViews* native_window = new AthenaNativeAppWindowViews;
63 native_window->Init(app_window, params);
64 Activity* app_activity = ActivityFactory::Get()->CreateAppActivity(
65 app_window, native_window->GetWebView());
66 ActivityManager::Get()->AddActivity(app_activity);
67 return native_window;
68 }
69
70 void AthenaAppsClient::IncrementKeepAliveCount() {
71 // No need to keep track of KeepAlive count on ChromeOS.
72 }
73
74 void AthenaAppsClient::DecrementKeepAliveCount() {
75 // No need to keep track of KeepAlive count on ChromeOS.
76 }
77
78 void AthenaAppsClient::OpenDevToolsWindow(content::WebContents* web_contents,
79 const base::Closure& callback) {
80 // TODO(oshima): Figure out what to do. 42 // TODO(oshima): Figure out what to do.
81 DevToolsWindow* devtools_window = DevToolsWindow::OpenDevToolsWindow( 43 DevToolsWindow* devtools_window = DevToolsWindow::OpenDevToolsWindow(
82 web_contents, DevToolsToggleAction::ShowConsole()); 44 web_contents, DevToolsToggleAction::ShowConsole());
83 devtools_window->SetLoadCompletedCallback(callback); 45 devtools_window->SetLoadCompletedCallback(callback);
84 } 46 }
85 47
86 bool AthenaAppsClient::IsCurrentChannelOlderThanDev() { 48 bool AthenaChromeAppsClient::IsCurrentChannelOlderThanDev() {
87 return extensions::GetCurrentChannel() > chrome::VersionInfo::CHANNEL_DEV; 49 return extensions::GetCurrentChannel() > chrome::VersionInfo::CHANNEL_DEV;
88 } 50 }
89 51
90 } // namespace athena 52 } // namespace athena
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698