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 1345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1356 } | 1356 } |
1357 DCHECK(tmp_data->size() && tmp_data->front()); | 1357 DCHECK(tmp_data->size() && tmp_data->front()); |
1358 | 1358 |
1359 *data = tmp_data; | 1359 *data = tmp_data; |
1360 *title = print_preview_ui->initiator_title(); | 1360 *title = print_preview_ui->initiator_title(); |
1361 return true; | 1361 return true; |
1362 } | 1362 } |
1363 | 1363 |
1364 #if defined(ENABLE_SERVICE_DISCOVERY) | 1364 #if defined(ENABLE_SERVICE_DISCOVERY) |
1365 | 1365 |
1366 void PrintPreviewHandler::StartPrivetLister( | 1366 void PrintPreviewHandler::StartPrivetLister(const scoped_refptr< |
1367 scoped_refptr<local_discovery::ServiceDiscoverySharedClient> client) { | 1367 local_discovery::ServiceDiscoverySharedClient>& client) { |
1368 if (!PrivetPrintingEnabled()) | 1368 if (!PrivetPrintingEnabled()) |
1369 return web_ui()->CallJavascriptFunction("onPrivetPrinterSearchDone"); | 1369 return web_ui()->CallJavascriptFunction("onPrivetPrinterSearchDone"); |
1370 | 1370 |
1371 Profile* profile = Profile::FromWebUI(web_ui()); | 1371 Profile* profile = Profile::FromWebUI(web_ui()); |
1372 DCHECK(!service_discovery_client_ || service_discovery_client_ == client); | 1372 DCHECK(!service_discovery_client_.get() || |
| 1373 service_discovery_client_ == client); |
1373 service_discovery_client_ = client; | 1374 service_discovery_client_ = client; |
1374 printer_lister_.reset(new local_discovery::PrivetLocalPrinterLister( | 1375 printer_lister_.reset(new local_discovery::PrivetLocalPrinterLister( |
1375 service_discovery_client_.get(), profile->GetRequestContext(), this)); | 1376 service_discovery_client_.get(), profile->GetRequestContext(), this)); |
1376 printer_lister_->Start(); | 1377 printer_lister_->Start(); |
1377 } | 1378 } |
1378 | 1379 |
1379 void PrintPreviewHandler::LocalPrinterChanged( | 1380 void PrintPreviewHandler::LocalPrinterChanged( |
1380 bool added, | 1381 bool added, |
1381 const std::string& name, | 1382 const std::string& name, |
1382 bool has_local_printing, | 1383 bool has_local_printing, |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1588 | 1589 |
1589 void PrintPreviewHandler::UnregisterForMergeSession() { | 1590 void PrintPreviewHandler::UnregisterForMergeSession() { |
1590 if (reconcilor_) | 1591 if (reconcilor_) |
1591 reconcilor_->RemoveMergeSessionObserver(this); | 1592 reconcilor_->RemoveMergeSessionObserver(this); |
1592 } | 1593 } |
1593 | 1594 |
1594 void PrintPreviewHandler::SetPdfSavedClosureForTesting( | 1595 void PrintPreviewHandler::SetPdfSavedClosureForTesting( |
1595 const base::Closure& closure) { | 1596 const base::Closure& closure) { |
1596 pdf_file_saved_closure_ = closure; | 1597 pdf_file_saved_closure_ = closure; |
1597 } | 1598 } |
OLD | NEW |