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

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: Up to #50: ExtensionFrameHelper callbacks, comments 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 3356 matching lines...) Expand 10 before | Expand all | Expand 10 after
3367 if (frame == main_frame) { 3367 if (frame == main_frame) {
3368 // For now, don't remember plugin zoom values. We don't want to mix them 3368 // For now, don't remember plugin zoom values. We don't want to mix them
3369 // with normal web content (i.e. a fixed layout plugin would usually want 3369 // with normal web content (i.e. a fixed layout plugin would usually want
3370 // them different). 3370 // them different).
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 // TODO(robwu): Wrap observers in ScriptForbiddenScope (see crbug.com/582008).
3377 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, 3378 FOR_EACH_OBSERVER(RenderFrameObserver, observers_,
3378 DidCreateDocumentElement()); 3379 DidCreateDocumentElement());
3379 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(), 3380 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(),
3380 DidCreateDocumentElement(frame)); 3381 DidCreateDocumentElement(frame));
3382
3383 GetContentClient()->renderer()->AfterDidCreateDocumentElement(this);
3384 // Do not use |this| or |frame|! ContentClient might have deleted them by now!
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 19 matching lines...) Expand all
3410 bool document_is_empty) { 3414 bool document_is_empty) {
3411 TRACE_EVENT1("navigation,benchmark", "RenderFrameImpl::didFinishDocumentLoad", 3415 TRACE_EVENT1("navigation,benchmark", "RenderFrameImpl::didFinishDocumentLoad",
3412 "id", routing_id_); 3416 "id", routing_id_);
3413 DCHECK(!frame_ || frame_ == frame); 3417 DCHECK(!frame_ || frame_ == frame);
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
3424 // TODO(robwu): Wrap observers in ScriptForbiddenScope (see crbug.com/582008).
3420 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(), 3425 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(),
3421 DidFinishDocumentLoad(frame)); 3426 DidFinishDocumentLoad(frame));
3422 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, DidFinishDocumentLoad()); 3427 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, DidFinishDocumentLoad());
3423 3428
3429 base::WeakPtr<RenderFrame> weak_self = weak_factory_.GetWeakPtr();
3430 GetContentClient()->renderer()->AfterDidFinishDocumentLoad(this);
3431 if (!weak_self.get())
3432 return;
3433
3424 // Check whether we have new encoding name. 3434 // Check whether we have new encoding name.
3425 UpdateEncoding(frame, frame->view()->pageEncoding().utf8()); 3435 UpdateEncoding(frame, frame->view()->pageEncoding().utf8());
3426 3436
3427 // If this is an empty document with an http status code indicating an error, 3437 // 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 3438 // we may want to display our own error page, so the user doesn't end up
3429 // with an unexplained blank page. 3439 // with an unexplained blank page.
3430 if (!document_is_empty) 3440 if (!document_is_empty)
3431 return; 3441 return;
3432 3442
3433 // Do not show error page when DevTools is attached. 3443 // 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, 6141 int match_count,
6132 int ordinal, 6142 int ordinal,
6133 const WebRect& selection_rect, 6143 const WebRect& selection_rect,
6134 bool final_status_update) { 6144 bool final_status_update) {
6135 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, match_count, 6145 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, match_count,
6136 selection_rect, ordinal, 6146 selection_rect, ordinal,
6137 final_status_update)); 6147 final_status_update));
6138 } 6148 }
6139 6149
6140 } // namespace content 6150 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698