| 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 "chromecast/browser/devtools/cast_devtools_manager_delegate.h" | 5 #include "chromecast/browser/devtools/cast_devtools_manager_delegate.h" |
| 6 | 6 |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 #include "content/public/browser/devtools_agent_host.h" | 9 #include "content/public/browser/devtools_agent_host.h" |
| 10 #include "grit/shell_resources.h" | 10 #include "grit/shell_resources.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 } | 29 } |
| 30 | 30 |
| 31 CastDevToolsManagerDelegate::~CastDevToolsManagerDelegate() { | 31 CastDevToolsManagerDelegate::~CastDevToolsManagerDelegate() { |
| 32 DCHECK_EQ(this, g_devtools_manager_delegate); | 32 DCHECK_EQ(this, g_devtools_manager_delegate); |
| 33 g_devtools_manager_delegate = nullptr; | 33 g_devtools_manager_delegate = nullptr; |
| 34 } | 34 } |
| 35 | 35 |
| 36 bool CastDevToolsManagerDelegate::DiscoverTargets( | 36 bool CastDevToolsManagerDelegate::DiscoverTargets( |
| 37 const content::DevToolsAgentHost::DiscoveryCallback& callback) { | 37 const content::DevToolsAgentHost::DiscoveryCallback& callback) { |
| 38 content::DevToolsAgentHost::List enabled_hosts; | 38 content::DevToolsAgentHost::List enabled_hosts; |
| 39 for (const auto& web_contents : enabled_webcontents_) { | 39 for (auto* web_contents : enabled_webcontents_) { |
| 40 enabled_hosts.push_back( | 40 enabled_hosts.push_back( |
| 41 content::DevToolsAgentHost::GetOrCreateFor(web_contents)); | 41 content::DevToolsAgentHost::GetOrCreateFor(web_contents)); |
| 42 } | 42 } |
| 43 callback.Run(enabled_hosts); | 43 callback.Run(enabled_hosts); |
| 44 return true; | 44 return true; |
| 45 } | 45 } |
| 46 | 46 |
| 47 void CastDevToolsManagerDelegate::EnableWebContentsForDebugging( | 47 void CastDevToolsManagerDelegate::EnableWebContentsForDebugging( |
| 48 content::WebContents* web_contents) { | 48 content::WebContents* web_contents) { |
| 49 DCHECK(web_contents); | 49 DCHECK(web_contents); |
| 50 enabled_webcontents_.insert(web_contents); | 50 enabled_webcontents_.insert(web_contents); |
| 51 } | 51 } |
| 52 | 52 |
| 53 void CastDevToolsManagerDelegate::DisableWebContentsForDebugging( | 53 void CastDevToolsManagerDelegate::DisableWebContentsForDebugging( |
| 54 content::WebContents* web_contents) { | 54 content::WebContents* web_contents) { |
| 55 enabled_webcontents_.erase(web_contents); | 55 enabled_webcontents_.erase(web_contents); |
| 56 } | 56 } |
| 57 | 57 |
| 58 std::string CastDevToolsManagerDelegate::GetDiscoveryPageHTML() { | 58 std::string CastDevToolsManagerDelegate::GetDiscoveryPageHTML() { |
| 59 #if defined(OS_ANDROID) | 59 #if defined(OS_ANDROID) |
| 60 return std::string(); | 60 return std::string(); |
| 61 #else | 61 #else |
| 62 return ResourceBundle::GetSharedInstance().GetRawDataResource( | 62 return ResourceBundle::GetSharedInstance().GetRawDataResource( |
| 63 IDR_CAST_SHELL_DEVTOOLS_DISCOVERY_PAGE).as_string(); | 63 IDR_CAST_SHELL_DEVTOOLS_DISCOVERY_PAGE).as_string(); |
| 64 #endif | 64 #endif |
| 65 } | 65 } |
| 66 | 66 |
| 67 } // namespace shell | 67 } // namespace shell |
| 68 } // namespace chromecast | 68 } // namespace chromecast |
| OLD | NEW |