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

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: 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 | « content/renderer/render_frame_impl.h ('k') | extensions/renderer/dispatcher.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 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 3299 matching lines...) Expand 10 before | Expand all | Expand 10 after
3310 main_frame->document().isPluginDocument())); 3310 main_frame->document().isPluginDocument()));
3311 } 3311 }
3312 } 3312 }
3313 3313
3314 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, 3314 FOR_EACH_OBSERVER(RenderFrameObserver, observers_,
3315 DidCreateDocumentElement()); 3315 DidCreateDocumentElement());
3316 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(), 3316 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(),
3317 DidCreateDocumentElement(frame)); 3317 DidCreateDocumentElement(frame));
3318 } 3318 }
3319 3319
3320 void RenderFrameImpl::runScriptsAtDocumentElementAvailable(
3321 blink::WebLocalFrame* frame) {
3322 DCHECK(!frame_ || frame_ == frame);
3323 base::WeakPtr<RenderFrameImpl> weak_self = weak_factory_.GetWeakPtr();
3324
3325 MojoBindingsController* mojo_bindings_controller =
3326 MojoBindingsController::Get(this);
3327 if (mojo_bindings_controller)
3328 mojo_bindings_controller->RunScriptsAtDocumentStart();
3329
3330 if (!weak_self.get())
3331 return;
3332
3333 GetContentClient()->renderer()->RunScriptsAtDocumentStart(this);
3334 // Do not use |this| or |frame|! ContentClient might have deleted them by now!
3335 }
3336
3320 void RenderFrameImpl::didReceiveTitle(blink::WebLocalFrame* frame, 3337 void RenderFrameImpl::didReceiveTitle(blink::WebLocalFrame* frame,
3321 const blink::WebString& title, 3338 const blink::WebString& title,
3322 blink::WebTextDirection direction) { 3339 blink::WebTextDirection direction) {
3323 DCHECK_EQ(frame_, frame); 3340 DCHECK_EQ(frame_, frame);
3324 // Ignore all but top level navigations. 3341 // Ignore all but top level navigations.
3325 if (!frame->parent()) { 3342 if (!frame->parent()) {
3326 base::string16 title16 = title; 3343 base::string16 title16 = title;
3327 base::trace_event::TraceLog::GetInstance()->UpdateProcessLabel( 3344 base::trace_event::TraceLog::GetInstance()->UpdateProcessLabel(
3328 routing_id_, base::UTF16ToUTF8(title16)); 3345 routing_id_, base::UTF16ToUTF8(title16));
3329 3346
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
3385 if (GetContentClient()->renderer()->HasErrorPage(http_status_code, 3402 if (GetContentClient()->renderer()->HasErrorPage(http_status_code,
3386 &error_domain)) { 3403 &error_domain)) {
3387 WebURLError error; 3404 WebURLError error;
3388 error.unreachableURL = frame->document().url(); 3405 error.unreachableURL = frame->document().url();
3389 error.domain = WebString::fromUTF8(error_domain); 3406 error.domain = WebString::fromUTF8(error_domain);
3390 error.reason = http_status_code; 3407 error.reason = http_status_code;
3391 LoadNavigationErrorPage(frame->dataSource()->request(), error, true); 3408 LoadNavigationErrorPage(frame->dataSource()->request(), error, true);
3392 } 3409 }
3393 } 3410 }
3394 3411
3412 void RenderFrameImpl::runScriptsAtDocumentReady(blink::WebLocalFrame* frame) {
3413 base::WeakPtr<RenderFrameImpl> weak_self = weak_factory_.GetWeakPtr();
3414
3415 MojoBindingsController* mojo_bindings_controller =
3416 MojoBindingsController::Get(this);
3417 if (mojo_bindings_controller)
3418 mojo_bindings_controller->RunScriptsAtDocumentReady();
3419
3420 if (!weak_self.get())
3421 return;
3422
3423 GetContentClient()->renderer()->RunScriptsAtDocumentEnd(this);
3424 // Do not use |this| or |frame|! ContentClient might have deleted them by now!
3425 }
3426
3395 void RenderFrameImpl::didHandleOnloadEvents(blink::WebLocalFrame* frame) { 3427 void RenderFrameImpl::didHandleOnloadEvents(blink::WebLocalFrame* frame) {
3396 DCHECK_EQ(frame_, frame); 3428 DCHECK_EQ(frame_, frame);
3397 if (!frame->parent()) { 3429 if (!frame->parent()) {
3398 FrameMsg_UILoadMetricsReportType::Value report_type = 3430 FrameMsg_UILoadMetricsReportType::Value report_type =
3399 static_cast<FrameMsg_UILoadMetricsReportType::Value>( 3431 static_cast<FrameMsg_UILoadMetricsReportType::Value>(
3400 frame->dataSource()->request().inputPerfMetricReportPolicy()); 3432 frame->dataSource()->request().inputPerfMetricReportPolicy());
3401 base::TimeTicks ui_timestamp = base::TimeTicks() + 3433 base::TimeTicks ui_timestamp = base::TimeTicks() +
3402 base::TimeDelta::FromSecondsD( 3434 base::TimeDelta::FromSecondsD(
3403 frame->dataSource()->request().uiStartTime()); 3435 frame->dataSource()->request().uiStartTime());
3404 3436
(...skipping 2663 matching lines...) Expand 10 before | Expand all | Expand 10 after
6068 int match_count, 6100 int match_count,
6069 int ordinal, 6101 int ordinal,
6070 const WebRect& selection_rect, 6102 const WebRect& selection_rect,
6071 bool final_status_update) { 6103 bool final_status_update) {
6072 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, match_count, 6104 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, match_count,
6073 selection_rect, ordinal, 6105 selection_rect, ordinal,
6074 final_status_update)); 6106 final_status_update));
6075 } 6107 }
6076 6108
6077 } // namespace content 6109 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_frame_impl.h ('k') | extensions/renderer/dispatcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698