OLD | NEW |
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 3343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3354 main_frame->document().isPluginDocument())); | 3354 main_frame->document().isPluginDocument())); |
3355 } | 3355 } |
3356 } | 3356 } |
3357 | 3357 |
3358 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, | 3358 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, |
3359 DidCreateDocumentElement()); | 3359 DidCreateDocumentElement()); |
3360 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(), | 3360 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(), |
3361 DidCreateDocumentElement(frame)); | 3361 DidCreateDocumentElement(frame)); |
3362 } | 3362 } |
3363 | 3363 |
| 3364 void RenderFrameImpl::runScriptsAtDocumentElementAvailable( |
| 3365 blink::WebLocalFrame* frame) { |
| 3366 DCHECK(!frame_ || frame_ == frame); |
| 3367 base::WeakPtr<RenderFrameImpl> weak_self = weak_factory_.GetWeakPtr(); |
| 3368 |
| 3369 MojoBindingsController* mojo_bindings_controller = |
| 3370 MojoBindingsController::Get(this); |
| 3371 if (mojo_bindings_controller) |
| 3372 mojo_bindings_controller->RunScriptsAtDocumentStart(); |
| 3373 |
| 3374 if (!weak_self.get()) |
| 3375 return; |
| 3376 |
| 3377 GetContentClient()->renderer()->RunScriptsAtDocumentStart(this); |
| 3378 // Do not use |this| or |frame|! ContentClient might have deleted them by now! |
| 3379 } |
| 3380 |
3364 void RenderFrameImpl::didReceiveTitle(blink::WebLocalFrame* frame, | 3381 void RenderFrameImpl::didReceiveTitle(blink::WebLocalFrame* frame, |
3365 const blink::WebString& title, | 3382 const blink::WebString& title, |
3366 blink::WebTextDirection direction) { | 3383 blink::WebTextDirection direction) { |
3367 DCHECK_EQ(frame_, frame); | 3384 DCHECK_EQ(frame_, frame); |
3368 // Ignore all but top level navigations. | 3385 // Ignore all but top level navigations. |
3369 if (!frame->parent()) { | 3386 if (!frame->parent()) { |
3370 base::string16 title16 = title; | 3387 base::string16 title16 = title; |
3371 base::trace_event::TraceLog::GetInstance()->UpdateProcessLabel( | 3388 base::trace_event::TraceLog::GetInstance()->UpdateProcessLabel( |
3372 routing_id_, base::UTF16ToUTF8(title16)); | 3389 routing_id_, base::UTF16ToUTF8(title16)); |
3373 | 3390 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3429 if (GetContentClient()->renderer()->HasErrorPage(http_status_code, | 3446 if (GetContentClient()->renderer()->HasErrorPage(http_status_code, |
3430 &error_domain)) { | 3447 &error_domain)) { |
3431 WebURLError error; | 3448 WebURLError error; |
3432 error.unreachableURL = frame->document().url(); | 3449 error.unreachableURL = frame->document().url(); |
3433 error.domain = WebString::fromUTF8(error_domain); | 3450 error.domain = WebString::fromUTF8(error_domain); |
3434 error.reason = http_status_code; | 3451 error.reason = http_status_code; |
3435 LoadNavigationErrorPage(frame->dataSource()->request(), error, true); | 3452 LoadNavigationErrorPage(frame->dataSource()->request(), error, true); |
3436 } | 3453 } |
3437 } | 3454 } |
3438 | 3455 |
| 3456 void RenderFrameImpl::runScriptsAtDocumentReady(blink::WebLocalFrame* frame) { |
| 3457 base::WeakPtr<RenderFrameImpl> weak_self = weak_factory_.GetWeakPtr(); |
| 3458 |
| 3459 MojoBindingsController* mojo_bindings_controller = |
| 3460 MojoBindingsController::Get(this); |
| 3461 if (mojo_bindings_controller) |
| 3462 mojo_bindings_controller->RunScriptsAtDocumentReady(); |
| 3463 |
| 3464 if (!weak_self.get()) |
| 3465 return; |
| 3466 |
| 3467 GetContentClient()->renderer()->RunScriptsAtDocumentEnd(this); |
| 3468 // Do not use |this| or |frame|! ContentClient might have deleted them by now! |
| 3469 } |
| 3470 |
3439 void RenderFrameImpl::didHandleOnloadEvents(blink::WebLocalFrame* frame) { | 3471 void RenderFrameImpl::didHandleOnloadEvents(blink::WebLocalFrame* frame) { |
3440 DCHECK_EQ(frame_, frame); | 3472 DCHECK_EQ(frame_, frame); |
3441 if (!frame->parent()) { | 3473 if (!frame->parent()) { |
3442 FrameMsg_UILoadMetricsReportType::Value report_type = | 3474 FrameMsg_UILoadMetricsReportType::Value report_type = |
3443 static_cast<FrameMsg_UILoadMetricsReportType::Value>( | 3475 static_cast<FrameMsg_UILoadMetricsReportType::Value>( |
3444 frame->dataSource()->request().inputPerfMetricReportPolicy()); | 3476 frame->dataSource()->request().inputPerfMetricReportPolicy()); |
3445 base::TimeTicks ui_timestamp = base::TimeTicks() + | 3477 base::TimeTicks ui_timestamp = base::TimeTicks() + |
3446 base::TimeDelta::FromSecondsD( | 3478 base::TimeDelta::FromSecondsD( |
3447 frame->dataSource()->request().uiStartTime()); | 3479 frame->dataSource()->request().uiStartTime()); |
3448 | 3480 |
(...skipping 2663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6112 int match_count, | 6144 int match_count, |
6113 int ordinal, | 6145 int ordinal, |
6114 const WebRect& selection_rect, | 6146 const WebRect& selection_rect, |
6115 bool final_status_update) { | 6147 bool final_status_update) { |
6116 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, match_count, | 6148 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, match_count, |
6117 selection_rect, ordinal, | 6149 selection_rect, ordinal, |
6118 final_status_update)); | 6150 final_status_update)); |
6119 } | 6151 } |
6120 | 6152 |
6121 } // namespace content | 6153 } // namespace content |
OLD | NEW |