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

Side by Side Diff: content/renderer/render_frame_impl.cc

Issue 1642283002: Deal with frame removal by content scripts (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add AfterDidCreateDocumentElement/AfterDidFinishDocumentLoad Created 4 years, 10 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "content/renderer/render_frame_impl.h" 5 #include "content/renderer/render_frame_impl.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 3360 matching lines...) Expand 10 before | Expand all | Expand 10 after
3371 render_view_->Send(new ViewHostMsg_DocumentAvailableInMainFrame( 3371 render_view_->Send(new ViewHostMsg_DocumentAvailableInMainFrame(
3372 render_view_->GetRoutingID(), 3372 render_view_->GetRoutingID(),
3373 main_frame->document().isPluginDocument())); 3373 main_frame->document().isPluginDocument()));
3374 } 3374 }
3375 } 3375 }
3376 3376
3377 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, 3377 FOR_EACH_OBSERVER(RenderFrameObserver, observers_,
3378 DidCreateDocumentElement()); 3378 DidCreateDocumentElement());
3379 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(), 3379 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(),
3380 DidCreateDocumentElement(frame)); 3380 DidCreateDocumentElement(frame));
3381
3382 GetContentClient()->renderer()->AfterDidCreateDocumentElement(
3383 weak_factory_.GetWeakPtr());
3384 // Do not use |this| or |frame|! ContentClient may might deleted them by now!
nasko 2016/02/11 16:49:01 nit: "may might deleted" doesn't sound right. Mayb
robwu 2016/02/11 17:51:08 Oops. I intended to write "might have". I'll fix i
robwu 2016/02/11 23:36:50 Done.
3381 } 3385 }
3382 3386
3383 void RenderFrameImpl::didReceiveTitle(blink::WebLocalFrame* frame, 3387 void RenderFrameImpl::didReceiveTitle(blink::WebLocalFrame* frame,
3384 const blink::WebString& title, 3388 const blink::WebString& title,
3385 blink::WebTextDirection direction) { 3389 blink::WebTextDirection direction) {
3386 DCHECK(!frame_ || frame_ == frame); 3390 DCHECK(!frame_ || frame_ == frame);
3387 // Ignore all but top level navigations. 3391 // Ignore all but top level navigations.
3388 if (!frame->parent()) { 3392 if (!frame->parent()) {
3389 base::string16 title16 = title; 3393 base::string16 title16 = title;
3390 base::trace_event::TraceLog::GetInstance()->UpdateProcessLabel( 3394 base::trace_event::TraceLog::GetInstance()->UpdateProcessLabel(
(...skipping 23 matching lines...) Expand all
3414 WebDataSource* ds = frame->dataSource(); 3418 WebDataSource* ds = frame->dataSource();
3415 DocumentState* document_state = DocumentState::FromDataSource(ds); 3419 DocumentState* document_state = DocumentState::FromDataSource(ds);
3416 document_state->set_finish_document_load_time(Time::Now()); 3420 document_state->set_finish_document_load_time(Time::Now());
3417 3421
3418 Send(new FrameHostMsg_DidFinishDocumentLoad(routing_id_)); 3422 Send(new FrameHostMsg_DidFinishDocumentLoad(routing_id_));
3419 3423
3420 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(), 3424 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(),
3421 DidFinishDocumentLoad(frame)); 3425 DidFinishDocumentLoad(frame));
3422 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, DidFinishDocumentLoad()); 3426 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, DidFinishDocumentLoad());
3423 3427
3428 base::WeakPtr<RenderFrame> weak_self = weak_factory_.GetWeakPtr();
3429 GetContentClient()->renderer()->AfterDidFinishDocumentLoad(weak_self);
3430 if (!weak_self.get())
3431 return;
3432
3424 // Check whether we have new encoding name. 3433 // Check whether we have new encoding name.
3425 UpdateEncoding(frame, frame->view()->pageEncoding().utf8()); 3434 UpdateEncoding(frame, frame->view()->pageEncoding().utf8());
3426 3435
3427 // If this is an empty document with an http status code indicating an error, 3436 // If this is an empty document with an http status code indicating an error,
3428 // we may want to display our own error page, so the user doesn't end up 3437 // we may want to display our own error page, so the user doesn't end up
3429 // with an unexplained blank page. 3438 // with an unexplained blank page.
3430 if (!document_is_empty) 3439 if (!document_is_empty)
3431 return; 3440 return;
3432 3441
3433 // Do not show error page when DevTools is attached. 3442 // Do not show error page when DevTools is attached.
(...skipping 2697 matching lines...) Expand 10 before | Expand all | Expand 10 after
6131 int match_count, 6140 int match_count,
6132 int ordinal, 6141 int ordinal,
6133 const WebRect& selection_rect, 6142 const WebRect& selection_rect,
6134 bool final_status_update) { 6143 bool final_status_update) {
6135 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, match_count, 6144 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, match_count,
6136 selection_rect, ordinal, 6145 selection_rect, ordinal,
6137 final_status_update)); 6146 final_status_update));
6138 } 6147 }
6139 6148
6140 } // namespace content 6149 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698