| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 } | 78 } |
| 79 | 79 |
| 80 GURL GetURL() override { | 80 GURL GetURL() override { |
| 81 return agent_host_ ? agent_host_->GetURL() : url_; | 81 return agent_host_ ? agent_host_->GetURL() : url_; |
| 82 } | 82 } |
| 83 | 83 |
| 84 GURL GetFaviconURL() override { | 84 GURL GetFaviconURL() override { |
| 85 return agent_host_ ? agent_host_->GetFaviconURL() : GURL(); | 85 return agent_host_ ? agent_host_->GetFaviconURL() : GURL(); |
| 86 } | 86 } |
| 87 | 87 |
| 88 std::string GetFrontendURL() override { |
| 89 return std::string(); |
| 90 } |
| 91 |
| 88 bool Activate() override { | 92 bool Activate() override { |
| 89 TabModel* model; | 93 TabModel* model; |
| 90 int index; | 94 int index; |
| 91 if (!FindTab(&model, &index)) | 95 if (!FindTab(&model, &index)) |
| 92 return false; | 96 return false; |
| 93 model->SetActiveIndex(index); | 97 model->SetActiveIndex(index); |
| 94 return true; | 98 return true; |
| 95 } | 99 } |
| 96 | 100 |
| 97 bool Inspect() override { | |
| 98 MaterializeAgentHost(); | |
| 99 if (agent_host_) | |
| 100 return agent_host_->Inspect(); | |
| 101 return false; | |
| 102 } | |
| 103 | |
| 104 void Reload() override { | 101 void Reload() override { |
| 105 MaterializeAgentHost(); | 102 MaterializeAgentHost(); |
| 106 if (agent_host_) | 103 if (agent_host_) |
| 107 agent_host_->Reload(); | 104 agent_host_->Reload(); |
| 108 } | 105 } |
| 109 | 106 |
| 110 bool Close() override { | 107 bool Close() override { |
| 111 TabModel* model; | 108 TabModel* model; |
| 112 int index; | 109 int index; |
| 113 if (!FindTab(&model, &index)) | 110 if (!FindTab(&model, &index)) |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 | 158 |
| 162 } // namespace | 159 } // namespace |
| 163 | 160 |
| 164 DevToolsManagerDelegateAndroid::DevToolsManagerDelegateAndroid() | 161 DevToolsManagerDelegateAndroid::DevToolsManagerDelegateAndroid() |
| 165 : network_protocol_handler_(new DevToolsNetworkProtocolHandler()) { | 162 : network_protocol_handler_(new DevToolsNetworkProtocolHandler()) { |
| 166 } | 163 } |
| 167 | 164 |
| 168 DevToolsManagerDelegateAndroid::~DevToolsManagerDelegateAndroid() { | 165 DevToolsManagerDelegateAndroid::~DevToolsManagerDelegateAndroid() { |
| 169 } | 166 } |
| 170 | 167 |
| 171 void DevToolsManagerDelegateAndroid::Inspect( | |
| 172 DevToolsAgentHost* agent_host) { | |
| 173 } | |
| 174 | |
| 175 base::DictionaryValue* DevToolsManagerDelegateAndroid::HandleCommand( | 168 base::DictionaryValue* DevToolsManagerDelegateAndroid::HandleCommand( |
| 176 DevToolsAgentHost* agent_host, | 169 DevToolsAgentHost* agent_host, |
| 177 base::DictionaryValue* command_dict) { | 170 base::DictionaryValue* command_dict) { |
| 178 return network_protocol_handler_->HandleCommand(agent_host, command_dict); | 171 return network_protocol_handler_->HandleCommand(agent_host, command_dict); |
| 179 } | 172 } |
| 180 | 173 |
| 181 std::string DevToolsManagerDelegateAndroid::GetTargetType( | 174 std::string DevToolsManagerDelegateAndroid::GetTargetType( |
| 182 content::RenderFrameHost* host) { | 175 content::RenderFrameHost* host) { |
| 183 content::WebContents* web_contents = | 176 content::WebContents* web_contents = |
| 184 content::WebContents::FromRenderFrameHost(host); | 177 content::WebContents::FromRenderFrameHost(host); |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 | 256 |
| 264 std::string DevToolsManagerDelegateAndroid::GetDiscoveryPageHTML() { | 257 std::string DevToolsManagerDelegateAndroid::GetDiscoveryPageHTML() { |
| 265 return ResourceBundle::GetSharedInstance().GetRawDataResource( | 258 return ResourceBundle::GetSharedInstance().GetRawDataResource( |
| 266 IDR_DEVTOOLS_DISCOVERY_PAGE_HTML).as_string(); | 259 IDR_DEVTOOLS_DISCOVERY_PAGE_HTML).as_string(); |
| 267 } | 260 } |
| 268 | 261 |
| 269 void DevToolsManagerDelegateAndroid::DevToolsAgentStateChanged( | 262 void DevToolsManagerDelegateAndroid::DevToolsAgentStateChanged( |
| 270 DevToolsAgentHost* agent_host, bool attached) { | 263 DevToolsAgentHost* agent_host, bool attached) { |
| 271 network_protocol_handler_->DevToolsAgentStateChanged(agent_host, attached); | 264 network_protocol_handler_->DevToolsAgentStateChanged(agent_host, attached); |
| 272 } | 265 } |
| OLD | NEW |