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 "chrome/browser/chromeos/gdata/gdata_operations.h" | 5 #include "chrome/browser/chromeos/gdata/gdata_operations.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
11 #include "base/values.h" | 11 #include "base/values.h" |
12 #include "chrome/browser/browser_process.h" | 12 #include "chrome/browser/browser_process.h" |
13 #include "chrome/browser/chromeos/gdata/gdata_file_system.h" | 13 #include "chrome/browser/chromeos/gdata/gdata_file_system.h" |
14 #include "chrome/browser/chromeos/gdata/gdata_util.h" | 14 #include "chrome/browser/chromeos/gdata/gdata_util.h" |
15 #include "chrome/common/net/gaia/gaia_urls.h" | 15 #include "chrome/common/net/gaia/gaia_urls.h" |
16 #include "chrome/common/net/gaia/google_service_auth_error.h" | 16 #include "chrome/common/net/gaia/google_service_auth_error.h" |
17 #include "chrome/common/net/url_util.h" | 17 #include "chrome/common/net/url_util.h" |
18 #include "content/public/common/url_fetcher.h" | |
19 #include "net/base/escape.h" | 18 #include "net/base/escape.h" |
20 #include "net/http/http_util.h" | 19 #include "net/http/http_util.h" |
| 20 #include "net/url_request/url_fetcher.h" |
21 #include "net/url_request/url_request_status.h" | 21 #include "net/url_request/url_request_status.h" |
22 #include "third_party/libxml/chromium/libxml_utils.h" | 22 #include "third_party/libxml/chromium/libxml_utils.h" |
23 | 23 |
24 using content::BrowserThread; | 24 using content::BrowserThread; |
25 using net::URLFetcher; | 25 using net::URLFetcher; |
26 | 26 |
27 namespace { | 27 namespace { |
28 | 28 |
29 // Used for success ratio histograms. 0 for failure, 1 for success, | 29 // Used for success ratio histograms. 0 for failure, 1 for success, |
30 // 2 for no connection (likely offline). | 30 // 2 for no connection (likely offline). |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 UrlFetchOperationBase::~UrlFetchOperationBase() {} | 260 UrlFetchOperationBase::~UrlFetchOperationBase() {} |
261 | 261 |
262 void UrlFetchOperationBase::Start(const std::string& auth_token) { | 262 void UrlFetchOperationBase::Start(const std::string& auth_token) { |
263 DCHECK(!auth_token.empty()); | 263 DCHECK(!auth_token.empty()); |
264 | 264 |
265 GURL url = GetURL(); | 265 GURL url = GetURL(); |
266 DCHECK(!url.is_empty()); | 266 DCHECK(!url.is_empty()); |
267 DVLOG(1) << "URL: " << url.spec(); | 267 DVLOG(1) << "URL: " << url.spec(); |
268 | 268 |
269 url_fetcher_.reset( | 269 url_fetcher_.reset( |
270 content::URLFetcher::Create(url, GetRequestType(), this)); | 270 net::URLFetcher::Create(url, GetRequestType(), this)); |
271 url_fetcher_->SetRequestContext(g_browser_process->system_request_context()); | 271 url_fetcher_->SetRequestContext(g_browser_process->system_request_context()); |
272 // Always set flags to neither send nor save cookies. | 272 // Always set flags to neither send nor save cookies. |
273 url_fetcher_->SetLoadFlags( | 273 url_fetcher_->SetLoadFlags( |
274 net::LOAD_DO_NOT_SEND_COOKIES | net::LOAD_DO_NOT_SAVE_COOKIES | | 274 net::LOAD_DO_NOT_SEND_COOKIES | net::LOAD_DO_NOT_SAVE_COOKIES | |
275 net::LOAD_DISABLE_CACHE); | 275 net::LOAD_DISABLE_CACHE); |
276 if (save_temp_file_) { | 276 if (save_temp_file_) { |
277 url_fetcher_->SaveResponseToTemporaryFile( | 277 url_fetcher_->SaveResponseToTemporaryFile( |
278 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)); | 278 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)); |
279 } else if (!output_file_path_.empty()) { | 279 } else if (!output_file_path_.empty()) { |
280 url_fetcher_->SaveResponseToFileAtPath(output_file_path_, | 280 url_fetcher_->SaveResponseToFileAtPath(output_file_path_, |
(...skipping 829 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1110 return true; | 1110 return true; |
1111 } | 1111 } |
1112 | 1112 |
1113 void ResumeUploadOperation::OnURLFetchUploadProgress( | 1113 void ResumeUploadOperation::OnURLFetchUploadProgress( |
1114 const net::URLFetcher* source, int64 current, int64 total) { | 1114 const net::URLFetcher* source, int64 current, int64 total) { |
1115 // Adjust the progress values according to the range currently uploaded. | 1115 // Adjust the progress values according to the range currently uploaded. |
1116 NotifyProgress(params_.start_range + current, params_.content_length); | 1116 NotifyProgress(params_.start_range + current, params_.content_length); |
1117 } | 1117 } |
1118 | 1118 |
1119 } // namespace gdata | 1119 } // namespace gdata |
OLD | NEW |