| 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 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 1927 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1938 // Remember that we've already processed this request, so we don't update | 1938 // Remember that we've already processed this request, so we don't update |
| 1939 // the session history again. We do this regardless of whether this is | 1939 // the session history again. We do this regardless of whether this is |
| 1940 // a session history navigation, because if we attempted a session history | 1940 // a session history navigation, because if we attempted a session history |
| 1941 // navigation without valid HistoryItem state, WebCore will think it is a | 1941 // navigation without valid HistoryItem state, WebCore will think it is a |
| 1942 // new navigation. | 1942 // new navigation. |
| 1943 navigation_state->set_request_committed(true); | 1943 navigation_state->set_request_committed(true); |
| 1944 | 1944 |
| 1945 UpdateURL(frame); | 1945 UpdateURL(frame); |
| 1946 | 1946 |
| 1947 // Check whether we have new encoding name. | 1947 // Check whether we have new encoding name. |
| 1948 render_view_->UpdateEncoding(frame, frame->view()->pageEncoding().utf8()); | 1948 UpdateEncoding(frame, frame->view()->pageEncoding().utf8()); |
| 1949 } | 1949 } |
| 1950 | 1950 |
| 1951 void RenderFrameImpl::didClearWindowObject(blink::WebLocalFrame* frame, | 1951 void RenderFrameImpl::didClearWindowObject(blink::WebLocalFrame* frame, |
| 1952 int world_id) { | 1952 int world_id) { |
| 1953 DCHECK(!frame_ || frame_ == frame); | 1953 DCHECK(!frame_ || frame_ == frame); |
| 1954 // TODO(nasko): Move implementation here. Needed state: | 1954 // TODO(nasko): Move implementation here. Needed state: |
| 1955 // * enabled_bindings_ | 1955 // * enabled_bindings_ |
| 1956 // * dom_automation_controller_ | 1956 // * dom_automation_controller_ |
| 1957 // * stats_collection_controller_ | 1957 // * stats_collection_controller_ |
| 1958 | 1958 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 1984 } | 1984 } |
| 1985 | 1985 |
| 1986 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(), | 1986 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(), |
| 1987 DidCreateDocumentElement(frame)); | 1987 DidCreateDocumentElement(frame)); |
| 1988 } | 1988 } |
| 1989 | 1989 |
| 1990 void RenderFrameImpl::didReceiveTitle(blink::WebLocalFrame* frame, | 1990 void RenderFrameImpl::didReceiveTitle(blink::WebLocalFrame* frame, |
| 1991 const blink::WebString& title, | 1991 const blink::WebString& title, |
| 1992 blink::WebTextDirection direction) { | 1992 blink::WebTextDirection direction) { |
| 1993 DCHECK(!frame_ || frame_ == frame); | 1993 DCHECK(!frame_ || frame_ == frame); |
| 1994 // TODO(nasko): Investigate wheather implementation should move here. | 1994 // Ignore all but top level navigations. |
| 1995 render_view_->didReceiveTitle(frame, title, direction); | 1995 if (!frame->parent()) { |
| 1996 base::string16 title16 = title; |
| 1997 base::debug::TraceLog::GetInstance()->UpdateProcessLabel( |
| 1998 routing_id_, base::UTF16ToUTF8(title16)); |
| 1999 |
| 2000 base::string16 shortened_title = title16.substr(0, kMaxTitleChars); |
| 2001 Send(new FrameHostMsg_UpdateTitle(routing_id_, |
| 2002 render_view_->page_id_, |
| 2003 shortened_title, direction)); |
| 2004 } |
| 2005 |
| 2006 // Also check whether we have new encoding name. |
| 2007 UpdateEncoding(frame, frame->view()->pageEncoding().utf8()); |
| 1996 } | 2008 } |
| 1997 | 2009 |
| 1998 void RenderFrameImpl::didChangeIcon(blink::WebLocalFrame* frame, | 2010 void RenderFrameImpl::didChangeIcon(blink::WebLocalFrame* frame, |
| 1999 blink::WebIconURL::Type icon_type) { | 2011 blink::WebIconURL::Type icon_type) { |
| 2000 DCHECK(!frame_ || frame_ == frame); | 2012 DCHECK(!frame_ || frame_ == frame); |
| 2001 // TODO(nasko): Investigate wheather implementation should move here. | 2013 // TODO(nasko): Investigate wheather implementation should move here. |
| 2002 render_view_->didChangeIcon(frame, icon_type); | 2014 render_view_->didChangeIcon(frame, icon_type); |
| 2003 } | 2015 } |
| 2004 | 2016 |
| 2005 void RenderFrameImpl::didFinishDocumentLoad(blink::WebLocalFrame* frame) { | 2017 void RenderFrameImpl::didFinishDocumentLoad(blink::WebLocalFrame* frame) { |
| 2006 DCHECK(!frame_ || frame_ == frame); | 2018 DCHECK(!frame_ || frame_ == frame); |
| 2007 WebDataSource* ds = frame->dataSource(); | 2019 WebDataSource* ds = frame->dataSource(); |
| 2008 DocumentState* document_state = DocumentState::FromDataSource(ds); | 2020 DocumentState* document_state = DocumentState::FromDataSource(ds); |
| 2009 document_state->set_finish_document_load_time(Time::Now()); | 2021 document_state->set_finish_document_load_time(Time::Now()); |
| 2010 | 2022 |
| 2011 Send(new FrameHostMsg_DidFinishDocumentLoad(routing_id_)); | 2023 Send(new FrameHostMsg_DidFinishDocumentLoad(routing_id_)); |
| 2012 | 2024 |
| 2013 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(), | 2025 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(), |
| 2014 DidFinishDocumentLoad(frame)); | 2026 DidFinishDocumentLoad(frame)); |
| 2015 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, DidFinishDocumentLoad()); | 2027 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, DidFinishDocumentLoad()); |
| 2016 | 2028 |
| 2017 // Check whether we have new encoding name. | 2029 // Check whether we have new encoding name. |
| 2018 render_view_->UpdateEncoding(frame, frame->view()->pageEncoding().utf8()); | 2030 UpdateEncoding(frame, frame->view()->pageEncoding().utf8()); |
| 2019 } | 2031 } |
| 2020 | 2032 |
| 2021 void RenderFrameImpl::didHandleOnloadEvents(blink::WebLocalFrame* frame) { | 2033 void RenderFrameImpl::didHandleOnloadEvents(blink::WebLocalFrame* frame) { |
| 2022 DCHECK(!frame_ || frame_ == frame); | 2034 DCHECK(!frame_ || frame_ == frame); |
| 2023 if (!frame->parent()) | 2035 if (!frame->parent()) |
| 2024 Send(new FrameHostMsg_DocumentOnLoadCompleted(routing_id_)); | 2036 Send(new FrameHostMsg_DocumentOnLoadCompleted(routing_id_)); |
| 2025 } | 2037 } |
| 2026 | 2038 |
| 2027 void RenderFrameImpl::didFailLoad(blink::WebLocalFrame* frame, | 2039 void RenderFrameImpl::didFailLoad(blink::WebLocalFrame* frame, |
| 2028 const blink::WebURLError& error) { | 2040 const blink::WebURLError& error) { |
| (...skipping 1243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3272 if (policy == blink::WebNavigationPolicyNewBackgroundTab || | 3284 if (policy == blink::WebNavigationPolicyNewBackgroundTab || |
| 3273 policy == blink::WebNavigationPolicyNewForegroundTab || | 3285 policy == blink::WebNavigationPolicyNewForegroundTab || |
| 3274 policy == blink::WebNavigationPolicyNewWindow || | 3286 policy == blink::WebNavigationPolicyNewWindow || |
| 3275 policy == blink::WebNavigationPolicyNewPopup) { | 3287 policy == blink::WebNavigationPolicyNewPopup) { |
| 3276 WebUserGestureIndicator::consumeUserGesture(); | 3288 WebUserGestureIndicator::consumeUserGesture(); |
| 3277 } | 3289 } |
| 3278 | 3290 |
| 3279 Send(new FrameHostMsg_OpenURL(routing_id_, params)); | 3291 Send(new FrameHostMsg_OpenURL(routing_id_, params)); |
| 3280 } | 3292 } |
| 3281 | 3293 |
| 3294 void RenderFrameImpl::UpdateEncoding(WebFrame* frame, |
| 3295 const std::string& encoding_name) { |
| 3296 // Only update main frame's encoding_name. |
| 3297 if (!frame->parent()) |
| 3298 Send(new FrameHostMsg_UpdateEncoding(routing_id_, encoding_name)); |
| 3299 } |
| 3300 |
| 3282 void RenderFrameImpl::SyncSelectionIfRequired() { | 3301 void RenderFrameImpl::SyncSelectionIfRequired() { |
| 3283 base::string16 text; | 3302 base::string16 text; |
| 3284 size_t offset; | 3303 size_t offset; |
| 3285 gfx::Range range; | 3304 gfx::Range range; |
| 3286 #if defined(ENABLE_PLUGINS) | 3305 #if defined(ENABLE_PLUGINS) |
| 3287 if (render_view_->focused_pepper_plugin_) { | 3306 if (render_view_->focused_pepper_plugin_) { |
| 3288 render_view_->focused_pepper_plugin_->GetSurroundingText(&text, &range); | 3307 render_view_->focused_pepper_plugin_->GetSurroundingText(&text, &range); |
| 3289 offset = 0; // Pepper API does not support offset reporting. | 3308 offset = 0; // Pepper API does not support offset reporting. |
| 3290 // TODO(kinaba): cut as needed. | 3309 // TODO(kinaba): cut as needed. |
| 3291 } else | 3310 } else |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3429 weak_factory_.GetWeakPtr(), | 3448 weak_factory_.GetWeakPtr(), |
| 3430 render_view_->media_player_manager_, | 3449 render_view_->media_player_manager_, |
| 3431 stream_texture_factory, | 3450 stream_texture_factory, |
| 3432 RenderThreadImpl::current()->GetMediaThreadMessageLoopProxy(), | 3451 RenderThreadImpl::current()->GetMediaThreadMessageLoopProxy(), |
| 3433 new RenderMediaLog()); | 3452 new RenderMediaLog()); |
| 3434 } | 3453 } |
| 3435 | 3454 |
| 3436 #endif | 3455 #endif |
| 3437 | 3456 |
| 3438 } // namespace content | 3457 } // namespace content |
| OLD | NEW |