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/ui/webui/print_preview/print_preview_handler.h" | 5 #include "chrome/browser/ui/webui/print_preview/print_preview_handler.h" |
6 | 6 |
7 #include <ctype.h> | 7 #include <ctype.h> |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
680 base::Unretained(results)), | 680 base::Unretained(results)), |
681 base::Bind(&PrintPreviewHandler::SetupPrinterList, | 681 base::Bind(&PrintPreviewHandler::SetupPrinterList, |
682 weak_factory_.GetWeakPtr(), | 682 weak_factory_.GetWeakPtr(), |
683 base::Owned(results))); | 683 base::Owned(results))); |
684 } | 684 } |
685 | 685 |
686 void PrintPreviewHandler::HandleGetPrivetPrinters(const base::ListValue* args) { | 686 void PrintPreviewHandler::HandleGetPrivetPrinters(const base::ListValue* args) { |
687 if (!PrivetPrintingEnabled()) | 687 if (!PrivetPrintingEnabled()) |
688 return web_ui()->CallJavascriptFunction("onPrivetPrinterSearchDone"); | 688 return web_ui()->CallJavascriptFunction("onPrivetPrinterSearchDone"); |
689 #if defined(ENABLE_SERVICE_DISCOVERY) | 689 #if defined(ENABLE_SERVICE_DISCOVERY) |
690 local_discovery::ServiceDiscoverySharedClient::GetInstanceWithoutAlert( | 690 using local_discovery::ServiceDiscoverySharedClient; |
691 base::Bind(&PrintPreviewHandler::StartPrivetLister, | 691 scoped_refptr<ServiceDiscoverySharedClient> service_discovery = |
692 weak_factory_.GetWeakPtr())); | 692 ServiceDiscoverySharedClient::GetInstance(); |
| 693 StartPrivetLister(service_discovery); |
693 #endif // ENABLE_SERVICE_DISCOVERY | 694 #endif // ENABLE_SERVICE_DISCOVERY |
694 } | 695 } |
695 | 696 |
696 void PrintPreviewHandler::HandleStopGetPrivetPrinters( | 697 void PrintPreviewHandler::HandleStopGetPrivetPrinters( |
697 const base::ListValue* args) { | 698 const base::ListValue* args) { |
698 #if defined(ENABLE_SERVICE_DISCOVERY) | 699 #if defined(ENABLE_SERVICE_DISCOVERY) |
699 if (PrivetPrintingEnabled() && printer_lister_) { | 700 if (PrivetPrintingEnabled() && printer_lister_) { |
700 printer_lister_->Stop(); | 701 printer_lister_->Stop(); |
701 } | 702 } |
702 #endif | 703 #endif |
(...skipping 1011 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1714 | 1715 |
1715 void PrintPreviewHandler::UnregisterForGaiaCookieChanges() { | 1716 void PrintPreviewHandler::UnregisterForGaiaCookieChanges() { |
1716 if (gaia_cookie_manager_service_) | 1717 if (gaia_cookie_manager_service_) |
1717 gaia_cookie_manager_service_->RemoveObserver(this); | 1718 gaia_cookie_manager_service_->RemoveObserver(this); |
1718 } | 1719 } |
1719 | 1720 |
1720 void PrintPreviewHandler::SetPdfSavedClosureForTesting( | 1721 void PrintPreviewHandler::SetPdfSavedClosureForTesting( |
1721 const base::Closure& closure) { | 1722 const base::Closure& closure) { |
1722 pdf_file_saved_closure_ = closure; | 1723 pdf_file_saved_closure_ = closure; |
1723 } | 1724 } |
OLD | NEW |