| 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/chrome_to_mobile_service.h" | 5 #include "chrome/browser/chrome_to_mobile_service.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/guid.h" | 10 #include "base/guid.h" |
| (...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 523 return; | 523 return; |
| 524 } | 524 } |
| 525 | 525 |
| 526 data->type = SNAPSHOT; | 526 data->type = SNAPSHOT; |
| 527 SendJobRequest(observer, *data); | 527 SendJobRequest(observer, *data); |
| 528 } | 528 } |
| 529 | 529 |
| 530 void ChromeToMobileService::InitRequest(net::URLFetcher* request) { | 530 void ChromeToMobileService::InitRequest(net::URLFetcher* request) { |
| 531 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 531 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| 532 request->SetRequestContext(profile_->GetRequestContext()); | 532 request->SetRequestContext(profile_->GetRequestContext()); |
| 533 request->SetMaxRetries(kMaxRetries); | 533 request->SetMaxRetriesOn5xx(kMaxRetries); |
| 534 DCHECK(!access_token_.empty()); | 534 DCHECK(!access_token_.empty()); |
| 535 request->SetExtraRequestHeaders("Authorization: OAuth " + | 535 request->SetExtraRequestHeaders("Authorization: OAuth " + |
| 536 access_token_ + "\r\n" + cloud_print::kChromeCloudPrintProxyHeader); | 536 access_token_ + "\r\n" + cloud_print::kChromeCloudPrintProxyHeader); |
| 537 request->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | | 537 request->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | |
| 538 net::LOAD_DO_NOT_SAVE_COOKIES); | 538 net::LOAD_DO_NOT_SAVE_COOKIES); |
| 539 } | 539 } |
| 540 | 540 |
| 541 void ChromeToMobileService::SendJobRequest(base::WeakPtr<Observer> observer, | 541 void ChromeToMobileService::SendJobRequest(base::WeakPtr<Observer> observer, |
| 542 const JobData& data) { | 542 const JobData& data) { |
| 543 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 543 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 738 | 738 |
| 739 // Report failure below and ignore the second response. | 739 // Report failure below and ignore the second response. |
| 740 request_observer_map_.erase(other); | 740 request_observer_map_.erase(other); |
| 741 break; | 741 break; |
| 742 } | 742 } |
| 743 } | 743 } |
| 744 | 744 |
| 745 if (observer.get()) | 745 if (observer.get()) |
| 746 observer->OnSendComplete(success); | 746 observer->OnSendComplete(success); |
| 747 } | 747 } |
| OLD | NEW |