Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(221)

Side by Side Diff: extensions/renderer/dispatcher.cc

Issue 1642283002: Deal with frame removal by content scripts (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Last nits Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « extensions/renderer/dispatcher.h ('k') | extensions/renderer/extension_frame_helper.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « extensions/renderer/dispatcher.h ('k') | extensions/renderer/extension_frame_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698