| 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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 } | 138 } |
| 139 return true; | 139 return true; |
| 140 } | 140 } |
| 141 | 141 |
| 142 void CloudPrintProxyService::GetPrinters(const PrintersCallback& callback) { | 142 void CloudPrintProxyService::GetPrinters(const PrintersCallback& callback) { |
| 143 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 143 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 144 if (!profile_->GetPrefs()->GetBoolean(prefs::kCloudPrintProxyEnabled)) | 144 if (!profile_->GetPrefs()->GetBoolean(prefs::kCloudPrintProxyEnabled)) |
| 145 return; | 145 return; |
| 146 | 146 |
| 147 base::FilePath list_path( | 147 base::FilePath list_path( |
| 148 CommandLine::ForCurrentProcess()->GetSwitchValuePath( | 148 base::CommandLine::ForCurrentProcess()->GetSwitchValuePath( |
| 149 switches::kCloudPrintSetupProxy)); | 149 switches::kCloudPrintSetupProxy)); |
| 150 if (!list_path.empty()) { | 150 if (!list_path.empty()) { |
| 151 std::string printers_json; | 151 std::string printers_json; |
| 152 base::ReadFileToString(list_path, &printers_json); | 152 base::ReadFileToString(list_path, &printers_json); |
| 153 scoped_ptr<base::Value> value(base::JSONReader::Read(printers_json)); | 153 scoped_ptr<base::Value> value(base::JSONReader::Read(printers_json)); |
| 154 base::ListValue* list = NULL; | 154 base::ListValue* list = NULL; |
| 155 std::vector<std::string> printers; | 155 std::vector<std::string> printers; |
| 156 if (value && value->GetAsList(&list) && list) { | 156 if (value && value->GetAsList(&list) && list) { |
| 157 for (size_t i = 0; i < list->GetSize(); ++i) { | 157 for (size_t i = 0; i < list->GetSize(); ++i) { |
| 158 std::string printer; | 158 std::string printer; |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 } | 221 } |
| 222 | 222 |
| 223 bool CloudPrintProxyService::InvokeServiceTask(const base::Closure& task) { | 223 bool CloudPrintProxyService::InvokeServiceTask(const base::Closure& task) { |
| 224 GetServiceProcessControl()->Launch(task, base::Closure()); | 224 GetServiceProcessControl()->Launch(task, base::Closure()); |
| 225 return true; | 225 return true; |
| 226 } | 226 } |
| 227 | 227 |
| 228 ServiceProcessControl* CloudPrintProxyService::GetServiceProcessControl() { | 228 ServiceProcessControl* CloudPrintProxyService::GetServiceProcessControl() { |
| 229 return ServiceProcessControl::GetInstance(); | 229 return ServiceProcessControl::GetInstance(); |
| 230 } | 230 } |
| OLD | NEW |