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

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 more runScriptsAtDocumentElementAvailable + comments 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
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 3326 matching lines...) Expand 10 before | Expand all | Expand 10 after
3337 main_frame->document().isPluginDocument())); 3337 main_frame->document().isPluginDocument()));
3338 } 3338 }
3339 } 3339 }
3340 3340
3341 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, 3341 FOR_EACH_OBSERVER(RenderFrameObserver, observers_,
3342 DidCreateDocumentElement()); 3342 DidCreateDocumentElement());
3343 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(), 3343 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(),
3344 DidCreateDocumentElement(frame)); 3344 DidCreateDocumentElement(frame));
3345 } 3345 }
3346 3346
3347 void RenderFrameImpl::runScriptsAtDocumentElementAvailable(
3348 blink::WebLocalFrame* frame) {
3349 DCHECK(!frame_ || frame_ == frame);
3350
3351 GetContentClient()->renderer()->RunScriptsAtDocumentStart(this);
3352 // Do not use |this| or |frame|! ContentClient might have deleted them by now!
3353 }
3354
3347 void RenderFrameImpl::didReceiveTitle(blink::WebLocalFrame* frame, 3355 void RenderFrameImpl::didReceiveTitle(blink::WebLocalFrame* frame,
3348 const blink::WebString& title, 3356 const blink::WebString& title,
3349 blink::WebTextDirection direction) { 3357 blink::WebTextDirection direction) {
3350 DCHECK_EQ(frame_, frame); 3358 DCHECK_EQ(frame_, frame);
3351 // Ignore all but top level navigations. 3359 // Ignore all but top level navigations.
3352 if (!frame->parent()) { 3360 if (!frame->parent()) {
3353 base::string16 title16 = title; 3361 base::string16 title16 = title;
3354 base::trace_event::TraceLog::GetInstance()->UpdateProcessLabel( 3362 base::trace_event::TraceLog::GetInstance()->UpdateProcessLabel(
3355 routing_id_, base::UTF16ToUTF8(title16)); 3363 routing_id_, base::UTF16ToUTF8(title16));
3356 3364
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
3412 if (GetContentClient()->renderer()->HasErrorPage(http_status_code, 3420 if (GetContentClient()->renderer()->HasErrorPage(http_status_code,
3413 &error_domain)) { 3421 &error_domain)) {
3414 WebURLError error; 3422 WebURLError error;
3415 error.unreachableURL = frame->document().url(); 3423 error.unreachableURL = frame->document().url();
3416 error.domain = WebString::fromUTF8(error_domain); 3424 error.domain = WebString::fromUTF8(error_domain);
3417 error.reason = http_status_code; 3425 error.reason = http_status_code;
3418 LoadNavigationErrorPage(frame->dataSource()->request(), error, true); 3426 LoadNavigationErrorPage(frame->dataSource()->request(), error, true);
3419 } 3427 }
3420 } 3428 }
3421 3429
3430 void RenderFrameImpl::runScriptsAtDocumentReady(blink::WebLocalFrame* frame) {
3431 base::WeakPtr<RenderFrameImpl> weak_self = weak_factory_.GetWeakPtr();
3432
3433 MojoBindingsController* mojo_bindings_controller =
3434 MojoBindingsController::Get(this);
3435 if (mojo_bindings_controller)
3436 mojo_bindings_controller->RunScriptsAtDocumentReady();
3437
3438 if (!weak_self.get())
3439 return;
3440
3441 GetContentClient()->renderer()->RunScriptsAtDocumentEnd(this);
3442 // Do not use |this| or |frame|! ContentClient might have deleted them by now!
3443 }
3444
3422 void RenderFrameImpl::didHandleOnloadEvents(blink::WebLocalFrame* frame) { 3445 void RenderFrameImpl::didHandleOnloadEvents(blink::WebLocalFrame* frame) {
3423 DCHECK_EQ(frame_, frame); 3446 DCHECK_EQ(frame_, frame);
3424 if (!frame->parent()) { 3447 if (!frame->parent()) {
3425 FrameMsg_UILoadMetricsReportType::Value report_type = 3448 FrameMsg_UILoadMetricsReportType::Value report_type =
3426 static_cast<FrameMsg_UILoadMetricsReportType::Value>( 3449 static_cast<FrameMsg_UILoadMetricsReportType::Value>(
3427 frame->dataSource()->request().inputPerfMetricReportPolicy()); 3450 frame->dataSource()->request().inputPerfMetricReportPolicy());
3428 base::TimeTicks ui_timestamp = base::TimeTicks() + 3451 base::TimeTicks ui_timestamp = base::TimeTicks() +
3429 base::TimeDelta::FromSecondsD( 3452 base::TimeDelta::FromSecondsD(
3430 frame->dataSource()->request().uiStartTime()); 3453 frame->dataSource()->request().uiStartTime());
3431 3454
(...skipping 2637 matching lines...) Expand 10 before | Expand all | Expand 10 after
6069 int match_count, 6092 int match_count,
6070 int ordinal, 6093 int ordinal,
6071 const WebRect& selection_rect, 6094 const WebRect& selection_rect,
6072 bool final_status_update) { 6095 bool final_status_update) {
6073 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, match_count, 6096 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, match_count,
6074 selection_rect, ordinal, 6097 selection_rect, ordinal,
6075 final_status_update)); 6098 final_status_update));
6076 } 6099 }
6077 6100
6078 } // namespace content 6101 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698