| 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 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 if (data_source) { | 349 if (data_source) { |
| 350 DocumentState* document_state = DocumentState::FromDataSource(data_source); | 350 DocumentState* document_state = DocumentState::FromDataSource(data_source); |
| 351 if (document_state) | 351 if (document_state) |
| 352 document_state->set_alt_error_page_fetcher(NULL); | 352 document_state->set_alt_error_page_fetcher(NULL); |
| 353 } | 353 } |
| 354 } | 354 } |
| 355 | 355 |
| 356 static bool IsReload(const ViewMsg_Navigate_Params& params) { | 356 static bool IsReload(const ViewMsg_Navigate_Params& params) { |
| 357 return | 357 return |
| 358 params.navigation_type == ViewMsg_Navigate_Type::RELOAD || | 358 params.navigation_type == ViewMsg_Navigate_Type::RELOAD || |
| 359 params.navigation_type == ViewMsg_Navigate_Type::RELOAD_IGNORING_CACHE; | 359 params.navigation_type == ViewMsg_Navigate_Type::RELOAD_IGNORING_CACHE || |
| 360 params.navigation_type == |
| 361 ViewMsg_Navigate_Type::RELOAD_ORIGINAL_REQUEST_URL; |
| 360 } | 362 } |
| 361 | 363 |
| 362 static WebReferrerPolicy GetReferrerPolicyFromRequest( | 364 static WebReferrerPolicy GetReferrerPolicyFromRequest( |
| 363 WebFrame* frame, | 365 WebFrame* frame, |
| 364 const WebURLRequest& request) { | 366 const WebURLRequest& request) { |
| 365 return request.extraData() ? | 367 return request.extraData() ? |
| 366 static_cast<RequestExtraData*>(request.extraData())->referrer_policy() : | 368 static_cast<RequestExtraData*>(request.extraData())->referrer_policy() : |
| 367 frame->document().referrerPolicy(); | 369 frame->document().referrerPolicy(); |
| 368 } | 370 } |
| 369 | 371 |
| (...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1036 } | 1038 } |
| 1037 | 1039 |
| 1038 pending_navigation_params_.reset(new ViewMsg_Navigate_Params); | 1040 pending_navigation_params_.reset(new ViewMsg_Navigate_Params); |
| 1039 *pending_navigation_params_.get() = params; | 1041 *pending_navigation_params_.get() = params; |
| 1040 | 1042 |
| 1041 // If we are reloading, then WebKit will use the history state of the current | 1043 // If we are reloading, then WebKit will use the history state of the current |
| 1042 // page, so we should just ignore any given history state. Otherwise, if we | 1044 // page, so we should just ignore any given history state. Otherwise, if we |
| 1043 // have history state, then we need to navigate to it, which corresponds to a | 1045 // have history state, then we need to navigate to it, which corresponds to a |
| 1044 // back/forward navigation event. | 1046 // back/forward navigation event. |
| 1045 if (is_reload) { | 1047 if (is_reload) { |
| 1048 bool reload_original_url = |
| 1049 (params.navigation_type == |
| 1050 ViewMsg_Navigate_Type::RELOAD_ORIGINAL_REQUEST_URL); |
| 1046 bool ignore_cache = (params.navigation_type == | 1051 bool ignore_cache = (params.navigation_type == |
| 1047 ViewMsg_Navigate_Type::RELOAD_IGNORING_CACHE); | 1052 ViewMsg_Navigate_Type::RELOAD_IGNORING_CACHE); |
| 1048 main_frame->reload(ignore_cache); | 1053 |
| 1054 if (reload_original_url) |
| 1055 main_frame->reloadWithOverrideURL(params.url, true); |
| 1056 else |
| 1057 main_frame->reload(ignore_cache); |
| 1049 } else if (!params.state.empty()) { | 1058 } else if (!params.state.empty()) { |
| 1050 // We must know the page ID of the page we are navigating back to. | 1059 // We must know the page ID of the page we are navigating back to. |
| 1051 DCHECK_NE(params.page_id, -1); | 1060 DCHECK_NE(params.page_id, -1); |
| 1052 main_frame->loadHistoryItem( | 1061 main_frame->loadHistoryItem( |
| 1053 webkit_glue::HistoryItemFromString(params.state)); | 1062 webkit_glue::HistoryItemFromString(params.state)); |
| 1054 } else { | 1063 } else { |
| 1055 // Navigate to the given URL. | 1064 // Navigate to the given URL. |
| 1056 WebURLRequest request(params.url); | 1065 WebURLRequest request(params.url); |
| 1057 | 1066 |
| 1058 // A session history navigation should have been accompanied by state. | 1067 // A session history navigation should have been accompanied by state. |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1445 string16 method = request.httpMethod(); | 1454 string16 method = request.httpMethod(); |
| 1446 if (EqualsASCII(method, "POST")) { | 1455 if (EqualsASCII(method, "POST")) { |
| 1447 params.is_post = true; | 1456 params.is_post = true; |
| 1448 params.post_id = ExtractPostId(item); | 1457 params.post_id = ExtractPostId(item); |
| 1449 } | 1458 } |
| 1450 | 1459 |
| 1451 // Send the user agent override back. | 1460 // Send the user agent override back. |
| 1452 params.is_overriding_user_agent = | 1461 params.is_overriding_user_agent = |
| 1453 document_state->is_overriding_user_agent(); | 1462 document_state->is_overriding_user_agent(); |
| 1454 | 1463 |
| 1464 // Track the URL of the original request. |
| 1465 params.original_request_url = original_request.url(); |
| 1466 |
| 1455 // Save some histogram data so we can compute the average memory used per | 1467 // Save some histogram data so we can compute the average memory used per |
| 1456 // page load of the glyphs. | 1468 // page load of the glyphs. |
| 1457 UMA_HISTOGRAM_COUNTS_10000("Memory.GlyphPagesPerLoad", | 1469 UMA_HISTOGRAM_COUNTS_10000("Memory.GlyphPagesPerLoad", |
| 1458 webkit_glue::GetGlyphPageCount()); | 1470 webkit_glue::GetGlyphPageCount()); |
| 1459 | 1471 |
| 1460 // This message needs to be sent before any of allowScripts(), | 1472 // This message needs to be sent before any of allowScripts(), |
| 1461 // allowImages(), allowPlugins() is called for the new page, so that when | 1473 // allowImages(), allowPlugins() is called for the new page, so that when |
| 1462 // these functions send a ViewHostMsg_ContentBlocked message, it arrives | 1474 // these functions send a ViewHostMsg_ContentBlocked message, it arrives |
| 1463 // after the ViewHostMsg_FrameNavigate message. | 1475 // after the ViewHostMsg_FrameNavigate message. |
| 1464 Send(new ViewHostMsg_FrameNavigate(routing_id_, params)); | 1476 Send(new ViewHostMsg_FrameNavigate(routing_id_, params)); |
| (...skipping 4205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5670 bool RenderViewImpl::WebWidgetHandlesCompositorScheduling() const { | 5682 bool RenderViewImpl::WebWidgetHandlesCompositorScheduling() const { |
| 5671 return !!RenderThreadImpl::current()->compositor_thread(); | 5683 return !!RenderThreadImpl::current()->compositor_thread(); |
| 5672 } | 5684 } |
| 5673 | 5685 |
| 5674 void RenderViewImpl::OnJavaBridgeInit() { | 5686 void RenderViewImpl::OnJavaBridgeInit() { |
| 5675 DCHECK(!java_bridge_dispatcher_); | 5687 DCHECK(!java_bridge_dispatcher_); |
| 5676 #if defined(ENABLE_JAVA_BRIDGE) | 5688 #if defined(ENABLE_JAVA_BRIDGE) |
| 5677 java_bridge_dispatcher_ = new JavaBridgeDispatcher(this); | 5689 java_bridge_dispatcher_ = new JavaBridgeDispatcher(this); |
| 5678 #endif | 5690 #endif |
| 5679 } | 5691 } |
| OLD | NEW |