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 "chrome/browser/ui/apps/chrome_app_window_client.h" | 5 #include "chrome/browser/ui/apps/chrome_app_window_client.h" |
6 | 6 |
7 #include "base/memory/singleton.h" | 7 #include "base/memory/singleton.h" |
8 #include "chrome/browser/apps/scoped_keep_alive.h" | 8 #include "chrome/browser/apps/scoped_keep_alive.h" |
9 #include "chrome/browser/devtools/devtools_window.h" | 9 #include "chrome/browser/devtools/devtools_window.h" |
10 #include "chrome/common/extensions/features/feature_channel.h" | 10 #include "chrome/common/extensions/features/feature_channel.h" |
| 11 #include "content/public/browser/devtools_agent_host.h" |
11 #include "extensions/browser/app_window/app_window.h" | 12 #include "extensions/browser/app_window/app_window.h" |
12 #include "extensions/common/extension.h" | 13 #include "extensions/common/extension.h" |
13 | 14 |
14 // TODO(jamescook): We probably shouldn't compile this class at all on Android. | 15 // TODO(jamescook): We probably shouldn't compile this class at all on Android. |
15 // See http://crbug.com/343612 | 16 // See http://crbug.com/343612 |
16 #if !defined(OS_ANDROID) | 17 #if !defined(OS_ANDROID) |
17 #include "chrome/browser/ui/apps/chrome_app_delegate.h" | 18 #include "chrome/browser/ui/apps/chrome_app_delegate.h" |
18 #endif | 19 #endif |
19 | 20 |
20 ChromeAppWindowClient::ChromeAppWindowClient() { | 21 ChromeAppWindowClient::ChromeAppWindowClient() { |
(...skipping 27 matching lines...) Expand all Loading... |
48 #if defined(OS_ANDROID) | 49 #if defined(OS_ANDROID) |
49 return NULL; | 50 return NULL; |
50 #else | 51 #else |
51 return CreateNativeAppWindowImpl(window, *params); | 52 return CreateNativeAppWindowImpl(window, *params); |
52 #endif | 53 #endif |
53 } | 54 } |
54 | 55 |
55 void ChromeAppWindowClient::OpenDevToolsWindow( | 56 void ChromeAppWindowClient::OpenDevToolsWindow( |
56 content::WebContents* web_contents, | 57 content::WebContents* web_contents, |
57 const base::Closure& callback) { | 58 const base::Closure& callback) { |
58 DevToolsWindow* devtools_window = DevToolsWindow::OpenDevToolsWindow( | 59 scoped_refptr<content::DevToolsAgentHost> agent( |
59 web_contents, DevToolsToggleAction::ShowConsole()); | 60 content::DevToolsAgentHost::GetOrCreateFor(web_contents)); |
60 devtools_window->SetLoadCompletedCallback(callback); | 61 DevToolsWindow::OpenDevToolsWindow(web_contents); |
| 62 |
| 63 DevToolsWindow* devtools_window = |
| 64 DevToolsWindow::FindDevToolsWindow(agent.get()); |
| 65 if (devtools_window) |
| 66 devtools_window->SetLoadCompletedCallback(callback); |
| 67 else |
| 68 callback.Run(); |
61 } | 69 } |
62 | 70 |
63 bool ChromeAppWindowClient::IsCurrentChannelOlderThanDev() { | 71 bool ChromeAppWindowClient::IsCurrentChannelOlderThanDev() { |
64 return extensions::GetCurrentChannel() > chrome::VersionInfo::CHANNEL_DEV; | 72 return extensions::GetCurrentChannel() > chrome::VersionInfo::CHANNEL_DEV; |
65 } | 73 } |
OLD | NEW |