| 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 }; | 93 }; |
| 94 | 94 |
| 95 class ExtensionDevToolsClientHost : public DevToolsClientHost, | 95 class ExtensionDevToolsClientHost : public DevToolsClientHost, |
| 96 public content::NotificationObserver { | 96 public content::NotificationObserver { |
| 97 public: | 97 public: |
| 98 ExtensionDevToolsClientHost(WebContents* web_contents, | 98 ExtensionDevToolsClientHost(WebContents* web_contents, |
| 99 const std::string& extension_id, | 99 const std::string& extension_id, |
| 100 const std::string& extension_name, | 100 const std::string& extension_name, |
| 101 int tab_id); | 101 int tab_id); |
| 102 | 102 |
| 103 ~ExtensionDevToolsClientHost(); | 103 virtual ~ExtensionDevToolsClientHost(); |
| 104 | 104 |
| 105 bool MatchesContentsAndExtensionId(WebContents* web_contents, | 105 bool MatchesContentsAndExtensionId(WebContents* web_contents, |
| 106 const std::string& extension_id); | 106 const std::string& extension_id); |
| 107 void Close(); | 107 void Close(); |
| 108 void SendMessageToBackend(DebuggerSendCommandFunction* function, | 108 void SendMessageToBackend(DebuggerSendCommandFunction* function, |
| 109 const std::string& method, | 109 const std::string& method, |
| 110 SendCommand::Params::CommandParams* command_params); | 110 SendCommand::Params::CommandParams* command_params); |
| 111 | 111 |
| 112 // Marks connection as to-be-terminated by the user. | 112 // Marks connection as to-be-terminated by the user. |
| 113 void MarkAsDismissed(); | 113 void MarkAsDismissed(); |
| 114 | 114 |
| 115 // DevToolsClientHost interface | 115 // DevToolsClientHost interface |
| 116 virtual void InspectedContentsClosing() OVERRIDE; | 116 virtual void InspectedContentsClosing() OVERRIDE; |
| 117 virtual void DispatchOnInspectorFrontend(const std::string& message) OVERRIDE; | 117 virtual void DispatchOnInspectorFrontend(const std::string& message) OVERRIDE; |
| 118 virtual void ReplacedWithAnotherClient() OVERRIDE; | 118 virtual void ReplacedWithAnotherClient() OVERRIDE; |
| 119 | 119 |
| 120 private: | 120 private: |
| 121 void SendDetachedEvent(); | 121 void SendDetachedEvent(); |
| 122 | 122 |
| 123 // content::NotificationObserver implementation. | 123 // content::NotificationObserver implementation. |
| 124 virtual void Observe(int type, | 124 virtual void Observe(int type, |
| 125 const content::NotificationSource& source, | 125 const content::NotificationSource& source, |
| 126 const content::NotificationDetails& details); | 126 const content::NotificationDetails& details) OVERRIDE; |
| 127 | 127 |
| 128 WebContents* web_contents_; | 128 WebContents* web_contents_; |
| 129 std::string extension_id_; | 129 std::string extension_id_; |
| 130 int tab_id_; | 130 int tab_id_; |
| 131 content::NotificationRegistrar registrar_; | 131 content::NotificationRegistrar registrar_; |
| 132 int last_request_id_; | 132 int last_request_id_; |
| 133 typedef std::map<int, scoped_refptr<DebuggerSendCommandFunction> > | 133 typedef std::map<int, scoped_refptr<DebuggerSendCommandFunction> > |
| 134 PendingRequests; | 134 PendingRequests; |
| 135 PendingRequests pending_requests_; | 135 PendingRequests pending_requests_; |
| 136 ExtensionDevToolsInfoBarDelegate* infobar_delegate_; | 136 ExtensionDevToolsInfoBarDelegate* infobar_delegate_; |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 } | 541 } |
| 542 | 542 |
| 543 DictionaryValue* result_body; | 543 DictionaryValue* result_body; |
| 544 SendCommand::Results::Result result; | 544 SendCommand::Results::Result result; |
| 545 if (response->GetDictionary("result", &result_body)) | 545 if (response->GetDictionary("result", &result_body)) |
| 546 result.additional_properties.Swap(result_body); | 546 result.additional_properties.Swap(result_body); |
| 547 | 547 |
| 548 results_ = SendCommand::Results::Create(result); | 548 results_ = SendCommand::Results::Create(result); |
| 549 SendResponse(true); | 549 SendResponse(true); |
| 550 } | 550 } |
| OLD | NEW |