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/printing/cloud_print/cloud_print_proxy_service.h" | 5 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" |
6 | 6 |
7 #include <stack> | 7 #include <stack> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 for (size_t i = 0; i < list->GetSize(); ++i) { | 147 for (size_t i = 0; i < list->GetSize(); ++i) { |
148 std::string printer; | 148 std::string printer; |
149 if (list->GetString(i, &printer)) | 149 if (list->GetString(i, &printer)) |
150 printers->push_back(printer); | 150 printers->push_back(printer); |
151 } | 151 } |
152 } | 152 } |
153 } else { | 153 } else { |
154 printing::PrinterList printer_list; | 154 printing::PrinterList printer_list; |
155 scoped_refptr<printing::PrintBackend> backend( | 155 scoped_refptr<printing::PrintBackend> backend( |
156 printing::PrintBackend::CreateInstance(NULL)); | 156 printing::PrintBackend::CreateInstance(NULL)); |
157 if (backend) | 157 if (backend.get()) |
158 backend->EnumeratePrinters(&printer_list); | 158 backend->EnumeratePrinters(&printer_list); |
159 for (size_t i = 0; i < printer_list.size(); ++i) | 159 for (size_t i = 0; i < printer_list.size(); ++i) |
160 printers->push_back(printer_list[i].printer_name); | 160 printers->push_back(printer_list[i].printer_name); |
161 } | 161 } |
162 } | 162 } |
163 | 163 |
164 void CloudPrintProxyService::RefreshCloudPrintProxyStatus() { | 164 void CloudPrintProxyService::RefreshCloudPrintProxyStatus() { |
165 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 165 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
166 ServiceProcessControl* process_control = GetServiceProcessControl(); | 166 ServiceProcessControl* process_control = GetServiceProcessControl(); |
167 DCHECK(process_control->IsConnected()); | 167 DCHECK(process_control->IsConnected()); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 } | 213 } |
214 | 214 |
215 bool CloudPrintProxyService::InvokeServiceTask(const base::Closure& task) { | 215 bool CloudPrintProxyService::InvokeServiceTask(const base::Closure& task) { |
216 GetServiceProcessControl()->Launch(task, base::Closure()); | 216 GetServiceProcessControl()->Launch(task, base::Closure()); |
217 return true; | 217 return true; |
218 } | 218 } |
219 | 219 |
220 ServiceProcessControl* CloudPrintProxyService::GetServiceProcessControl() { | 220 ServiceProcessControl* CloudPrintProxyService::GetServiceProcessControl() { |
221 return ServiceProcessControl::GetInstance(); | 221 return ServiceProcessControl::GetInstance(); |
222 } | 222 } |
OLD | NEW |