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 "third_party/libaddressinput/chromium/chrome_metadata_source.h" | 5 #include "third_party/libaddressinput/chromium/chrome_metadata_source.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "net/base/io_buffer.h" | 9 #include "net/base/io_buffer.h" |
10 #include "net/base/load_flags.h" | 10 #include "net/base/load_flags.h" |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 callback(callback) {} | 86 callback(callback) {} |
87 | 87 |
88 void ChromeMetadataSource::Download(const std::string& key, | 88 void ChromeMetadataSource::Download(const std::string& key, |
89 const Callback& downloaded) { | 89 const Callback& downloaded) { |
90 GURL resource(validation_data_url_ + key); | 90 GURL resource(validation_data_url_ + key); |
91 if (!resource.SchemeIsSecure()) { | 91 if (!resource.SchemeIsSecure()) { |
92 downloaded(false, key, NULL); | 92 downloaded(false, key, NULL); |
93 return; | 93 return; |
94 } | 94 } |
95 | 95 |
96 scoped_ptr<net::URLFetcher> fetcher( | 96 scoped_ptr<net::URLFetcher> fetcher = |
97 net::URLFetcher::Create(resource, net::URLFetcher::GET, this)); | 97 net::URLFetcher::Create(resource, net::URLFetcher::GET, this); |
98 fetcher->SetLoadFlags( | 98 fetcher->SetLoadFlags( |
99 net::LOAD_DO_NOT_SEND_COOKIES | net::LOAD_DO_NOT_SAVE_COOKIES); | 99 net::LOAD_DO_NOT_SEND_COOKIES | net::LOAD_DO_NOT_SAVE_COOKIES); |
100 fetcher->SetRequestContext(getter_); | 100 fetcher->SetRequestContext(getter_); |
101 | 101 |
102 Request* request = new Request(key, fetcher.Pass(), downloaded); | 102 Request* request = new Request(key, fetcher.Pass(), downloaded); |
103 request->fetcher->SaveResponseWithWriter( | 103 request->fetcher->SaveResponseWithWriter( |
104 scoped_ptr<net::URLFetcherResponseWriter>( | 104 scoped_ptr<net::URLFetcherResponseWriter>( |
105 new UnownedStringWriter(&request->data))); | 105 new UnownedStringWriter(&request->data))); |
106 requests_[request->fetcher.get()] = request; | 106 requests_[request->fetcher.get()] = request; |
107 request->fetcher->Start(); | 107 request->fetcher->Start(); |
108 } | 108 } |
109 | 109 |
110 } // namespace autofill | 110 } // namespace autofill |
OLD | NEW |