| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/browser/frame_host/navigation_request.h" | 5 #include "content/browser/frame_host/navigation_request.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "content/browser/appcache/appcache_navigation_handle.h" | 10 #include "content/browser/appcache/appcache_navigation_handle.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 | 51 |
| 52 // Returns the net load flags to use based on the navigation type. | 52 // Returns the net load flags to use based on the navigation type. |
| 53 // TODO(clamy): Remove the blink code that sets the caching flags when | 53 // TODO(clamy): Remove the blink code that sets the caching flags when |
| 54 // PlzNavigate launches. | 54 // PlzNavigate launches. |
| 55 void UpdateLoadFlagsWithCacheFlags( | 55 void UpdateLoadFlagsWithCacheFlags( |
| 56 int* load_flags, | 56 int* load_flags, |
| 57 FrameMsg_Navigate_Type::Value navigation_type, | 57 FrameMsg_Navigate_Type::Value navigation_type, |
| 58 bool is_post) { | 58 bool is_post) { |
| 59 switch (navigation_type) { | 59 switch (navigation_type) { |
| 60 case FrameMsg_Navigate_Type::RELOAD: | 60 case FrameMsg_Navigate_Type::RELOAD: |
| 61 case FrameMsg_Navigate_Type::RELOAD_MAIN_RESOURCE: | |
| 62 case FrameMsg_Navigate_Type::RELOAD_ORIGINAL_REQUEST_URL: | 61 case FrameMsg_Navigate_Type::RELOAD_ORIGINAL_REQUEST_URL: |
| 63 *load_flags |= net::LOAD_VALIDATE_CACHE; | 62 *load_flags |= net::LOAD_VALIDATE_CACHE; |
| 64 break; | 63 break; |
| 65 case FrameMsg_Navigate_Type::RELOAD_BYPASSING_CACHE: | 64 case FrameMsg_Navigate_Type::RELOAD_BYPASSING_CACHE: |
| 66 *load_flags |= net::LOAD_BYPASS_CACHE; | 65 *load_flags |= net::LOAD_BYPASS_CACHE; |
| 67 break; | 66 break; |
| 68 case FrameMsg_Navigate_Type::RESTORE: | 67 case FrameMsg_Navigate_Type::RESTORE: |
| 69 *load_flags |= net::LOAD_SKIP_CACHE_VALIDATION; | 68 *load_flags |= net::LOAD_SKIP_CACHE_VALIDATION; |
| 70 break; | 69 break; |
| 71 case FrameMsg_Navigate_Type::RESTORE_WITH_POST: | 70 case FrameMsg_Navigate_Type::RESTORE_WITH_POST: |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 const GURL& url, | 138 const GURL& url, |
| 140 FrameMsg_Navigate_Type::Value navigation_type, | 139 FrameMsg_Navigate_Type::Value navigation_type, |
| 141 BrowserContext* browser_context, | 140 BrowserContext* browser_context, |
| 142 const std::string& method, | 141 const std::string& method, |
| 143 FrameTreeNode* frame_tree_node) { | 142 FrameTreeNode* frame_tree_node) { |
| 144 if (!url.SchemeIsHTTPOrHTTPS()) | 143 if (!url.SchemeIsHTTPOrHTTPS()) |
| 145 return; | 144 return; |
| 146 | 145 |
| 147 bool is_reload = | 146 bool is_reload = |
| 148 navigation_type == FrameMsg_Navigate_Type::RELOAD || | 147 navigation_type == FrameMsg_Navigate_Type::RELOAD || |
| 149 navigation_type == FrameMsg_Navigate_Type::RELOAD_MAIN_RESOURCE || | |
| 150 navigation_type == FrameMsg_Navigate_Type::RELOAD_BYPASSING_CACHE || | 148 navigation_type == FrameMsg_Navigate_Type::RELOAD_BYPASSING_CACHE || |
| 151 navigation_type == FrameMsg_Navigate_Type::RELOAD_ORIGINAL_REQUEST_URL; | 149 navigation_type == FrameMsg_Navigate_Type::RELOAD_ORIGINAL_REQUEST_URL; |
| 152 if (is_reload) | 150 if (is_reload) |
| 153 headers->RemoveHeader("Save-Data"); | 151 headers->RemoveHeader("Save-Data"); |
| 154 | 152 |
| 155 if (GetContentClient()->browser()->IsDataSaverEnabled(browser_context)) | 153 if (GetContentClient()->browser()->IsDataSaverEnabled(browser_context)) |
| 156 headers->SetHeaderIfMissing("Save-Data", "on"); | 154 headers->SetHeaderIfMissing("Save-Data", "on"); |
| 157 | 155 |
| 158 headers->SetHeaderIfMissing(net::HttpRequestHeaders::kUserAgent, | 156 headers->SetHeaderIfMissing(net::HttpRequestHeaders::kUserAgent, |
| 159 GetContentClient()->GetUserAgent()); | 157 GetContentClient()->GetUserAgent()); |
| (...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 714 DCHECK_EQ(request_params_.has_user_gesture, begin_params_.has_user_gesture); | 712 DCHECK_EQ(request_params_.has_user_gesture, begin_params_.has_user_gesture); |
| 715 | 713 |
| 716 render_frame_host->CommitNavigation(response_.get(), std::move(body_), | 714 render_frame_host->CommitNavigation(response_.get(), std::move(body_), |
| 717 common_params_, request_params_, | 715 common_params_, request_params_, |
| 718 is_view_source_); | 716 is_view_source_); |
| 719 | 717 |
| 720 frame_tree_node_->ResetNavigationRequest(true); | 718 frame_tree_node_->ResetNavigationRequest(true); |
| 721 } | 719 } |
| 722 | 720 |
| 723 } // namespace content | 721 } // namespace content |
| OLD | NEW |