| 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 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 if (data_source) { | 354 if (data_source) { |
| 355 DocumentState* document_state = DocumentState::FromDataSource(data_source); | 355 DocumentState* document_state = DocumentState::FromDataSource(data_source); |
| 356 if (document_state) | 356 if (document_state) |
| 357 document_state->set_alt_error_page_fetcher(NULL); | 357 document_state->set_alt_error_page_fetcher(NULL); |
| 358 } | 358 } |
| 359 } | 359 } |
| 360 | 360 |
| 361 static bool IsReload(const ViewMsg_Navigate_Params& params) { | 361 static bool IsReload(const ViewMsg_Navigate_Params& params) { |
| 362 return | 362 return |
| 363 params.navigation_type == ViewMsg_Navigate_Type::RELOAD || | 363 params.navigation_type == ViewMsg_Navigate_Type::RELOAD || |
| 364 params.navigation_type == ViewMsg_Navigate_Type::RELOAD_IGNORING_CACHE; | 364 params.navigation_type == ViewMsg_Navigate_Type::RELOAD_IGNORING_CACHE || |
| 365 params.navigation_type == |
| 366 ViewMsg_Navigate_Type::RELOAD_ORIGINAL_REQUEST_URL; |
| 365 } | 367 } |
| 366 | 368 |
| 367 static WebReferrerPolicy GetReferrerPolicyFromRequest( | 369 static WebReferrerPolicy GetReferrerPolicyFromRequest( |
| 368 WebFrame* frame, | 370 WebFrame* frame, |
| 369 const WebURLRequest& request) { | 371 const WebURLRequest& request) { |
| 370 return request.extraData() ? | 372 return request.extraData() ? |
| 371 static_cast<RequestExtraData*>(request.extraData())->referrer_policy() : | 373 static_cast<RequestExtraData*>(request.extraData())->referrer_policy() : |
| 372 frame->document().referrerPolicy(); | 374 frame->document().referrerPolicy(); |
| 373 } | 375 } |
| 374 | 376 |
| (...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1033 } | 1035 } |
| 1034 | 1036 |
| 1035 pending_navigation_params_.reset(new ViewMsg_Navigate_Params); | 1037 pending_navigation_params_.reset(new ViewMsg_Navigate_Params); |
| 1036 *pending_navigation_params_.get() = params; | 1038 *pending_navigation_params_.get() = params; |
| 1037 | 1039 |
| 1038 // If we are reloading, then WebKit will use the history state of the current | 1040 // If we are reloading, then WebKit will use the history state of the current |
| 1039 // page, so we should just ignore any given history state. Otherwise, if we | 1041 // page, so we should just ignore any given history state. Otherwise, if we |
| 1040 // have history state, then we need to navigate to it, which corresponds to a | 1042 // have history state, then we need to navigate to it, which corresponds to a |
| 1041 // back/forward navigation event. | 1043 // back/forward navigation event. |
| 1042 if (is_reload) { | 1044 if (is_reload) { |
| 1045 bool reload_original_url = |
| 1046 (params.navigation_type == |
| 1047 ViewMsg_Navigate_Type::RELOAD_ORIGINAL_REQUEST_URL); |
| 1043 bool ignore_cache = (params.navigation_type == | 1048 bool ignore_cache = (params.navigation_type == |
| 1044 ViewMsg_Navigate_Type::RELOAD_IGNORING_CACHE); | 1049 ViewMsg_Navigate_Type::RELOAD_IGNORING_CACHE); |
| 1045 main_frame->reload(ignore_cache); | 1050 |
| 1051 if (reload_original_url) |
| 1052 main_frame->reloadWithOverrideURL(params.url, true); |
| 1053 else |
| 1054 main_frame->reload(ignore_cache); |
| 1046 } else if (!params.state.empty()) { | 1055 } else if (!params.state.empty()) { |
| 1047 // We must know the page ID of the page we are navigating back to. | 1056 // We must know the page ID of the page we are navigating back to. |
| 1048 DCHECK_NE(params.page_id, -1); | 1057 DCHECK_NE(params.page_id, -1); |
| 1049 main_frame->loadHistoryItem( | 1058 main_frame->loadHistoryItem( |
| 1050 webkit_glue::HistoryItemFromString(params.state)); | 1059 webkit_glue::HistoryItemFromString(params.state)); |
| 1051 } else if (!params.base_url_for_data_url.is_empty()) { | 1060 } else if (!params.base_url_for_data_url.is_empty()) { |
| 1052 // A loadData request with a specified base URL. | 1061 // A loadData request with a specified base URL. |
| 1053 std::string mime_type, charset, data; | 1062 std::string mime_type, charset, data; |
| 1054 if (net::DataURL::Parse(params.url, &mime_type, &charset, &data)) { | 1063 if (net::DataURL::Parse(params.url, &mime_type, &charset, &data)) { |
| 1055 main_frame->loadData( | 1064 main_frame->loadData( |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1471 string16 method = request.httpMethod(); | 1480 string16 method = request.httpMethod(); |
| 1472 if (EqualsASCII(method, "POST")) { | 1481 if (EqualsASCII(method, "POST")) { |
| 1473 params.is_post = true; | 1482 params.is_post = true; |
| 1474 params.post_id = ExtractPostId(item); | 1483 params.post_id = ExtractPostId(item); |
| 1475 } | 1484 } |
| 1476 | 1485 |
| 1477 // Send the user agent override back. | 1486 // Send the user agent override back. |
| 1478 params.is_overriding_user_agent = | 1487 params.is_overriding_user_agent = |
| 1479 document_state->is_overriding_user_agent(); | 1488 document_state->is_overriding_user_agent(); |
| 1480 | 1489 |
| 1490 // Track the URL of the original request. |
| 1491 params.original_request_url = original_request.url(); |
| 1492 |
| 1481 // Save some histogram data so we can compute the average memory used per | 1493 // Save some histogram data so we can compute the average memory used per |
| 1482 // page load of the glyphs. | 1494 // page load of the glyphs. |
| 1483 UMA_HISTOGRAM_COUNTS_10000("Memory.GlyphPagesPerLoad", | 1495 UMA_HISTOGRAM_COUNTS_10000("Memory.GlyphPagesPerLoad", |
| 1484 webkit_glue::GetGlyphPageCount()); | 1496 webkit_glue::GetGlyphPageCount()); |
| 1485 | 1497 |
| 1486 // This message needs to be sent before any of allowScripts(), | 1498 // This message needs to be sent before any of allowScripts(), |
| 1487 // allowImages(), allowPlugins() is called for the new page, so that when | 1499 // allowImages(), allowPlugins() is called for the new page, so that when |
| 1488 // these functions send a ViewHostMsg_ContentBlocked message, it arrives | 1500 // these functions send a ViewHostMsg_ContentBlocked message, it arrives |
| 1489 // after the ViewHostMsg_FrameNavigate message. | 1501 // after the ViewHostMsg_FrameNavigate message. |
| 1490 Send(new ViewHostMsg_FrameNavigate(routing_id_, params)); | 1502 Send(new ViewHostMsg_FrameNavigate(routing_id_, params)); |
| (...skipping 4264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5755 bool RenderViewImpl::WebWidgetHandlesCompositorScheduling() const { | 5767 bool RenderViewImpl::WebWidgetHandlesCompositorScheduling() const { |
| 5756 return !!RenderThreadImpl::current()->compositor_thread(); | 5768 return !!RenderThreadImpl::current()->compositor_thread(); |
| 5757 } | 5769 } |
| 5758 | 5770 |
| 5759 void RenderViewImpl::OnJavaBridgeInit() { | 5771 void RenderViewImpl::OnJavaBridgeInit() { |
| 5760 DCHECK(!java_bridge_dispatcher_); | 5772 DCHECK(!java_bridge_dispatcher_); |
| 5761 #if defined(ENABLE_JAVA_BRIDGE) | 5773 #if defined(ENABLE_JAVA_BRIDGE) |
| 5762 java_bridge_dispatcher_ = new JavaBridgeDispatcher(this); | 5774 java_bridge_dispatcher_ = new JavaBridgeDispatcher(this); |
| 5763 #endif | 5775 #endif |
| 5764 } | 5776 } |
| OLD | NEW |