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 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
522 extension_host->GetURL(), | 522 extension_host->GetURL(), |
523 extension(), | 523 extension(), |
524 &error_)) { | 524 &error_)) { |
525 return false; | 525 return false; |
526 } | 526 } |
527 agent_host_ = | 527 agent_host_ = |
528 DevToolsAgentHost::GetOrCreateFor(extension_host->host_contents()); | 528 DevToolsAgentHost::GetOrCreateFor(extension_host->host_contents()); |
529 } | 529 } |
530 } else if (debuggee_.target_id) { | 530 } else if (debuggee_.target_id) { |
531 agent_host_ = DevToolsAgentHost::GetForId(*debuggee_.target_id); | 531 agent_host_ = DevToolsAgentHost::GetForId(*debuggee_.target_id); |
| 532 if (agent_host_.get()) { |
| 533 if (PermissionsData::IsRestrictedUrl(agent_host_->GetURL(), |
| 534 agent_host_->GetURL(), |
| 535 extension(), |
| 536 &error_)) { |
| 537 agent_host_ = nullptr; |
| 538 return false; |
| 539 } |
| 540 } |
532 } else { | 541 } else { |
533 error_ = keys::kInvalidTargetError; | 542 error_ = keys::kInvalidTargetError; |
534 return false; | 543 return false; |
535 } | 544 } |
536 | 545 |
537 if (!agent_host_.get()) { | 546 if (!agent_host_.get()) { |
538 FormatErrorMessage(keys::kNoTargetError); | 547 FormatErrorMessage(keys::kNoTargetError); |
539 return false; | 548 return false; |
540 } | 549 } |
541 return true; | 550 return true; |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
734 const std::vector<DevToolsTargetImpl*>& target_list) { | 743 const std::vector<DevToolsTargetImpl*>& target_list) { |
735 scoped_ptr<base::ListValue> result(new base::ListValue()); | 744 scoped_ptr<base::ListValue> result(new base::ListValue()); |
736 for (size_t i = 0; i < target_list.size(); ++i) | 745 for (size_t i = 0; i < target_list.size(); ++i) |
737 result->Append(SerializeTarget(*target_list[i])); | 746 result->Append(SerializeTarget(*target_list[i])); |
738 STLDeleteContainerPointers(target_list.begin(), target_list.end()); | 747 STLDeleteContainerPointers(target_list.begin(), target_list.end()); |
739 SetResult(result.release()); | 748 SetResult(result.release()); |
740 SendResponse(true); | 749 SendResponse(true); |
741 } | 750 } |
742 | 751 |
743 } // namespace extensions | 752 } // namespace extensions |
OLD | NEW |