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 "extensions/renderer/dispatcher.h" | 5 #include "extensions/renderer/dispatcher.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 } | 493 } |
494 | 494 |
495 // In testing, the document lifetime events can happen after the render | 495 // In testing, the document lifetime events can happen after the render |
496 // process shutdown event. | 496 // process shutdown event. |
497 // See: http://crbug.com/21508 and http://crbug.com/500851 | 497 // See: http://crbug.com/21508 and http://crbug.com/500851 |
498 if (content_watcher_) { | 498 if (content_watcher_) { |
499 content_watcher_->DidCreateDocumentElement(frame); | 499 content_watcher_->DidCreateDocumentElement(frame); |
500 } | 500 } |
501 } | 501 } |
502 | 502 |
| 503 void Dispatcher::RunScriptsAtDocumentStart(content::RenderFrame* render_frame) { |
| 504 ExtensionFrameHelper* frame_helper = ExtensionFrameHelper::Get(render_frame); |
| 505 if (!frame_helper) |
| 506 return; // The frame is invisible to extensions. |
| 507 |
| 508 frame_helper->RunScriptsAtDocumentStart(); |
| 509 // |frame_helper| and |render_frame| might be dead by now. |
| 510 } |
| 511 |
| 512 void Dispatcher::RunScriptsAtDocumentEnd(content::RenderFrame* render_frame) { |
| 513 ExtensionFrameHelper* frame_helper = ExtensionFrameHelper::Get(render_frame); |
| 514 if (!frame_helper) |
| 515 return; // The frame is invisible to extensions. |
| 516 |
| 517 frame_helper->RunScriptsAtDocumentEnd(); |
| 518 // |frame_helper| and |render_frame| might be dead by now. |
| 519 } |
| 520 |
503 void Dispatcher::OnExtensionResponse(int request_id, | 521 void Dispatcher::OnExtensionResponse(int request_id, |
504 bool success, | 522 bool success, |
505 const base::ListValue& response, | 523 const base::ListValue& response, |
506 const std::string& error) { | 524 const std::string& error) { |
507 request_sender_->HandleResponse(request_id, success, response, error); | 525 request_sender_->HandleResponse(request_id, success, response, error); |
508 } | 526 } |
509 | 527 |
510 void Dispatcher::DispatchEvent(const std::string& extension_id, | 528 void Dispatcher::DispatchEvent(const std::string& extension_id, |
511 const std::string& event_name) const { | 529 const std::string& event_name) const { |
512 base::ListValue args; | 530 base::ListValue args; |
(...skipping 1094 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1607 // The "guestViewDeny" module must always be loaded last. It registers | 1625 // The "guestViewDeny" module must always be loaded last. It registers |
1608 // error-providing custom elements for the GuestView types that are not | 1626 // error-providing custom elements for the GuestView types that are not |
1609 // available, and thus all of those types must have been checked and loaded | 1627 // available, and thus all of those types must have been checked and loaded |
1610 // (or not loaded) beforehand. | 1628 // (or not loaded) beforehand. |
1611 if (context_type == Feature::BLESSED_EXTENSION_CONTEXT) { | 1629 if (context_type == Feature::BLESSED_EXTENSION_CONTEXT) { |
1612 module_system->Require("guestViewDeny"); | 1630 module_system->Require("guestViewDeny"); |
1613 } | 1631 } |
1614 } | 1632 } |
1615 | 1633 |
1616 } // namespace extensions | 1634 } // namespace extensions |
OLD | NEW |