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::AfterDidCreateDocumentElement( |
| 504 content::RenderFrame* render_frame) { |
| 505 ExtensionFrameHelper* frame_helper = ExtensionFrameHelper::Get(render_frame); |
| 506 if (!frame_helper) |
| 507 return; // The frame is invisible to extensions. |
| 508 |
| 509 frame_helper->AfterDidCreateDocumentElement(); |
| 510 // |frame_helper| and |render_frame| might be dead by now. |
| 511 } |
| 512 |
| 513 void Dispatcher::AfterDidFinishDocumentLoad( |
| 514 content::RenderFrame* render_frame) { |
| 515 ExtensionFrameHelper* frame_helper = ExtensionFrameHelper::Get(render_frame); |
| 516 if (!frame_helper) |
| 517 return; // The frame is invisible to extensions. |
| 518 |
| 519 frame_helper->AfterDidFinishDocumentLoad(); |
| 520 // |frame_helper| and |render_frame| might be dead by now. |
| 521 } |
| 522 |
503 void Dispatcher::OnExtensionResponse(int request_id, | 523 void Dispatcher::OnExtensionResponse(int request_id, |
504 bool success, | 524 bool success, |
505 const base::ListValue& response, | 525 const base::ListValue& response, |
506 const std::string& error) { | 526 const std::string& error) { |
507 request_sender_->HandleResponse(request_id, success, response, error); | 527 request_sender_->HandleResponse(request_id, success, response, error); |
508 } | 528 } |
509 | 529 |
510 void Dispatcher::DispatchEvent(const std::string& extension_id, | 530 void Dispatcher::DispatchEvent(const std::string& extension_id, |
511 const std::string& event_name) const { | 531 const std::string& event_name) const { |
512 base::ListValue args; | 532 base::ListValue args; |
(...skipping 1099 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1612 // The "guestViewDeny" module must always be loaded last. It registers | 1632 // The "guestViewDeny" module must always be loaded last. It registers |
1613 // error-providing custom elements for the GuestView types that are not | 1633 // error-providing custom elements for the GuestView types that are not |
1614 // available, and thus all of those types must have been checked and loaded | 1634 // available, and thus all of those types must have been checked and loaded |
1615 // (or not loaded) beforehand. | 1635 // (or not loaded) beforehand. |
1616 if (context_type == Feature::BLESSED_EXTENSION_CONTEXT) { | 1636 if (context_type == Feature::BLESSED_EXTENSION_CONTEXT) { |
1617 module_system->Require("guestViewDeny"); | 1637 module_system->Require("guestViewDeny"); |
1618 } | 1638 } |
1619 } | 1639 } |
1620 | 1640 |
1621 } // namespace extensions | 1641 } // namespace extensions |
OLD | NEW |