| 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.h" | 5 #include "chrome/browser/chromeos/gdata/gdata.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 #include "chrome/browser/profiles/profile_downloader_delegate.h" | 24 #include "chrome/browser/profiles/profile_downloader_delegate.h" |
| 25 #include "chrome/browser/signin/token_service.h" | 25 #include "chrome/browser/signin/token_service.h" |
| 26 #include "chrome/common/chrome_notification_types.h" | 26 #include "chrome/common/chrome_notification_types.h" |
| 27 #include "chrome/common/libxml_utils.h" | 27 #include "chrome/common/libxml_utils.h" |
| 28 #include "chrome/common/net/gaia/gaia_constants.h" | 28 #include "chrome/common/net/gaia/gaia_constants.h" |
| 29 #include "chrome/common/net/gaia/gaia_urls.h" | 29 #include "chrome/common/net/gaia/gaia_urls.h" |
| 30 #include "content/public/browser/browser_thread.h" | 30 #include "content/public/browser/browser_thread.h" |
| 31 #include "content/public/browser/notification_details.h" | 31 #include "content/public/browser/notification_details.h" |
| 32 #include "content/public/browser/notification_source.h" | 32 #include "content/public/browser/notification_source.h" |
| 33 #include "content/public/browser/notification_types.h" | 33 #include "content/public/browser/notification_types.h" |
| 34 #include "content/public/common/content_url_request_user_data.h" |
| 34 #include "net/base/file_stream.h" | 35 #include "net/base/file_stream.h" |
| 35 #include "net/base/load_flags.h" | 36 #include "net/base/load_flags.h" |
| 36 #include "net/http/http_response_headers.h" | 37 #include "net/http/http_response_headers.h" |
| 37 #include "net/http/http_util.h" | 38 #include "net/http/http_util.h" |
| 38 | 39 |
| 39 using content::BrowserThread; | 40 using content::BrowserThread; |
| 40 | 41 |
| 41 namespace gdata { | 42 namespace gdata { |
| 42 | 43 |
| 43 namespace { | 44 namespace { |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 : profile_(profile), auth_token_(auth_token), save_temp_file_(false) { | 229 : profile_(profile), auth_token_(auth_token), save_temp_file_(false) { |
| 229 } | 230 } |
| 230 | 231 |
| 231 void Start(T callback) { | 232 void Start(T callback) { |
| 232 DCHECK(!auth_token_.empty()); | 233 DCHECK(!auth_token_.empty()); |
| 233 callback_ = callback; | 234 callback_ = callback; |
| 234 GURL url = GetURL(); | 235 GURL url = GetURL(); |
| 235 url_fetcher_.reset(content::URLFetcher::Create( | 236 url_fetcher_.reset(content::URLFetcher::Create( |
| 236 url, GetRequestType(), this)); | 237 url, GetRequestType(), this)); |
| 237 url_fetcher_->SetRequestContext(profile_->GetRequestContext()); | 238 url_fetcher_->SetRequestContext(profile_->GetRequestContext()); |
| 239 // No user data, as the request will be cookie-less. |
| 240 url_fetcher_->SetContentURLRequestUserData( |
| 241 new content::ContentURLRequestUserData()); |
| 238 // Always set flags to neither send nor save cookies. | 242 // Always set flags to neither send nor save cookies. |
| 239 url_fetcher_->SetLoadFlags( | 243 url_fetcher_->SetLoadFlags( |
| 240 net::LOAD_DO_NOT_SEND_COOKIES | net::LOAD_DO_NOT_SAVE_COOKIES); | 244 net::LOAD_DO_NOT_SEND_COOKIES | net::LOAD_DO_NOT_SAVE_COOKIES); |
| 241 if (save_temp_file_) { | 245 if (save_temp_file_) { |
| 242 url_fetcher_->SaveResponseToTemporaryFile( | 246 url_fetcher_->SaveResponseToTemporaryFile( |
| 243 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)); | 247 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)); |
| 244 } | 248 } |
| 245 | 249 |
| 246 // Add request headers. | 250 // Add request headers. |
| 247 // Note that SetExtraRequestHeaders clears the current headers and sets it | 251 // Note that SetExtraRequestHeaders clears the current headers and sets it |
| (...skipping 1006 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1254 DVLOG(1) << "Starting InitiateUpload for [" | 1258 DVLOG(1) << "Starting InitiateUpload for [" |
| 1255 << caller.upload_file_info.title << "] (" | 1259 << caller.upload_file_info.title << "] (" |
| 1256 << caller.upload_file_info.file_url.spec() << ")"; | 1260 << caller.upload_file_info.file_url.spec() << ")"; |
| 1257 InitiateUpload(caller.upload_file_info, caller.callback); | 1261 InitiateUpload(caller.upload_file_info, caller.callback); |
| 1258 } | 1262 } |
| 1259 initiate_upload_callers_.clear(); | 1263 initiate_upload_callers_.clear(); |
| 1260 } | 1264 } |
| 1261 } | 1265 } |
| 1262 | 1266 |
| 1263 } // namespace gdata | 1267 } // namespace gdata |
| OLD | NEW |