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 <stddef.h> | 9 #include <stddef.h> |
10 | 10 |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 void SendDetachedEvent(); | 283 void SendDetachedEvent(); |
284 | 284 |
285 // content::NotificationObserver implementation. | 285 // content::NotificationObserver implementation. |
286 void Observe(int type, | 286 void Observe(int type, |
287 const content::NotificationSource& source, | 287 const content::NotificationSource& source, |
288 const content::NotificationDetails& details) override; | 288 const content::NotificationDetails& details) override; |
289 | 289 |
290 // ExtensionRegistryObserver implementation. | 290 // ExtensionRegistryObserver implementation. |
291 void OnExtensionUnloaded(content::BrowserContext* browser_context, | 291 void OnExtensionUnloaded(content::BrowserContext* browser_context, |
292 const Extension* extension, | 292 const Extension* extension, |
293 UnloadedExtensionInfo::Reason reason) override; | 293 UnloadedExtensionReason reason) override; |
294 | 294 |
295 Profile* profile_; | 295 Profile* profile_; |
296 scoped_refptr<DevToolsAgentHost> agent_host_; | 296 scoped_refptr<DevToolsAgentHost> agent_host_; |
297 std::string extension_id_; | 297 std::string extension_id_; |
298 Debuggee debuggee_; | 298 Debuggee debuggee_; |
299 content::NotificationRegistrar registrar_; | 299 content::NotificationRegistrar registrar_; |
300 int last_request_id_; | 300 int last_request_id_; |
301 PendingRequests pending_requests_; | 301 PendingRequests pending_requests_; |
302 ExtensionDevToolsInfoBar* infobar_; | 302 ExtensionDevToolsInfoBar* infobar_; |
303 api::debugger::DetachReason detach_reason_; | 303 api::debugger::DetachReason detach_reason_; |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 std::unique_ptr<Event> event(new Event( | 415 std::unique_ptr<Event> event(new Event( |
416 events::DEBUGGER_ON_DETACH, OnDetach::kEventName, std::move(args))); | 416 events::DEBUGGER_ON_DETACH, OnDetach::kEventName, std::move(args))); |
417 event->restrict_to_browser_context = profile_; | 417 event->restrict_to_browser_context = profile_; |
418 EventRouter::Get(profile_) | 418 EventRouter::Get(profile_) |
419 ->DispatchEventToExtension(extension_id_, std::move(event)); | 419 ->DispatchEventToExtension(extension_id_, std::move(event)); |
420 } | 420 } |
421 | 421 |
422 void ExtensionDevToolsClientHost::OnExtensionUnloaded( | 422 void ExtensionDevToolsClientHost::OnExtensionUnloaded( |
423 content::BrowserContext* browser_context, | 423 content::BrowserContext* browser_context, |
424 const Extension* extension, | 424 const Extension* extension, |
425 UnloadedExtensionInfo::Reason reason) { | 425 UnloadedExtensionReason reason) { |
426 if (extension->id() == extension_id_) | 426 if (extension->id() == extension_id_) |
427 Close(); | 427 Close(); |
428 } | 428 } |
429 | 429 |
430 void ExtensionDevToolsClientHost::Observe( | 430 void ExtensionDevToolsClientHost::Observe( |
431 int type, | 431 int type, |
432 const content::NotificationSource& source, | 432 const content::NotificationSource& source, |
433 const content::NotificationDetails& details) { | 433 const content::NotificationDetails& details) { |
434 DCHECK_EQ(chrome::NOTIFICATION_APP_TERMINATING, type); | 434 DCHECK_EQ(chrome::NOTIFICATION_APP_TERMINATING, type); |
435 Close(); | 435 Close(); |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
738 void DebuggerGetTargetsFunction::SendTargetList( | 738 void DebuggerGetTargetsFunction::SendTargetList( |
739 const content::DevToolsAgentHost::List& target_list) { | 739 const content::DevToolsAgentHost::List& target_list) { |
740 std::unique_ptr<base::ListValue> result(new base::ListValue()); | 740 std::unique_ptr<base::ListValue> result(new base::ListValue()); |
741 for (size_t i = 0; i < target_list.size(); ++i) | 741 for (size_t i = 0; i < target_list.size(); ++i) |
742 result->Append(SerializeTarget(target_list[i])); | 742 result->Append(SerializeTarget(target_list[i])); |
743 SetResult(std::move(result)); | 743 SetResult(std::move(result)); |
744 SendResponse(true); | 744 SendResponse(true); |
745 } | 745 } |
746 | 746 |
747 } // namespace extensions | 747 } // namespace extensions |
OLD | NEW |