| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/devtools_target_impl.h" | 5 #include "chrome/browser/devtools/devtools_target_impl.h" |
| 6 | 6 |
| 7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "chrome/browser/devtools/devtools_window.h" | 9 #include "chrome/browser/devtools/devtools_window.h" |
| 10 #include "chrome/browser/extensions/extension_tab_util.h" | 10 #include "chrome/browser/extensions/extension_tab_util.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 | 42 |
| 43 namespace { | 43 namespace { |
| 44 | 44 |
| 45 // WebContentsTarget -------------------------------------------------------- | 45 // WebContentsTarget -------------------------------------------------------- |
| 46 | 46 |
| 47 class WebContentsTarget : public DevToolsTargetImpl { | 47 class WebContentsTarget : public DevToolsTargetImpl { |
| 48 public: | 48 public: |
| 49 WebContentsTarget(WebContents* web_contents, bool is_tab); | 49 WebContentsTarget(WebContents* web_contents, bool is_tab); |
| 50 | 50 |
| 51 // DevToolsTargetImpl overrides: | 51 // DevToolsTargetImpl overrides: |
| 52 virtual WebContents* GetWebContents() const OVERRIDE; | 52 virtual WebContents* GetWebContents() const override; |
| 53 virtual int GetTabId() const OVERRIDE; | 53 virtual int GetTabId() const override; |
| 54 virtual std::string GetExtensionId() const OVERRIDE; | 54 virtual std::string GetExtensionId() const override; |
| 55 virtual void Inspect(Profile* profile) const OVERRIDE; | 55 virtual void Inspect(Profile* profile) const override; |
| 56 | 56 |
| 57 private: | 57 private: |
| 58 int tab_id_; | 58 int tab_id_; |
| 59 std::string extension_id_; | 59 std::string extension_id_; |
| 60 }; | 60 }; |
| 61 | 61 |
| 62 WebContentsTarget::WebContentsTarget(WebContents* web_contents, bool is_tab) | 62 WebContentsTarget::WebContentsTarget(WebContents* web_contents, bool is_tab) |
| 63 : DevToolsTargetImpl(DevToolsAgentHost::GetOrCreateFor(web_contents)), | 63 : DevToolsTargetImpl(DevToolsAgentHost::GetOrCreateFor(web_contents)), |
| 64 tab_id_(-1) { | 64 tab_id_(-1) { |
| 65 set_type(kTargetTypeOther); | 65 set_type(kTargetTypeOther); |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 DevToolsWindow::OpenDevToolsWindow(web_contents); | 146 DevToolsWindow::OpenDevToolsWindow(web_contents); |
| 147 } | 147 } |
| 148 | 148 |
| 149 // WorkerTarget ---------------------------------------------------------------- | 149 // WorkerTarget ---------------------------------------------------------------- |
| 150 | 150 |
| 151 class WorkerTarget : public DevToolsTargetImpl { | 151 class WorkerTarget : public DevToolsTargetImpl { |
| 152 public: | 152 public: |
| 153 explicit WorkerTarget(scoped_refptr<DevToolsAgentHost> agent_host); | 153 explicit WorkerTarget(scoped_refptr<DevToolsAgentHost> agent_host); |
| 154 | 154 |
| 155 // DevToolsTargetImpl overrides: | 155 // DevToolsTargetImpl overrides: |
| 156 virtual void Inspect(Profile* profile) const OVERRIDE; | 156 virtual void Inspect(Profile* profile) const override; |
| 157 }; | 157 }; |
| 158 | 158 |
| 159 WorkerTarget::WorkerTarget(scoped_refptr<DevToolsAgentHost> agent_host) | 159 WorkerTarget::WorkerTarget(scoped_refptr<DevToolsAgentHost> agent_host) |
| 160 : DevToolsTargetImpl(agent_host) { | 160 : DevToolsTargetImpl(agent_host) { |
| 161 switch (agent_host->GetType()) { | 161 switch (agent_host->GetType()) { |
| 162 case DevToolsAgentHost::TYPE_SHARED_WORKER: | 162 case DevToolsAgentHost::TYPE_SHARED_WORKER: |
| 163 set_type(kTargetTypeWorker); | 163 set_type(kTargetTypeWorker); |
| 164 break; | 164 break; |
| 165 case DevToolsAgentHost::TYPE_SERVICE_WORKER: | 165 case DevToolsAgentHost::TYPE_SERVICE_WORKER: |
| 166 set_type(kTargetTypeServiceWorker); | 166 set_type(kTargetTypeServiceWorker); |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 case DevToolsAgentHost::TYPE_SERVICE_WORKER: | 290 case DevToolsAgentHost::TYPE_SERVICE_WORKER: |
| 291 result.push_back(new WorkerTarget(agent_host)); | 291 result.push_back(new WorkerTarget(agent_host)); |
| 292 break; | 292 break; |
| 293 default: | 293 default: |
| 294 break; | 294 break; |
| 295 } | 295 } |
| 296 } | 296 } |
| 297 | 297 |
| 298 callback.Run(result); | 298 callback.Run(result); |
| 299 } | 299 } |
| OLD | NEW |