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_chrome_app_window_client.h" | 5 #include "athena/extensions/chrome/athena_chrome_app_window_client.h" |
6 | 6 |
7 #include "athena/extensions/chrome/athena_chrome_app_delegate.h" | 7 #include "athena/extensions/chrome/athena_chrome_app_delegate.h" |
8 #include "base/memory/singleton.h" | |
9 #include "chrome/browser/browser_process.h" | |
10 #include "chrome/browser/devtools/devtools_window.h" | 8 #include "chrome/browser/devtools/devtools_window.h" |
11 #include "chrome/browser/profiles/profile_manager.h" | |
12 #include "chrome/common/extensions/features/feature_channel.h" | 9 #include "chrome/common/extensions/features/feature_channel.h" |
13 #include "extensions/browser/app_window/app_window.h" | 10 #include "extensions/browser/app_window/app_window.h" |
14 | 11 |
15 namespace athena { | 12 namespace athena { |
16 | 13 |
17 AthenaChromeAppWindowClient::AthenaChromeAppWindowClient() { | 14 AthenaChromeAppWindowClient::AthenaChromeAppWindowClient() { |
18 } | 15 } |
19 | 16 |
20 AthenaChromeAppWindowClient::~AthenaChromeAppWindowClient() { | 17 AthenaChromeAppWindowClient::~AthenaChromeAppWindowClient() { |
21 } | 18 } |
22 | 19 |
23 std::vector<content::BrowserContext*> | |
24 AthenaChromeAppWindowClient::GetLoadedBrowserContexts() { | |
25 std::vector<Profile*> profiles = | |
26 g_browser_process->profile_manager()->GetLoadedProfiles(); | |
27 return std::vector<content::BrowserContext*>(profiles.begin(), | |
28 profiles.end()); | |
29 } | |
30 | |
31 extensions::AppWindow* AthenaChromeAppWindowClient::CreateAppWindow( | 20 extensions::AppWindow* AthenaChromeAppWindowClient::CreateAppWindow( |
32 content::BrowserContext* context, | 21 content::BrowserContext* context, |
33 const extensions::Extension* extension) { | 22 const extensions::Extension* extension) { |
34 return new extensions::AppWindow( | 23 return new extensions::AppWindow( |
35 context, new AthenaChromeAppDelegate, extension); | 24 context, new AthenaChromeAppDelegate, extension); |
36 } | 25 } |
37 | 26 |
38 void AthenaChromeAppWindowClient::OpenDevToolsWindow( | 27 void AthenaChromeAppWindowClient::OpenDevToolsWindow( |
39 content::WebContents* web_contents, | 28 content::WebContents* web_contents, |
40 const base::Closure& callback) { | 29 const base::Closure& callback) { |
41 // TODO(oshima): Figure out what to do. | 30 // TODO(oshima): Figure out what to do. |
42 DevToolsWindow* devtools_window = DevToolsWindow::OpenDevToolsWindow( | 31 DevToolsWindow* devtools_window = DevToolsWindow::OpenDevToolsWindow( |
43 web_contents, DevToolsToggleAction::ShowConsole()); | 32 web_contents, DevToolsToggleAction::ShowConsole()); |
44 devtools_window->SetLoadCompletedCallback(callback); | 33 devtools_window->SetLoadCompletedCallback(callback); |
45 } | 34 } |
46 | 35 |
47 bool AthenaChromeAppWindowClient::IsCurrentChannelOlderThanDev() { | 36 bool AthenaChromeAppWindowClient::IsCurrentChannelOlderThanDev() { |
48 return extensions::GetCurrentChannel() > chrome::VersionInfo::CHANNEL_DEV; | 37 return extensions::GetCurrentChannel() > chrome::VersionInfo::CHANNEL_DEV; |
49 } | 38 } |
50 | 39 |
51 } // namespace athena | 40 } // namespace athena |
OLD | NEW |