| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/devtools/chrome_devtools_manager_delegate.h" | 5 #include "chrome/browser/devtools/chrome_devtools_manager_delegate.h" |
| 6 | 6 |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 #include "chrome/browser/devtools/devtools_network_protocol_handler.h" | 9 #include "chrome/browser/devtools/devtools_network_protocol_handler.h" |
| 10 #include "chrome/browser/devtools/devtools_window.h" | 10 #include "chrome/browser/devtools/devtools_window.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 content::WebContents* web_contents = | 63 content::WebContents* web_contents = |
| 64 content::WebContents::FromRenderFrameHost(host); | 64 content::WebContents::FromRenderFrameHost(host); |
| 65 | 65 |
| 66 guest_view::GuestViewBase* guest = | 66 guest_view::GuestViewBase* guest = |
| 67 guest_view::GuestViewBase::FromWebContents(web_contents); | 67 guest_view::GuestViewBase::FromWebContents(web_contents); |
| 68 content::WebContents* guest_contents = | 68 content::WebContents* guest_contents = |
| 69 guest ? guest->embedder_web_contents() : nullptr; | 69 guest ? guest->embedder_web_contents() : nullptr; |
| 70 if (guest_contents) | 70 if (guest_contents) |
| 71 return kTypeWebView; | 71 return kTypeWebView; |
| 72 | 72 |
| 73 if (host->GetParent()) |
| 74 return content::DevToolsAgentHost::kTypeFrame; |
| 75 |
| 73 for (TabContentsIterator it; !it.done(); it.Next()) { | 76 for (TabContentsIterator it; !it.done(); it.Next()) { |
| 74 if (*it == web_contents) | 77 if (*it == web_contents) |
| 75 return content::DevToolsAgentHost::kTypePage; | 78 return content::DevToolsAgentHost::kTypePage; |
| 76 } | 79 } |
| 77 | 80 |
| 78 if (host->GetParent()) | |
| 79 return content::DevToolsAgentHost::kTypeFrame; | |
| 80 | |
| 81 const extensions::Extension* extension = extensions::ExtensionRegistry::Get( | 81 const extensions::Extension* extension = extensions::ExtensionRegistry::Get( |
| 82 web_contents->GetBrowserContext())->enabled_extensions().GetByID( | 82 web_contents->GetBrowserContext())->enabled_extensions().GetByID( |
| 83 host->GetLastCommittedURL().host()); | 83 host->GetLastCommittedURL().host()); |
| 84 if (!extension) | 84 if (!extension) |
| 85 return content::DevToolsAgentHost::kTypeOther; | 85 return content::DevToolsAgentHost::kTypeOther; |
| 86 | 86 |
| 87 Profile* profile = | 87 Profile* profile = |
| 88 Profile::FromBrowserContext(web_contents->GetBrowserContext()); | 88 Profile::FromBrowserContext(web_contents->GetBrowserContext()); |
| 89 if (!profile) | 89 if (!profile) |
| 90 return content::DevToolsAgentHost::kTypeOther; | 90 return content::DevToolsAgentHost::kTypeOther; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 if (!params.target_contents) | 130 if (!params.target_contents) |
| 131 return nullptr; | 131 return nullptr; |
| 132 return content::DevToolsAgentHost::GetOrCreateFor(params.target_contents); | 132 return content::DevToolsAgentHost::GetOrCreateFor(params.target_contents); |
| 133 } | 133 } |
| 134 | 134 |
| 135 void ChromeDevToolsManagerDelegate::DevToolsAgentStateChanged( | 135 void ChromeDevToolsManagerDelegate::DevToolsAgentStateChanged( |
| 136 content::DevToolsAgentHost* agent_host, | 136 content::DevToolsAgentHost* agent_host, |
| 137 bool attached) { | 137 bool attached) { |
| 138 network_protocol_handler_->DevToolsAgentStateChanged(agent_host, attached); | 138 network_protocol_handler_->DevToolsAgentStateChanged(agent_host, attached); |
| 139 } | 139 } |
| OLD | NEW |