| 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 926 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 937 webview()->settings()->setCompositedScrollingForFramesEnabled( | 937 webview()->settings()->setCompositedScrollingForFramesEnabled( |
| 938 ShouldUseCompositedScrollingForFrames(device_scale_factor_)); | 938 ShouldUseCompositedScrollingForFrames(device_scale_factor_)); |
| 939 | 939 |
| 940 ApplyWebPreferences(webkit_preferences_, webview()); | 940 ApplyWebPreferences(webkit_preferences_, webview()); |
| 941 | 941 |
| 942 main_render_frame_.reset( | 942 main_render_frame_.reset( |
| 943 RenderFrameImpl::Create(this, params->main_frame_routing_id)); | 943 RenderFrameImpl::Create(this, params->main_frame_routing_id)); |
| 944 // The main frame WebFrame object is closed by | 944 // The main frame WebFrame object is closed by |
| 945 // RenderFrameImpl::frameDetached(). | 945 // RenderFrameImpl::frameDetached(). |
| 946 webview()->setMainFrame(WebFrame::create(main_render_frame_.get())); | 946 webview()->setMainFrame(WebFrame::create(main_render_frame_.get())); |
| 947 main_render_frame_->MainWebFrameCreated(webview()->mainFrame()); | |
| 948 main_render_frame_->SetWebFrame(webview()->mainFrame()); | 947 main_render_frame_->SetWebFrame(webview()->mainFrame()); |
| 949 | 948 |
| 950 if (switches::IsTouchDragDropEnabled()) | 949 if (switches::IsTouchDragDropEnabled()) |
| 951 webview()->settings()->setTouchDragDropEnabled(true); | 950 webview()->settings()->setTouchDragDropEnabled(true); |
| 952 | 951 |
| 953 if (switches::IsTouchEditingEnabled()) | 952 if (switches::IsTouchEditingEnabled()) |
| 954 webview()->settings()->setTouchEditingEnabled(true); | 953 webview()->settings()->setTouchEditingEnabled(true); |
| 955 | 954 |
| 956 if (!params->frame_name.empty()) | 955 if (!params->frame_name.empty()) |
| 957 webview()->mainFrame()->setName(params->frame_name); | 956 webview()->mainFrame()->setName(params->frame_name); |
| (...skipping 1059 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2017 if (page_id_ > last_page_id_sent_to_browser_) | 2016 if (page_id_ > last_page_id_sent_to_browser_) |
| 2018 params.transition = PAGE_TRANSITION_MANUAL_SUBFRAME; | 2017 params.transition = PAGE_TRANSITION_MANUAL_SUBFRAME; |
| 2019 else | 2018 else |
| 2020 params.transition = PAGE_TRANSITION_AUTO_SUBFRAME; | 2019 params.transition = PAGE_TRANSITION_AUTO_SUBFRAME; |
| 2021 | 2020 |
| 2022 DCHECK(!navigation_state->history_list_was_cleared()); | 2021 DCHECK(!navigation_state->history_list_was_cleared()); |
| 2023 params.history_list_was_cleared = false; | 2022 params.history_list_was_cleared = false; |
| 2024 | 2023 |
| 2025 // Don't send this message while the subframe is swapped out. | 2024 // Don't send this message while the subframe is swapped out. |
| 2026 // TODO(creis): This whole method should move to RenderFrame. | 2025 // TODO(creis): This whole method should move to RenderFrame. |
| 2027 RenderFrameImpl* rf = RenderFrameImpl::FindByWebFrame(frame); | 2026 RenderFrameImpl* rf = RenderFrameImpl::FromWebFrame(frame); |
| 2028 if (!rf || !rf->is_swapped_out()) | 2027 if (!rf || !rf->is_swapped_out()) |
| 2029 Send(new ViewHostMsg_FrameNavigate(routing_id_, params)); | 2028 Send(new ViewHostMsg_FrameNavigate(routing_id_, params)); |
| 2030 } | 2029 } |
| 2031 | 2030 |
| 2032 last_page_id_sent_to_browser_ = | 2031 last_page_id_sent_to_browser_ = |
| 2033 std::max(last_page_id_sent_to_browser_, page_id_); | 2032 std::max(last_page_id_sent_to_browser_, page_id_); |
| 2034 | 2033 |
| 2035 // If we end up reusing this WebRequest (for example, due to a #ref click), | 2034 // If we end up reusing this WebRequest (for example, due to a #ref click), |
| 2036 // we don't want the transition type to persist. Just clear it. | 2035 // we don't want the transition type to persist. Just clear it. |
| 2037 navigation_state->set_transition_type(PAGE_TRANSITION_LINK); | 2036 navigation_state->set_transition_type(PAGE_TRANSITION_LINK); |
| (...skipping 1702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3740 TRACE_EVENT_INSTANT0("WebCore", "LoadFinished", | 3739 TRACE_EVENT_INSTANT0("WebCore", "LoadFinished", |
| 3741 TRACE_EVENT_SCOPE_PROCESS); | 3740 TRACE_EVENT_SCOPE_PROCESS); |
| 3742 } | 3741 } |
| 3743 document_state->set_finish_load_time(Time::Now()); | 3742 document_state->set_finish_load_time(Time::Now()); |
| 3744 } | 3743 } |
| 3745 | 3744 |
| 3746 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidFinishLoad(frame)); | 3745 FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidFinishLoad(frame)); |
| 3747 | 3746 |
| 3748 // Don't send this message while the subframe is swapped out. | 3747 // Don't send this message while the subframe is swapped out. |
| 3749 // TODO(creis): This whole method should move to RenderFrame. | 3748 // TODO(creis): This whole method should move to RenderFrame. |
| 3750 RenderFrameImpl* rf = RenderFrameImpl::FindByWebFrame(frame); | 3749 RenderFrameImpl* rf = RenderFrameImpl::FromWebFrame(frame); |
| 3751 if (rf && rf->is_swapped_out()) | 3750 if (rf && rf->is_swapped_out()) |
| 3752 return; | 3751 return; |
| 3753 | 3752 |
| 3754 Send(new ViewHostMsg_DidFinishLoad(routing_id_, | 3753 Send(new ViewHostMsg_DidFinishLoad(routing_id_, |
| 3755 frame->identifier(), | 3754 frame->identifier(), |
| 3756 ds->request().url(), | 3755 ds->request().url(), |
| 3757 !frame->parent())); | 3756 !frame->parent())); |
| 3758 } | 3757 } |
| 3759 | 3758 |
| 3760 void RenderViewImpl::didNavigateWithinPage( | 3759 void RenderViewImpl::didNavigateWithinPage( |
| (...skipping 1350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5111 Send(new ViewHostMsg_SwapOut_ACK(routing_id_)); | 5110 Send(new ViewHostMsg_SwapOut_ACK(routing_id_)); |
| 5112 } | 5111 } |
| 5113 | 5112 |
| 5114 void RenderViewImpl::NavigateToSwappedOutURL(blink::WebFrame* frame) { | 5113 void RenderViewImpl::NavigateToSwappedOutURL(blink::WebFrame* frame) { |
| 5115 // We use loadRequest instead of loadHTMLString because the former commits | 5114 // We use loadRequest instead of loadHTMLString because the former commits |
| 5116 // synchronously. Otherwise a new navigation can interrupt the navigation | 5115 // synchronously. Otherwise a new navigation can interrupt the navigation |
| 5117 // to kSwappedOutURL. If that happens to be to the page we had been | 5116 // to kSwappedOutURL. If that happens to be to the page we had been |
| 5118 // showing, then WebKit will never send a commit and we'll be left spinning. | 5117 // showing, then WebKit will never send a commit and we'll be left spinning. |
| 5119 // TODO(creis): Until we move this to RenderFrame, we may call this from a | 5118 // TODO(creis): Until we move this to RenderFrame, we may call this from a |
| 5120 // swapped out RenderFrame while our own is_swapped_out_ is false. | 5119 // swapped out RenderFrame while our own is_swapped_out_ is false. |
| 5121 RenderFrameImpl* rf = RenderFrameImpl::FindByWebFrame(frame); | 5120 RenderFrameImpl* rf = RenderFrameImpl::FromWebFrame(frame); |
| 5122 CHECK(is_swapped_out_ || rf->is_swapped_out()); | 5121 CHECK(is_swapped_out_ || rf->is_swapped_out()); |
| 5123 GURL swappedOutURL(kSwappedOutURL); | 5122 GURL swappedOutURL(kSwappedOutURL); |
| 5124 WebURLRequest request(swappedOutURL); | 5123 WebURLRequest request(swappedOutURL); |
| 5125 frame->loadRequest(request); | 5124 frame->loadRequest(request); |
| 5126 } | 5125 } |
| 5127 | 5126 |
| 5128 void RenderViewImpl::OnClosePage() { | 5127 void RenderViewImpl::OnClosePage() { |
| 5129 FOR_EACH_OBSERVER(RenderViewObserver, observers_, ClosePage()); | 5128 FOR_EACH_OBSERVER(RenderViewObserver, observers_, ClosePage()); |
| 5130 // TODO(creis): We'd rather use webview()->Close() here, but that currently | 5129 // TODO(creis): We'd rather use webview()->Close() here, but that currently |
| 5131 // sets the WebView's delegate_ to NULL, preventing any JavaScript dialogs | 5130 // sets the WebView's delegate_ to NULL, preventing any JavaScript dialogs |
| (...skipping 1132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6264 for (size_t i = 0; i < icon_urls.size(); i++) { | 6263 for (size_t i = 0; i < icon_urls.size(); i++) { |
| 6265 WebURL url = icon_urls[i].iconURL(); | 6264 WebURL url = icon_urls[i].iconURL(); |
| 6266 if (!url.isEmpty()) | 6265 if (!url.isEmpty()) |
| 6267 urls.push_back(FaviconURL(url, | 6266 urls.push_back(FaviconURL(url, |
| 6268 ToFaviconType(icon_urls[i].iconType()))); | 6267 ToFaviconType(icon_urls[i].iconType()))); |
| 6269 } | 6268 } |
| 6270 SendUpdateFaviconURL(urls); | 6269 SendUpdateFaviconURL(urls); |
| 6271 } | 6270 } |
| 6272 | 6271 |
| 6273 } // namespace content | 6272 } // namespace content |
| OLD | NEW |