Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_view_impl.h" | 5 #include "content/renderer/render_view_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 366 | 366 |
| 367 static bool IsReload(const ViewMsg_Navigate_Params& params) { | 367 static bool IsReload(const ViewMsg_Navigate_Params& params) { |
| 368 return | 368 return |
| 369 params.navigation_type == ViewMsg_Navigate_Type::RELOAD || | 369 params.navigation_type == ViewMsg_Navigate_Type::RELOAD || |
| 370 params.navigation_type == ViewMsg_Navigate_Type::RELOAD_IGNORING_CACHE || | 370 params.navigation_type == ViewMsg_Navigate_Type::RELOAD_IGNORING_CACHE || |
| 371 params.navigation_type == | 371 params.navigation_type == |
| 372 ViewMsg_Navigate_Type::RELOAD_ORIGINAL_REQUEST_URL; | 372 ViewMsg_Navigate_Type::RELOAD_ORIGINAL_REQUEST_URL; |
| 373 } | 373 } |
| 374 | 374 |
| 375 // static | 375 // static |
| 376 void RenderViewImpl::GetRedirectChain(WebDataSource* ds, | |
| 377 std::vector<GURL>* result) { | |
| 378 // Replace any occurrences of swappedout:// with about:blank. | |
| 379 const WebURL& blank_url = GURL(kAboutBlankURL); | |
| 380 WebVector<WebURL> urls; | |
| 381 ds->redirectChain(urls); | |
| 382 result->reserve(urls.size()); | |
| 383 for (size_t i = 0; i < urls.size(); ++i) { | |
| 384 if (urls[i] != GURL(kSwappedOutURL)) | |
| 385 result->push_back(urls[i]); | |
| 386 else | |
| 387 result->push_back(blank_url); | |
| 388 } | |
| 389 } | |
| 390 | |
| 391 // static | |
| 392 Referrer RenderViewImpl::GetReferrerFromRequest( | 376 Referrer RenderViewImpl::GetReferrerFromRequest( |
| 393 WebFrame* frame, | 377 WebFrame* frame, |
| 394 const WebURLRequest& request) { | 378 const WebURLRequest& request) { |
| 395 return Referrer(GURL(request.httpHeaderField(WebString::fromUTF8("Referer"))), | 379 return Referrer(GURL(request.httpHeaderField(WebString::fromUTF8("Referer"))), |
| 396 request.referrerPolicy()); | 380 request.referrerPolicy()); |
| 397 } | 381 } |
| 398 | 382 |
| 399 // static | |
| 400 WebURLResponseExtraDataImpl* RenderViewImpl::GetExtraDataFromResponse( | |
| 401 const WebURLResponse& response) { | |
| 402 return static_cast<WebURLResponseExtraDataImpl*>( | |
| 403 response.extraData()); | |
| 404 } | |
| 405 | |
| 406 NOINLINE static void CrashIntentionally() { | 383 NOINLINE static void CrashIntentionally() { |
| 407 // NOTE(shess): Crash directly rather than using NOTREACHED() so | 384 // NOTE(shess): Crash directly rather than using NOTREACHED() so |
| 408 // that the signature is easier to triage in crash reports. | 385 // that the signature is easier to triage in crash reports. |
| 409 volatile int* zero = NULL; | 386 volatile int* zero = NULL; |
| 410 *zero = 0; | 387 *zero = 0; |
| 411 } | 388 } |
| 412 | 389 |
| 413 #if defined(ADDRESS_SANITIZER) | 390 #if defined(ADDRESS_SANITIZER) |
| 414 NOINLINE static void MaybeTriggerAsanError(const GURL& url) { | 391 NOINLINE static void MaybeTriggerAsanError(const GURL& url) { |
| 415 // NOTE(rogerm): We intentionally perform an invalid heap access here in | 392 // NOTE(rogerm): We intentionally perform an invalid heap access here in |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 692 virtual bool HandleMouseLockedInputEvent( | 669 virtual bool HandleMouseLockedInputEvent( |
| 693 const blink::WebMouseEvent &event) OVERRIDE { | 670 const blink::WebMouseEvent &event) OVERRIDE { |
| 694 // The WebWidget handles mouse lock in WebKit's handleInputEvent(). | 671 // The WebWidget handles mouse lock in WebKit's handleInputEvent(). |
| 695 return false; | 672 return false; |
| 696 } | 673 } |
| 697 | 674 |
| 698 private: | 675 private: |
| 699 blink::WebWidget* webwidget_; | 676 blink::WebWidget* webwidget_; |
| 700 }; | 677 }; |
| 701 | 678 |
| 702 int64 ExtractPostId(const WebHistoryItem& item) { | |
| 703 if (item.isNull()) | |
| 704 return -1; | |
| 705 | |
| 706 if (item.httpBody().isNull()) | |
| 707 return -1; | |
| 708 | |
| 709 return item.httpBody().identifier(); | |
| 710 } | |
| 711 | |
| 712 bool TouchEnabled() { | 679 bool TouchEnabled() { |
| 713 // Based on the definition of chrome::kEnableTouchIcon. | 680 // Based on the definition of chrome::kEnableTouchIcon. |
| 714 #if defined(OS_ANDROID) | 681 #if defined(OS_ANDROID) |
| 715 return true; | 682 return true; |
| 716 #else | 683 #else |
| 717 return false; | 684 return false; |
| 718 #endif | 685 #endif |
| 719 } | 686 } |
| 720 | 687 |
| 721 WebDragData DropDataToWebDragData(const DropData& drop_data) { | 688 WebDragData DropDataToWebDragData(const DropData& drop_data) { |
| (...skipping 1115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1837 // Inform RendererMediaPlayerManager to release all video player resources. | 1804 // Inform RendererMediaPlayerManager to release all video player resources. |
| 1838 // If something is in progress the resource will not be freed, it will | 1805 // If something is in progress the resource will not be freed, it will |
| 1839 // only be freed once the tab is destroyed or if the user navigates away | 1806 // only be freed once the tab is destroyed or if the user navigates away |
| 1840 // via WebMediaPlayerAndroid::Destroy. | 1807 // via WebMediaPlayerAndroid::Destroy. |
| 1841 media_player_manager_->ReleaseVideoResources(); | 1808 media_player_manager_->ReleaseVideoResources(); |
| 1842 } | 1809 } |
| 1843 #endif | 1810 #endif |
| 1844 | 1811 |
| 1845 /////////////////////////////////////////////////////////////////////////////// | 1812 /////////////////////////////////////////////////////////////////////////////// |
| 1846 | 1813 |
| 1847 // Tell the embedding application that the URL of the active page has changed | |
| 1848 void RenderViewImpl::UpdateURL(WebFrame* frame) { | |
| 1849 WebDataSource* ds = frame->dataSource(); | |
| 1850 DCHECK(ds); | |
| 1851 | |
| 1852 const WebURLRequest& request = ds->request(); | |
| 1853 const WebURLRequest& original_request = ds->originalRequest(); | |
| 1854 const WebURLResponse& response = ds->response(); | |
| 1855 | |
| 1856 DocumentState* document_state = DocumentState::FromDataSource(ds); | |
| 1857 NavigationState* navigation_state = document_state->navigation_state(); | |
| 1858 InternalDocumentStateData* internal_data = | |
| 1859 InternalDocumentStateData::FromDocumentState(document_state); | |
| 1860 | |
| 1861 ViewHostMsg_FrameNavigate_Params params; | |
| 1862 params.http_status_code = response.httpStatusCode(); | |
| 1863 params.is_post = false; | |
| 1864 params.post_id = -1; | |
| 1865 params.page_id = page_id_; | |
| 1866 params.frame_id = frame->identifier(); | |
| 1867 params.frame_unique_name = frame->uniqueName(); | |
| 1868 params.socket_address.set_host(response.remoteIPAddress().utf8()); | |
| 1869 params.socket_address.set_port(response.remotePort()); | |
| 1870 WebURLResponseExtraDataImpl* extra_data = GetExtraDataFromResponse(response); | |
| 1871 if (extra_data) { | |
| 1872 params.was_fetched_via_proxy = extra_data->was_fetched_via_proxy(); | |
| 1873 } | |
| 1874 params.was_within_same_page = navigation_state->was_within_same_page(); | |
| 1875 params.security_info = response.securityInfo(); | |
| 1876 | |
| 1877 // Set the URL to be displayed in the browser UI to the user. | |
| 1878 params.url = GetLoadingUrl(frame); | |
| 1879 DCHECK(!is_swapped_out_ || params.url == GURL(kSwappedOutURL)); | |
| 1880 | |
| 1881 if (frame->document().baseURL() != params.url) | |
| 1882 params.base_url = frame->document().baseURL(); | |
| 1883 | |
| 1884 GetRedirectChain(ds, ¶ms.redirects); | |
| 1885 params.should_update_history = !ds->hasUnreachableURL() && | |
| 1886 !response.isMultipartPayload() && (response.httpStatusCode() != 404); | |
| 1887 | |
| 1888 params.searchable_form_url = internal_data->searchable_form_url(); | |
| 1889 params.searchable_form_encoding = internal_data->searchable_form_encoding(); | |
| 1890 | |
| 1891 params.gesture = navigation_gesture_; | |
| 1892 navigation_gesture_ = NavigationGestureUnknown; | |
| 1893 | |
| 1894 // Make navigation state a part of the FrameNavigate message so that commited | |
| 1895 // entry had it at all times. | |
| 1896 WebHistoryItem item = frame->currentHistoryItem(); | |
| 1897 if (item.isNull()) { | |
| 1898 item.initialize(); | |
| 1899 item.setURLString(request.url().spec().utf16()); | |
| 1900 } | |
| 1901 params.page_state = HistoryItemToPageState(item); | |
| 1902 | |
| 1903 if (!frame->parent()) { | |
| 1904 // Top-level navigation. | |
| 1905 | |
| 1906 // Reset the zoom limits in case a plugin had changed them previously. This | |
| 1907 // will also call us back which will cause us to send a message to | |
| 1908 // update WebContentsImpl. | |
| 1909 webview()->zoomLimitsChanged(ZoomFactorToZoomLevel(kMinimumZoomFactor), | |
| 1910 ZoomFactorToZoomLevel(kMaximumZoomFactor)); | |
| 1911 | |
| 1912 // Set zoom level, but don't do it for full-page plugin since they don't use | |
| 1913 // the same zoom settings. | |
| 1914 HostZoomLevels::iterator host_zoom = | |
| 1915 host_zoom_levels_.find(GURL(request.url())); | |
| 1916 if (webview()->mainFrame()->document().isPluginDocument()) { | |
| 1917 // Reset the zoom levels for plugins. | |
| 1918 webview()->setZoomLevel(0); | |
| 1919 } else { | |
| 1920 if (host_zoom != host_zoom_levels_.end()) | |
| 1921 webview()->setZoomLevel(host_zoom->second); | |
| 1922 } | |
| 1923 | |
| 1924 if (host_zoom != host_zoom_levels_.end()) { | |
| 1925 // This zoom level was merely recorded transiently for this load. We can | |
| 1926 // erase it now. If at some point we reload this page, the browser will | |
| 1927 // send us a new, up-to-date zoom level. | |
| 1928 host_zoom_levels_.erase(host_zoom); | |
| 1929 } | |
| 1930 | |
| 1931 // Update contents MIME type for main frame. | |
| 1932 params.contents_mime_type = ds->response().mimeType().utf8(); | |
| 1933 | |
| 1934 params.transition = navigation_state->transition_type(); | |
| 1935 if (!PageTransitionIsMainFrame(params.transition)) { | |
| 1936 // If the main frame does a load, it should not be reported as a subframe | |
| 1937 // navigation. This can occur in the following case: | |
| 1938 // 1. You're on a site with frames. | |
| 1939 // 2. You do a subframe navigation. This is stored with transition type | |
| 1940 // MANUAL_SUBFRAME. | |
| 1941 // 3. You navigate to some non-frame site, say, google.com. | |
| 1942 // 4. You navigate back to the page from step 2. Since it was initially | |
| 1943 // MANUAL_SUBFRAME, it will be that same transition type here. | |
| 1944 // We don't want that, because any navigation that changes the toplevel | |
| 1945 // frame should be tracked as a toplevel navigation (this allows us to | |
| 1946 // update the URL bar, etc). | |
| 1947 params.transition = PAGE_TRANSITION_LINK; | |
| 1948 } | |
| 1949 | |
| 1950 // If the page contained a client redirect (meta refresh, document.loc...), | |
| 1951 // set the referrer and transition appropriately. | |
| 1952 if (ds->isClientRedirect()) { | |
| 1953 params.referrer = | |
| 1954 Referrer(params.redirects[0], ds->request().referrerPolicy()); | |
| 1955 params.transition = static_cast<PageTransition>( | |
| 1956 params.transition | PAGE_TRANSITION_CLIENT_REDIRECT); | |
| 1957 } else { | |
| 1958 params.referrer = GetReferrerFromRequest(frame, ds->request()); | |
| 1959 } | |
| 1960 | |
| 1961 base::string16 method = request.httpMethod(); | |
| 1962 if (EqualsASCII(method, "POST")) { | |
| 1963 params.is_post = true; | |
| 1964 params.post_id = ExtractPostId(item); | |
| 1965 } | |
| 1966 | |
| 1967 // Send the user agent override back. | |
| 1968 params.is_overriding_user_agent = internal_data->is_overriding_user_agent(); | |
| 1969 | |
| 1970 // Track the URL of the original request. We use the first entry of the | |
| 1971 // redirect chain if it exists because the chain may have started in another | |
| 1972 // process. | |
| 1973 if (params.redirects.size() > 0) | |
| 1974 params.original_request_url = params.redirects.at(0); | |
| 1975 else | |
| 1976 params.original_request_url = original_request.url(); | |
| 1977 | |
| 1978 params.history_list_was_cleared = | |
| 1979 navigation_state->history_list_was_cleared(); | |
| 1980 | |
| 1981 // Save some histogram data so we can compute the average memory used per | |
| 1982 // page load of the glyphs. | |
| 1983 UMA_HISTOGRAM_COUNTS_10000("Memory.GlyphPagesPerLoad", | |
| 1984 blink::WebGlyphCache::pageCount()); | |
| 1985 | |
| 1986 // This message needs to be sent before any of allowScripts(), | |
| 1987 // allowImages(), allowPlugins() is called for the new page, so that when | |
| 1988 // these functions send a ViewHostMsg_ContentBlocked message, it arrives | |
| 1989 // after the ViewHostMsg_FrameNavigate message. | |
| 1990 Send(new ViewHostMsg_FrameNavigate(routing_id_, params)); | |
| 1991 } else { | |
| 1992 // Subframe navigation: the type depends on whether this navigation | |
| 1993 // generated a new session history entry. When they do generate a session | |
| 1994 // history entry, it means the user initiated the navigation and we should | |
| 1995 // mark it as such. This test checks if this is the first time UpdateURL | |
| 1996 // has been called since WillNavigateToURL was called to initiate the load. | |
| 1997 if (page_id_ > last_page_id_sent_to_browser_) | |
| 1998 params.transition = PAGE_TRANSITION_MANUAL_SUBFRAME; | |
| 1999 else | |
| 2000 params.transition = PAGE_TRANSITION_AUTO_SUBFRAME; | |
| 2001 | |
| 2002 DCHECK(!navigation_state->history_list_was_cleared()); | |
| 2003 params.history_list_was_cleared = false; | |
| 2004 | |
| 2005 // Don't send this message while the subframe is swapped out. | |
| 2006 // TODO(creis): This whole method should move to RenderFrame. | |
| 2007 RenderFrameImpl* rf = RenderFrameImpl::FromWebFrame(frame); | |
| 2008 if (!rf || !rf->is_swapped_out()) | |
| 2009 Send(new ViewHostMsg_FrameNavigate(routing_id_, params)); | |
| 2010 } | |
| 2011 | |
| 2012 last_page_id_sent_to_browser_ = | |
| 2013 std::max(last_page_id_sent_to_browser_, page_id_); | |
| 2014 | |
| 2015 // If we end up reusing this WebRequest (for example, due to a #ref click), | |
| 2016 // we don't want the transition type to persist. Just clear it. | |
| 2017 navigation_state->set_transition_type(PAGE_TRANSITION_LINK); | |
| 2018 } | |
| 2019 | |
| 2020 // Tell the embedding application that the title of the active page has changed | 1814 // Tell the embedding application that the title of the active page has changed |
| 2021 void RenderViewImpl::UpdateTitle(WebFrame* frame, | 1815 void RenderViewImpl::UpdateTitle(WebFrame* frame, |
| 2022 const base::string16& title, | 1816 const base::string16& title, |
| 2023 WebTextDirection title_direction) { | 1817 WebTextDirection title_direction) { |
| 2024 // Ignore all but top level navigations. | 1818 // Ignore all but top level navigations. |
| 2025 if (frame->parent()) | 1819 if (frame->parent()) |
| 2026 return; | 1820 return; |
| 2027 | 1821 |
| 2028 base::debug::TraceLog::GetInstance()->UpdateProcessLabel( | 1822 base::debug::TraceLog::GetInstance()->UpdateProcessLabel( |
| 2029 routing_id_, base::UTF16ToUTF8(title)); | 1823 routing_id_, base::UTF16ToUTF8(title)); |
| (...skipping 1438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3468 // Note: It is important this notification occur before DidStopLoading so the | 3262 // Note: It is important this notification occur before DidStopLoading so the |
| 3469 // SSL manager can react to the provisional load failure before being | 3263 // SSL manager can react to the provisional load failure before being |
| 3470 // notified the load stopped. | 3264 // notified the load stopped. |
| 3471 // | 3265 // |
| 3472 FOR_EACH_OBSERVER( | 3266 FOR_EACH_OBSERVER( |
| 3473 RenderViewObserver, observers_, DidFailProvisionalLoad(frame, error)); | 3267 RenderViewObserver, observers_, DidFailProvisionalLoad(frame, error)); |
| 3474 } | 3268 } |
| 3475 | 3269 |
| 3476 void RenderViewImpl::didCommitProvisionalLoad(WebFrame* frame, | 3270 void RenderViewImpl::didCommitProvisionalLoad(WebFrame* frame, |
| 3477 bool is_new_navigation) { | 3271 bool is_new_navigation) { |
| 3478 DocumentState* document_state = | |
| 3479 DocumentState::FromDataSource(frame->dataSource()); | |
| 3480 NavigationState* navigation_state = document_state->navigation_state(); | |
| 3481 InternalDocumentStateData* internal_data = | |
| 3482 InternalDocumentStateData::FromDocumentState(document_state); | |
| 3483 | |
| 3484 if (document_state->commit_load_time().is_null()) | |
| 3485 document_state->set_commit_load_time(Time::Now()); | |
| 3486 | |
| 3487 if (internal_data->must_reset_scroll_and_scale_state()) { | |
| 3488 webview()->resetScrollAndScaleState(); | |
| 3489 internal_data->set_must_reset_scroll_and_scale_state(false); | |
| 3490 } | |
| 3491 internal_data->set_use_error_page(false); | |
| 3492 | |
| 3493 if (is_new_navigation) { | |
| 3494 // When we perform a new navigation, we need to update the last committed | |
| 3495 // session history entry with state for the page we are leaving. | |
| 3496 UpdateSessionHistory(frame); | |
| 3497 | |
| 3498 // We bump our Page ID to correspond with the new session history entry. | |
| 3499 page_id_ = next_page_id_++; | |
| 3500 | |
| 3501 // Don't update history_page_ids_ (etc) for kSwappedOutURL, since | |
| 3502 // we don't want to forget the entry that was there, and since we will | |
| 3503 // never come back to kSwappedOutURL. Note that we have to call | |
| 3504 // UpdateSessionHistory and update page_id_ even in this case, so that | |
| 3505 // the current entry gets a state update and so that we don't send a | |
| 3506 // state update to the wrong entry when we swap back in. | |
| 3507 if (GetLoadingUrl(frame) != GURL(kSwappedOutURL)) { | |
| 3508 // Advance our offset in session history, applying the length limit. | |
| 3509 // There is now no forward history. | |
| 3510 history_list_offset_++; | |
| 3511 if (history_list_offset_ >= kMaxSessionHistoryEntries) | |
| 3512 history_list_offset_ = kMaxSessionHistoryEntries - 1; | |
| 3513 history_list_length_ = history_list_offset_ + 1; | |
| 3514 history_page_ids_.resize(history_list_length_, -1); | |
| 3515 history_page_ids_[history_list_offset_] = page_id_; | |
| 3516 } | |
| 3517 } else { | |
| 3518 // Inspect the navigation_state on this frame to see if the navigation | |
| 3519 // corresponds to a session history navigation... Note: |frame| may or | |
| 3520 // may not be the toplevel frame, but for the case of capturing session | |
| 3521 // history, the first committed frame suffices. We keep track of whether | |
| 3522 // we've seen this commit before so that only capture session history once | |
| 3523 // per navigation. | |
| 3524 // | |
| 3525 // Note that we need to check if the page ID changed. In the case of a | |
| 3526 // reload, the page ID doesn't change, and UpdateSessionHistory gets the | |
| 3527 // previous URL and the current page ID, which would be wrong. | |
| 3528 if (navigation_state->pending_page_id() != -1 && | |
| 3529 navigation_state->pending_page_id() != page_id_ && | |
| 3530 !navigation_state->request_committed()) { | |
| 3531 // This is a successful session history navigation! | |
| 3532 UpdateSessionHistory(frame); | |
| 3533 page_id_ = navigation_state->pending_page_id(); | |
| 3534 | |
| 3535 history_list_offset_ = navigation_state->pending_history_list_offset(); | |
| 3536 | |
| 3537 // If the history list is valid, our list of page IDs should be correct. | |
| 3538 DCHECK(history_list_length_ <= 0 || | |
| 3539 history_list_offset_ < 0 || | |
| 3540 history_list_offset_ >= history_list_length_ || | |
| 3541 history_page_ids_[history_list_offset_] == page_id_); | |
| 3542 } | |
| 3543 } | |
| 3544 | |
| 3545 FOR_EACH_OBSERVER(RenderViewObserver, observers_, | 3272 FOR_EACH_OBSERVER(RenderViewObserver, observers_, |
| 3546 DidCommitProvisionalLoad(frame, is_new_navigation)); | 3273 DidCommitProvisionalLoad(frame, is_new_navigation)); |
| 3547 | 3274 |
| 3548 // Remember that we've already processed this request, so we don't update | 3275 // TODO(nasko): Transition this code to RenderFrameImpl. |
|
Charlie Reis
2014/02/05 23:30:37
Is anything blocking us from moving this code over
nasko
2014/02/06 01:55:13
The main thing is that I didn't want to add even m
| |
| 3549 // the session history again. We do this regardless of whether this is | |
| 3550 // a session history navigation, because if we attempted a session history | |
| 3551 // navigation without valid HistoryItem state, WebCore will think it is a | |
| 3552 // new navigation. | |
| 3553 navigation_state->set_request_committed(true); | |
| 3554 | |
| 3555 UpdateURL(frame); | |
| 3556 | |
| 3557 // Check whether we have new encoding name. | |
| 3558 UpdateEncoding(frame, frame->view()->pageEncoding().utf8()); | |
| 3559 | |
| 3560 if (!frame->parent()) { // Only for top frames. | 3276 if (!frame->parent()) { // Only for top frames. |
| 3561 RenderThreadImpl* render_thread_impl = RenderThreadImpl::current(); | 3277 RenderThreadImpl* render_thread_impl = RenderThreadImpl::current(); |
| 3562 if (render_thread_impl) { // Can be NULL in tests. | 3278 if (render_thread_impl) { // Can be NULL in tests. |
| 3563 render_thread_impl->histogram_customizer()-> | 3279 render_thread_impl->histogram_customizer()-> |
| 3564 RenderViewNavigatedToHost(GURL(GetLoadingUrl(frame)).host(), | 3280 RenderViewNavigatedToHost(GURL(GetLoadingUrl(frame)).host(), |
| 3565 g_view_map.Get().size()); | 3281 g_view_map.Get().size()); |
| 3566 } | 3282 } |
| 3567 } | 3283 } |
| 3568 } | 3284 } |
| 3569 | 3285 |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3684 if (rf && rf->is_swapped_out()) | 3400 if (rf && rf->is_swapped_out()) |
| 3685 return; | 3401 return; |
| 3686 | 3402 |
| 3687 Send(new ViewHostMsg_DidFinishLoad(routing_id_, | 3403 Send(new ViewHostMsg_DidFinishLoad(routing_id_, |
| 3688 frame->identifier(), | 3404 frame->identifier(), |
| 3689 ds->request().url(), | 3405 ds->request().url(), |
| 3690 !frame->parent())); | 3406 !frame->parent())); |
| 3691 } | 3407 } |
| 3692 | 3408 |
| 3693 void RenderViewImpl::didNavigateWithinPage( | 3409 void RenderViewImpl::didNavigateWithinPage( |
| 3694 WebFrame* frame, bool is_new_navigation) { | 3410 WebFrame* frame, |
| 3695 // If this was a reference fragment navigation that we initiated, then we | 3411 bool is_new_navigation) { |
| 3696 // could end up having a non-null pending navigation params. We just need to | 3412 // TODO(nasko): Forward calls to the main RenderFrameImpl until all |
| 3697 // update the ExtraData on the datasource so that others who read the | 3413 // callers of this method on RenderView are removed. |
| 3698 // ExtraData will get the new NavigationState. Similarly, if we did not | 3414 main_render_frame_->didNavigateWithinPage(frame, is_new_navigation); |
| 3699 // initiate this navigation, then we need to take care to reset any pre- | |
| 3700 // existing navigation state to a content-initiated navigation state. | |
| 3701 // DidCreateDataSource conveniently takes care of this for us. | |
| 3702 didCreateDataSource(frame, frame->dataSource()); | |
| 3703 | |
| 3704 DocumentState* document_state = | |
| 3705 DocumentState::FromDataSource(frame->dataSource()); | |
| 3706 NavigationState* new_state = document_state->navigation_state(); | |
| 3707 new_state->set_was_within_same_page(true); | |
| 3708 | |
| 3709 didCommitProvisionalLoad(frame, is_new_navigation); | |
| 3710 } | 3415 } |
| 3711 | 3416 |
| 3712 void RenderViewImpl::didUpdateCurrentHistoryItem(WebFrame* frame) { | 3417 void RenderViewImpl::didUpdateCurrentHistoryItem(WebFrame* frame) { |
| 3713 StartNavStateSyncTimerIfNecessary(); | 3418 StartNavStateSyncTimerIfNecessary(); |
| 3714 } | 3419 } |
| 3715 | 3420 |
| 3716 void RenderViewImpl::willSendRequest(WebFrame* frame, | 3421 void RenderViewImpl::willSendRequest(WebFrame* frame, |
| 3717 unsigned identifier, | 3422 unsigned identifier, |
| 3718 WebURLRequest& request, | 3423 WebURLRequest& request, |
| 3719 const WebURLResponse& redirect_response) { | 3424 const WebURLResponse& redirect_response) { |
| (...skipping 2378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6098 for (size_t i = 0; i < icon_urls.size(); i++) { | 5803 for (size_t i = 0; i < icon_urls.size(); i++) { |
| 6099 WebURL url = icon_urls[i].iconURL(); | 5804 WebURL url = icon_urls[i].iconURL(); |
| 6100 if (!url.isEmpty()) | 5805 if (!url.isEmpty()) |
| 6101 urls.push_back(FaviconURL(url, | 5806 urls.push_back(FaviconURL(url, |
| 6102 ToFaviconType(icon_urls[i].iconType()))); | 5807 ToFaviconType(icon_urls[i].iconType()))); |
| 6103 } | 5808 } |
| 6104 SendUpdateFaviconURL(urls); | 5809 SendUpdateFaviconURL(urls); |
| 6105 } | 5810 } |
| 6106 | 5811 |
| 6107 } // namespace content | 5812 } // namespace content |
| OLD | NEW |