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 1949 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1960 if (is_new_navigation) { | 1960 if (is_new_navigation) { |
1961 // We bump our Page ID to correspond with the new session history entry. | 1961 // We bump our Page ID to correspond with the new session history entry. |
1962 render_view_->page_id_ = render_view_->next_page_id_++; | 1962 render_view_->page_id_ = render_view_->next_page_id_++; |
1963 | 1963 |
1964 // Don't update history_page_ids_ (etc) for kSwappedOutURL, since | 1964 // Don't update history_page_ids_ (etc) for kSwappedOutURL, since |
1965 // we don't want to forget the entry that was there, and since we will | 1965 // we don't want to forget the entry that was there, and since we will |
1966 // never come back to kSwappedOutURL. Note that we have to call | 1966 // never come back to kSwappedOutURL. Note that we have to call |
1967 // UpdateSessionHistory and update page_id_ even in this case, so that | 1967 // UpdateSessionHistory and update page_id_ even in this case, so that |
1968 // the current entry gets a state update and so that we don't send a | 1968 // the current entry gets a state update and so that we don't send a |
1969 // state update to the wrong entry when we swap back in. | 1969 // state update to the wrong entry when we swap back in. |
1970 if (render_view_->GetLoadingUrl(frame) != GURL(kSwappedOutURL)) { | 1970 if (GetLoadingUrl() != GURL(kSwappedOutURL)) { |
1971 // Advance our offset in session history, applying the length limit. | 1971 // Advance our offset in session history, applying the length limit. |
1972 // There is now no forward history. | 1972 // There is now no forward history. |
1973 render_view_->history_list_offset_++; | 1973 render_view_->history_list_offset_++; |
1974 if (render_view_->history_list_offset_ >= kMaxSessionHistoryEntries) | 1974 if (render_view_->history_list_offset_ >= kMaxSessionHistoryEntries) |
1975 render_view_->history_list_offset_ = kMaxSessionHistoryEntries - 1; | 1975 render_view_->history_list_offset_ = kMaxSessionHistoryEntries - 1; |
1976 render_view_->history_list_length_ = | 1976 render_view_->history_list_length_ = |
1977 render_view_->history_list_offset_ + 1; | 1977 render_view_->history_list_offset_ + 1; |
1978 render_view_->history_page_ids_.resize( | 1978 render_view_->history_page_ids_.resize( |
1979 render_view_->history_list_length_, -1); | 1979 render_view_->history_list_length_, -1); |
1980 render_view_->history_page_ids_[render_view_->history_list_offset_] = | 1980 render_view_->history_page_ids_[render_view_->history_list_offset_] = |
(...skipping 22 matching lines...) Expand all Loading... |
2003 // If the history list is valid, our list of page IDs should be correct. | 2003 // If the history list is valid, our list of page IDs should be correct. |
2004 DCHECK(render_view_->history_list_length_ <= 0 || | 2004 DCHECK(render_view_->history_list_length_ <= 0 || |
2005 render_view_->history_list_offset_ < 0 || | 2005 render_view_->history_list_offset_ < 0 || |
2006 render_view_->history_list_offset_ >= | 2006 render_view_->history_list_offset_ >= |
2007 render_view_->history_list_length_ || | 2007 render_view_->history_list_length_ || |
2008 render_view_->history_page_ids_[render_view_->history_list_offset_] | 2008 render_view_->history_page_ids_[render_view_->history_list_offset_] |
2009 == render_view_->page_id_); | 2009 == render_view_->page_id_); |
2010 } | 2010 } |
2011 } | 2011 } |
2012 | 2012 |
2013 render_view_->FrameDidCommitProvisionalLoad(frame, is_new_navigation); | 2013 FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers_, |
| 2014 DidCommitProvisionalLoad(frame, is_new_navigation)); |
2014 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, | 2015 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, |
2015 DidCommitProvisionalLoad(is_new_navigation)); | 2016 DidCommitProvisionalLoad(is_new_navigation)); |
2016 | 2017 |
| 2018 if (!frame->parent()) { // Only for top frames. |
| 2019 RenderThreadImpl* render_thread_impl = RenderThreadImpl::current(); |
| 2020 if (render_thread_impl) { // Can be NULL in tests. |
| 2021 render_thread_impl->histogram_customizer()-> |
| 2022 RenderViewNavigatedToHost(GURL(GetLoadingUrl()).host(), |
| 2023 RenderViewImpl::GetRenderViewCount()); |
| 2024 } |
| 2025 } |
| 2026 |
2017 // Remember that we've already processed this request, so we don't update | 2027 // Remember that we've already processed this request, so we don't update |
2018 // the session history again. We do this regardless of whether this is | 2028 // the session history again. We do this regardless of whether this is |
2019 // a session history navigation, because if we attempted a session history | 2029 // a session history navigation, because if we attempted a session history |
2020 // navigation without valid HistoryItem state, WebCore will think it is a | 2030 // navigation without valid HistoryItem state, WebCore will think it is a |
2021 // new navigation. | 2031 // new navigation. |
2022 navigation_state->set_request_committed(true); | 2032 navigation_state->set_request_committed(true); |
2023 | 2033 |
2024 UpdateURL(frame); | 2034 UpdateURL(frame); |
2025 | 2035 |
2026 // Check whether we have new encoding name. | 2036 // Check whether we have new encoding name. |
(...skipping 928 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2955 params.frame_unique_name = frame->uniqueName(); | 2965 params.frame_unique_name = frame->uniqueName(); |
2956 params.socket_address.set_host(response.remoteIPAddress().utf8()); | 2966 params.socket_address.set_host(response.remoteIPAddress().utf8()); |
2957 params.socket_address.set_port(response.remotePort()); | 2967 params.socket_address.set_port(response.remotePort()); |
2958 WebURLResponseExtraDataImpl* extra_data = GetExtraDataFromResponse(response); | 2968 WebURLResponseExtraDataImpl* extra_data = GetExtraDataFromResponse(response); |
2959 if (extra_data) | 2969 if (extra_data) |
2960 params.was_fetched_via_proxy = extra_data->was_fetched_via_proxy(); | 2970 params.was_fetched_via_proxy = extra_data->was_fetched_via_proxy(); |
2961 params.was_within_same_page = navigation_state->was_within_same_page(); | 2971 params.was_within_same_page = navigation_state->was_within_same_page(); |
2962 params.security_info = response.securityInfo(); | 2972 params.security_info = response.securityInfo(); |
2963 | 2973 |
2964 // Set the URL to be displayed in the browser UI to the user. | 2974 // Set the URL to be displayed in the browser UI to the user. |
2965 params.url = render_view_->GetLoadingUrl(frame); | 2975 params.url = GetLoadingUrl(); |
2966 DCHECK(!is_swapped_out_ || params.url == GURL(kSwappedOutURL)); | 2976 DCHECK(!is_swapped_out_ || params.url == GURL(kSwappedOutURL)); |
2967 | 2977 |
2968 if (frame->document().baseURL() != params.url) | 2978 if (frame->document().baseURL() != params.url) |
2969 params.base_url = frame->document().baseURL(); | 2979 params.base_url = frame->document().baseURL(); |
2970 | 2980 |
2971 GetRedirectChain(ds, ¶ms.redirects); | 2981 GetRedirectChain(ds, ¶ms.redirects); |
2972 params.should_update_history = !ds->hasUnreachableURL() && | 2982 params.should_update_history = !ds->hasUnreachableURL() && |
2973 !response.isMultipartPayload() && (response.httpStatusCode() != 404); | 2983 !response.isMultipartPayload() && (response.httpStatusCode() != 404); |
2974 | 2984 |
2975 params.searchable_form_url = internal_data->searchable_form_url(); | 2985 params.searchable_form_url = internal_data->searchable_form_url(); |
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3499 RenderFrameImpl::CreateRendererFactory() { | 3509 RenderFrameImpl::CreateRendererFactory() { |
3500 #if defined(ENABLE_WEBRTC) | 3510 #if defined(ENABLE_WEBRTC) |
3501 return scoped_ptr<MediaStreamRendererFactory>( | 3511 return scoped_ptr<MediaStreamRendererFactory>( |
3502 new MediaStreamRendererFactory()); | 3512 new MediaStreamRendererFactory()); |
3503 #else | 3513 #else |
3504 return scoped_ptr<MediaStreamRendererFactory>( | 3514 return scoped_ptr<MediaStreamRendererFactory>( |
3505 static_cast<MediaStreamRendererFactory*>(NULL)); | 3515 static_cast<MediaStreamRendererFactory*>(NULL)); |
3506 #endif | 3516 #endif |
3507 } | 3517 } |
3508 | 3518 |
| 3519 GURL RenderFrameImpl::GetLoadingUrl() const { |
| 3520 WebDataSource* ds = frame_->dataSource(); |
| 3521 if (ds->hasUnreachableURL()) |
| 3522 return ds->unreachableURL(); |
| 3523 |
| 3524 const WebURLRequest& request = ds->request(); |
| 3525 return request.url(); |
| 3526 } |
| 3527 |
3509 #if defined(OS_ANDROID) | 3528 #if defined(OS_ANDROID) |
3510 | 3529 |
3511 WebMediaPlayer* RenderFrameImpl::CreateAndroidWebMediaPlayer( | 3530 WebMediaPlayer* RenderFrameImpl::CreateAndroidWebMediaPlayer( |
3512 const blink::WebURL& url, | 3531 const blink::WebURL& url, |
3513 WebMediaPlayerClient* client) { | 3532 WebMediaPlayerClient* client) { |
3514 GpuChannelHost* gpu_channel_host = | 3533 GpuChannelHost* gpu_channel_host = |
3515 RenderThreadImpl::current()->EstablishGpuChannelSync( | 3534 RenderThreadImpl::current()->EstablishGpuChannelSync( |
3516 CAUSE_FOR_GPU_LAUNCH_VIDEODECODEACCELERATOR_INITIALIZE); | 3535 CAUSE_FOR_GPU_LAUNCH_VIDEODECODEACCELERATOR_INITIALIZE); |
3517 if (!gpu_channel_host) { | 3536 if (!gpu_channel_host) { |
3518 LOG(ERROR) << "Failed to establish GPU channel for media player"; | 3537 LOG(ERROR) << "Failed to establish GPU channel for media player"; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3563 | 3582 |
3564 #if defined(ENABLE_BROWSER_CDMS) | 3583 #if defined(ENABLE_BROWSER_CDMS) |
3565 RendererCdmManager* RenderFrameImpl::GetCdmManager() { | 3584 RendererCdmManager* RenderFrameImpl::GetCdmManager() { |
3566 if (!cdm_manager_) | 3585 if (!cdm_manager_) |
3567 cdm_manager_ = new RendererCdmManager(this); | 3586 cdm_manager_ = new RendererCdmManager(this); |
3568 return cdm_manager_; | 3587 return cdm_manager_; |
3569 } | 3588 } |
3570 #endif // defined(ENABLE_BROWSER_CDMS) | 3589 #endif // defined(ENABLE_BROWSER_CDMS) |
3571 | 3590 |
3572 } // namespace content | 3591 } // namespace content |
OLD | NEW |