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

Side by Side Diff: chrome/service/cloud_print/job_status_updater.cc

Issue 12208089: Changing CloudPrintURLFetcher instantiation to be more testable (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Modified change to use static factory pattern Created 7 years, 10 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
OLDNEW
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/service/cloud_print/job_status_updater.h" 5 #include "chrome/service/cloud_print/job_status_updater.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/string_util.h" 9 #include "base/string_util.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 } else { 51 } else {
52 // If GetJobDetails failed, the most likely case is that the job no 52 // If GetJobDetails failed, the most likely case is that the job no
53 // longer exists in the OS queue. We are going to assume it is done in 53 // longer exists in the OS queue. We are going to assume it is done in
54 // this case. 54 // this case.
55 last_job_details_.Clear(); 55 last_job_details_.Clear();
56 last_job_details_.status = PRINT_JOB_STATUS_COMPLETED; 56 last_job_details_.status = PRINT_JOB_STATUS_COMPLETED;
57 need_update = true; 57 need_update = true;
58 } 58 }
59 } 59 }
60 if (need_update) { 60 if (need_update) {
61 request_ = new CloudPrintURLFetcher; 61 request_ = CloudPrintURLFetcher::Create();
62 request_->StartGetRequest( 62 request_->StartGetRequest(
63 GetUrlForJobStatusUpdate( 63 GetUrlForJobStatusUpdate(
64 cloud_print_server_url_, job_id_, last_job_details_), 64 cloud_print_server_url_, job_id_, last_job_details_),
65 this, 65 this,
66 kCloudPrintAPIMaxRetryCount, 66 kCloudPrintAPIMaxRetryCount,
67 std::string()); 67 std::string());
68 } 68 }
69 } 69 }
70 } 70 }
71 71
(...skipping 27 matching lines...) Expand all
99 return CloudPrintURLFetcher::STOP_PROCESSING; 99 return CloudPrintURLFetcher::STOP_PROCESSING;
100 } 100 }
101 101
102 std::string JobStatusUpdater::GetAuthHeader() { 102 std::string JobStatusUpdater::GetAuthHeader() {
103 return GetCloudPrintAuthHeaderFromStore(); 103 return GetCloudPrintAuthHeaderFromStore();
104 } 104 }
105 105
106 JobStatusUpdater::~JobStatusUpdater() {} 106 JobStatusUpdater::~JobStatusUpdater() {}
107 107
108 } // namespace cloud_print 108 } // namespace cloud_print
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698