OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/ui/webui/settings/chromeos/cups_printers_handler.h" | 5 #include "chrome/browser/ui/webui/settings/chromeos/cups_printers_handler.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 | 237 |
238 void CupsPrintersHandler::OnAddedPrinter(std::unique_ptr<Printer> printer, | 238 void CupsPrintersHandler::OnAddedPrinter(std::unique_ptr<Printer> printer, |
239 bool success) { | 239 bool success) { |
240 std::string printer_name = printer->display_name(); | 240 std::string printer_name = printer->display_name(); |
241 if (success) { | 241 if (success) { |
242 PrinterPrefManagerFactory::GetForBrowserContext(profile_)->RegisterPrinter( | 242 PrinterPrefManagerFactory::GetForBrowserContext(profile_)->RegisterPrinter( |
243 std::move(printer)); | 243 std::move(printer)); |
244 } | 244 } |
245 CallJavascriptFunction( | 245 CallJavascriptFunction( |
246 "cr.webUIListenerCallback", base::StringValue("on-add-cups-printer"), | 246 "cr.webUIListenerCallback", base::StringValue("on-add-cups-printer"), |
247 base::FundamentalValue(success), base::StringValue(printer_name)); | 247 base::Value(success), base::StringValue(printer_name)); |
248 } | 248 } |
249 | 249 |
250 void CupsPrintersHandler::OnAddPrinterError() { | 250 void CupsPrintersHandler::OnAddPrinterError() { |
251 CallJavascriptFunction("cr.webUIListenerCallback", | 251 CallJavascriptFunction("cr.webUIListenerCallback", |
252 base::StringValue("on-add-cups-printer"), | 252 base::StringValue("on-add-cups-printer"), |
253 base::FundamentalValue(false), base::StringValue("")); | 253 base::Value(false), base::StringValue("")); |
254 } | 254 } |
255 | 255 |
256 void CupsPrintersHandler::HandleGetCupsPrinterManufacturers( | 256 void CupsPrintersHandler::HandleGetCupsPrinterManufacturers( |
257 const base::ListValue* args) { | 257 const base::ListValue* args) { |
258 std::string js_callback; | 258 std::string js_callback; |
259 CHECK_EQ(1U, args->GetSize()); | 259 CHECK_EQ(1U, args->GetSize()); |
260 CHECK(args->GetString(0, &js_callback)); | 260 CHECK(args->GetString(0, &js_callback)); |
261 ppd_provider_->QueryAvailable( | 261 ppd_provider_->QueryAvailable( |
262 base::Bind(&CupsPrintersHandler::QueryAvailableManufacturersDone, | 262 base::Bind(&CupsPrintersHandler::QueryAvailableManufacturersDone, |
263 weak_factory_.GetWeakPtr(), | 263 weak_factory_.GetWeakPtr(), |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 *printers_list); | 386 *printers_list); |
387 } | 387 } |
388 | 388 |
389 void CupsPrintersHandler::OnDiscoveryDone() { | 389 void CupsPrintersHandler::OnDiscoveryDone() { |
390 CallJavascriptFunction("cr.webUIListenerCallback", | 390 CallJavascriptFunction("cr.webUIListenerCallback", |
391 base::StringValue("on-printer-discovery-done")); | 391 base::StringValue("on-printer-discovery-done")); |
392 } | 392 } |
393 | 393 |
394 } // namespace settings | 394 } // namespace settings |
395 } // namespace chromeos | 395 } // namespace chromeos |
OLD | NEW |