Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(80)

Side by Side Diff: content/browser/background_fetch/background_fetch_request_info.cc

Issue 2818703003: Consider the Access-Control-Allow-Origin header for Background Fetch (Closed)
Patch Set: Consider the Access-Control-Allow-Origin header for Background Fetch Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/browser/background_fetch/background_fetch_request_info.h ('k') | content/test/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/background_fetch/background_fetch_request_info.h" 5 #include "content/browser/background_fetch/background_fetch_request_info.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/strings/string_util.h"
9 #include "content/public/browser/download_item.h" 10 #include "content/public/browser/download_item.h"
10 #include "net/http/http_response_headers.h" 11 #include "net/http/http_response_headers.h"
11 12
12 namespace content { 13 namespace content {
13 14
14 BackgroundFetchRequestInfo::BackgroundFetchRequestInfo( 15 BackgroundFetchRequestInfo::BackgroundFetchRequestInfo(
15 int request_index, 16 int request_index,
16 const ServiceWorkerFetchRequest& fetch_request) 17 const ServiceWorkerFetchRequest& fetch_request)
17 : request_index_(request_index), fetch_request_(fetch_request) {} 18 : request_index_(request_index), fetch_request_(fetch_request) {}
18 19
(...skipping 12 matching lines...) Expand all
31 if (download_item->GetResponseHeaders()) { 32 if (download_item->GetResponseHeaders()) {
32 const auto& headers = download_item->GetResponseHeaders(); 33 const auto& headers = download_item->GetResponseHeaders();
33 34
34 response_code_ = headers->response_code(); 35 response_code_ = headers->response_code();
35 response_text_ = headers->GetStatusText(); 36 response_text_ = headers->GetStatusText();
36 37
37 size_t iter = 0; 38 size_t iter = 0;
38 std::string name, value; 39 std::string name, value;
39 40
40 while (headers->EnumerateHeaderLines(&iter, &name, &value)) 41 while (headers->EnumerateHeaderLines(&iter, &name, &value))
41 response_headers_[name] = value; 42 response_headers_[base::ToLowerASCII(name)] = value;
42 } 43 }
43 44
44 download_state_populated_ = true; 45 download_state_populated_ = true;
45 } 46 }
46 47
47 void BackgroundFetchRequestInfo::PopulateResponseFromDownloadItem( 48 void BackgroundFetchRequestInfo::PopulateResponseFromDownloadItem(
48 DownloadItem* download_item) { 49 DownloadItem* download_item) {
49 DCHECK(!response_data_populated_); 50 DCHECK(!response_data_populated_);
50 51
51 url_chain_ = download_item->GetUrlChain(); 52 url_chain_ = download_item->GetUrlChain();
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 DCHECK(response_data_populated_); 87 DCHECK(response_data_populated_);
87 return file_size_; 88 return file_size_;
88 } 89 }
89 90
90 const base::Time& BackgroundFetchRequestInfo::GetResponseTime() const { 91 const base::Time& BackgroundFetchRequestInfo::GetResponseTime() const {
91 DCHECK(response_data_populated_); 92 DCHECK(response_data_populated_);
92 return response_time_; 93 return response_time_;
93 } 94 }
94 95
95 } // namespace content 96 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/background_fetch/background_fetch_request_info.h ('k') | content/test/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698