OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // Implements the Chrome Extensions Debugger API. | 5 // Implements the Chrome Extensions Debugger API. |
6 | 6 |
7 #include "chrome/browser/extensions/api/debugger/debugger_api.h" | 7 #include "chrome/browser/extensions/api/debugger/debugger_api.h" |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
518 if (!webkit_glue::IsInspectorProtocolVersionSupported( | 518 if (!webkit_glue::IsInspectorProtocolVersionSupported( |
519 params->required_version)) { | 519 params->required_version)) { |
520 error_ = ErrorUtils::FormatErrorMessage( | 520 error_ = ErrorUtils::FormatErrorMessage( |
521 keys::kProtocolVersionNotSupportedError, | 521 keys::kProtocolVersionNotSupportedError, |
522 params->required_version); | 522 params->required_version); |
523 return false; | 523 return false; |
524 } | 524 } |
525 | 525 |
526 scoped_refptr<DevToolsAgentHost> agent(DevToolsAgentHost::GetOrCreateFor( | 526 scoped_refptr<DevToolsAgentHost> agent(DevToolsAgentHost::GetOrCreateFor( |
527 contents_->GetRenderViewHost())); | 527 contents_->GetRenderViewHost())); |
528 DevToolsClientHost* client_host = DevToolsManager::GetInstance()-> | 528 if (agent->IsAttached()) { |
529 GetDevToolsClientHostFor(agent); | |
530 | |
531 if (client_host != NULL) { | |
532 FormatErrorMessage(keys::kAlreadyAttachedError); | 529 FormatErrorMessage(keys::kAlreadyAttachedError); |
533 return false; | 530 return false; |
534 } | 531 } |
535 | 532 |
536 new ExtensionDevToolsClientHost(contents_, | 533 new ExtensionDevToolsClientHost(contents_, |
537 GetExtension()->id(), | 534 GetExtension()->id(), |
538 GetExtension()->name(), | 535 GetExtension()->name(), |
539 debuggee_); | 536 debuggee_); |
540 SendResponse(true); | 537 SendResponse(true); |
541 return true; | 538 return true; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
585 } | 582 } |
586 | 583 |
587 DictionaryValue* result_body; | 584 DictionaryValue* result_body; |
588 SendCommand::Results::Result result; | 585 SendCommand::Results::Result result; |
589 if (response->GetDictionary("result", &result_body)) | 586 if (response->GetDictionary("result", &result_body)) |
590 result.additional_properties.Swap(result_body); | 587 result.additional_properties.Swap(result_body); |
591 | 588 |
592 results_ = SendCommand::Results::Create(result); | 589 results_ = SendCommand::Results::Create(result); |
593 SendResponse(true); | 590 SendResponse(true); |
594 } | 591 } |
OLD | NEW |