| 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 27 matching lines...) Expand all Loading... |
| 38 #include "content/public/browser/render_process_host.h" | 38 #include "content/public/browser/render_process_host.h" |
| 39 #include "content/public/browser/render_view_host.h" | 39 #include "content/public/browser/render_view_host.h" |
| 40 #include "content/public/browser/render_widget_host.h" | 40 #include "content/public/browser/render_widget_host.h" |
| 41 #include "content/public/browser/web_contents.h" | 41 #include "content/public/browser/web_contents.h" |
| 42 #include "content/public/common/content_client.h" | 42 #include "content/public/common/content_client.h" |
| 43 #include "content/public/common/url_utils.h" | 43 #include "content/public/common/url_utils.h" |
| 44 #include "extensions/browser/event_router.h" | 44 #include "extensions/browser/event_router.h" |
| 45 #include "extensions/browser/extension_host.h" | 45 #include "extensions/browser/extension_host.h" |
| 46 #include "extensions/browser/extension_registry.h" | 46 #include "extensions/browser/extension_registry.h" |
| 47 #include "extensions/browser/extension_registry_observer.h" | 47 #include "extensions/browser/extension_registry_observer.h" |
| 48 #include "extensions/browser/extension_system.h" | |
| 49 #include "extensions/common/constants.h" | 48 #include "extensions/common/constants.h" |
| 50 #include "extensions/common/error_utils.h" | 49 #include "extensions/common/error_utils.h" |
| 51 #include "extensions/common/extension.h" | 50 #include "extensions/common/extension.h" |
| 52 #include "extensions/common/manifest_constants.h" | 51 #include "extensions/common/manifest_constants.h" |
| 53 #include "extensions/common/permissions/permissions_data.h" | 52 #include "extensions/common/permissions/permissions_data.h" |
| 54 #include "extensions/common/switches.h" | 53 #include "extensions/common/switches.h" |
| 55 #include "ui/base/l10n/l10n_util.h" | 54 #include "ui/base/l10n/l10n_util.h" |
| 56 | 55 |
| 57 using content::DevToolsAgentHost; | 56 using content::DevToolsAgentHost; |
| 58 using content::DevToolsHttpHandler; | 57 using content::DevToolsHttpHandler; |
| (...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 509 NULL); | 508 NULL); |
| 510 if (result && web_contents) { | 509 if (result && web_contents) { |
| 511 // TODO(rdevlin.cronin) This should definitely be GetLastCommittedURL(). | 510 // TODO(rdevlin.cronin) This should definitely be GetLastCommittedURL(). |
| 512 GURL url = web_contents->GetVisibleURL(); | 511 GURL url = web_contents->GetVisibleURL(); |
| 513 if (PermissionsData::IsRestrictedUrl(url, url, extension(), &error_)) | 512 if (PermissionsData::IsRestrictedUrl(url, url, extension(), &error_)) |
| 514 return false; | 513 return false; |
| 515 agent_host_ = DevToolsAgentHost::GetOrCreateFor(web_contents); | 514 agent_host_ = DevToolsAgentHost::GetOrCreateFor(web_contents); |
| 516 } | 515 } |
| 517 } else if (debuggee_.extension_id) { | 516 } else if (debuggee_.extension_id) { |
| 518 ExtensionHost* extension_host = | 517 ExtensionHost* extension_host = |
| 519 ExtensionSystem::Get(GetProfile()) | 518 ProcessManager::Get(GetProfile()) |
| 520 ->process_manager() | |
| 521 ->GetBackgroundHostForExtension(*debuggee_.extension_id); | 519 ->GetBackgroundHostForExtension(*debuggee_.extension_id); |
| 522 if (extension_host) { | 520 if (extension_host) { |
| 523 if (PermissionsData::IsRestrictedUrl(extension_host->GetURL(), | 521 if (PermissionsData::IsRestrictedUrl(extension_host->GetURL(), |
| 524 extension_host->GetURL(), | 522 extension_host->GetURL(), |
| 525 extension(), | 523 extension(), |
| 526 &error_)) { | 524 &error_)) { |
| 527 return false; | 525 return false; |
| 528 } | 526 } |
| 529 agent_host_ = | 527 agent_host_ = |
| 530 DevToolsAgentHost::GetOrCreateFor(extension_host->host_contents()); | 528 DevToolsAgentHost::GetOrCreateFor(extension_host->host_contents()); |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 736 const std::vector<DevToolsTargetImpl*>& target_list) { | 734 const std::vector<DevToolsTargetImpl*>& target_list) { |
| 737 scoped_ptr<base::ListValue> result(new base::ListValue()); | 735 scoped_ptr<base::ListValue> result(new base::ListValue()); |
| 738 for (size_t i = 0; i < target_list.size(); ++i) | 736 for (size_t i = 0; i < target_list.size(); ++i) |
| 739 result->Append(SerializeTarget(*target_list[i])); | 737 result->Append(SerializeTarget(*target_list[i])); |
| 740 STLDeleteContainerPointers(target_list.begin(), target_list.end()); | 738 STLDeleteContainerPointers(target_list.begin(), target_list.end()); |
| 741 SetResult(result.release()); | 739 SetResult(result.release()); |
| 742 SendResponse(true); | 740 SendResponse(true); |
| 743 } | 741 } |
| 744 | 742 |
| 745 } // namespace extensions | 743 } // namespace extensions |
| OLD | NEW |