| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/android/devtools_manager_delegate_android.h" | 5 #include "chrome/browser/android/devtools_manager_delegate_android.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 std::string DevToolsManagerDelegateAndroid::GetTargetType( | 179 std::string DevToolsManagerDelegateAndroid::GetTargetType( |
| 180 content::RenderFrameHost* host) { | 180 content::RenderFrameHost* host) { |
| 181 content::WebContents* web_contents = | 181 content::WebContents* web_contents = |
| 182 content::WebContents::FromRenderFrameHost(host); | 182 content::WebContents::FromRenderFrameHost(host); |
| 183 TabAndroid* tab = web_contents ? TabAndroid::FromWebContents(web_contents) | 183 TabAndroid* tab = web_contents ? TabAndroid::FromWebContents(web_contents) |
| 184 : nullptr; | 184 : nullptr; |
| 185 return tab ? DevToolsAgentHost::kTypePage : | 185 return tab ? DevToolsAgentHost::kTypePage : |
| 186 DevToolsAgentHost::kTypeOther; | 186 DevToolsAgentHost::kTypeOther; |
| 187 } | 187 } |
| 188 | 188 |
| 189 std::string DevToolsManagerDelegateAndroid::GetTargetTitle( | |
| 190 content::RenderFrameHost* host) { | |
| 191 content::WebContents* web_contents = | |
| 192 content::WebContents::FromRenderFrameHost(host); | |
| 193 TabAndroid* tab = TabAndroid::FromWebContents(web_contents); | |
| 194 return tab ? base::UTF16ToUTF8(tab->GetTitle()) : ""; | |
| 195 } | |
| 196 | |
| 197 bool DevToolsManagerDelegateAndroid::DiscoverTargets( | 189 bool DevToolsManagerDelegateAndroid::DiscoverTargets( |
| 198 const DevToolsAgentHost::DiscoveryCallback& callback) { | 190 const DevToolsAgentHost::DiscoveryCallback& callback) { |
| 199 #if defined(OS_ANDROID) | 191 #if defined(OS_ANDROID) |
| 200 // Enumerate existing tabs, including the ones with no WebContents. | 192 // Enumerate existing tabs, including the ones with no WebContents. |
| 201 DevToolsAgentHost::List result; | 193 DevToolsAgentHost::List result; |
| 202 std::set<WebContents*> tab_web_contents; | 194 std::set<WebContents*> tab_web_contents; |
| 203 for (TabModelList::const_iterator iter = TabModelList::begin(); | 195 for (TabModelList::const_iterator iter = TabModelList::begin(); |
| 204 iter != TabModelList::end(); ++iter) { | 196 iter != TabModelList::end(); ++iter) { |
| 205 TabModel* model = *iter; | 197 TabModel* model = *iter; |
| 206 for (int i = 0; i < model->GetTabCount(); ++i) { | 198 for (int i = 0; i < model->GetTabCount(); ++i) { |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 | 258 |
| 267 void DevToolsManagerDelegateAndroid::DevToolsAgentHostAttached( | 259 void DevToolsManagerDelegateAndroid::DevToolsAgentHostAttached( |
| 268 content::DevToolsAgentHost* agent_host) { | 260 content::DevToolsAgentHost* agent_host) { |
| 269 network_protocol_handler_->DevToolsAgentStateChanged(agent_host, true); | 261 network_protocol_handler_->DevToolsAgentStateChanged(agent_host, true); |
| 270 } | 262 } |
| 271 | 263 |
| 272 void DevToolsManagerDelegateAndroid::DevToolsAgentHostDetached( | 264 void DevToolsManagerDelegateAndroid::DevToolsAgentHostDetached( |
| 273 content::DevToolsAgentHost* agent_host) { | 265 content::DevToolsAgentHost* agent_host) { |
| 274 network_protocol_handler_->DevToolsAgentStateChanged(agent_host, false); | 266 network_protocol_handler_->DevToolsAgentStateChanged(agent_host, false); |
| 275 } | 267 } |
| OLD | NEW |