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 1408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1419 base::string16 title; | 1419 base::string16 title; |
1420 | 1420 |
1421 if (!GetPreviewDataAndTitle(&data, &title)) { | 1421 if (!GetPreviewDataAndTitle(&data, &title)) { |
1422 base::FundamentalValue http_code_value(-1); | 1422 base::FundamentalValue http_code_value(-1); |
1423 web_ui()->CallJavascriptFunction("onPrivetPrintFailed", http_code_value); | 1423 web_ui()->CallJavascriptFunction("onPrivetPrintFailed", http_code_value); |
1424 return; | 1424 return; |
1425 } | 1425 } |
1426 | 1426 |
1427 privet_local_print_operation_->SetJobname(base::UTF16ToUTF8(title)); | 1427 privet_local_print_operation_->SetJobname(base::UTF16ToUTF8(title)); |
1428 privet_local_print_operation_->SetPageSize(page_size); | 1428 privet_local_print_operation_->SetPageSize(page_size); |
1429 privet_local_print_operation_->SetData(data); | 1429 privet_local_print_operation_->SetData(data.get()); |
1430 | 1430 |
1431 Profile* profile = Profile::FromWebUI(web_ui()); | 1431 Profile* profile = Profile::FromWebUI(web_ui()); |
1432 SigninManagerBase* signin_manager = | 1432 SigninManagerBase* signin_manager = |
1433 SigninManagerFactory::GetForProfileIfExists(profile); | 1433 SigninManagerFactory::GetForProfileIfExists(profile); |
1434 | 1434 |
1435 if (signin_manager) { | 1435 if (signin_manager) { |
1436 privet_local_print_operation_->SetUsername( | 1436 privet_local_print_operation_->SetUsername( |
1437 signin_manager->GetAuthenticatedUsername()); | 1437 signin_manager->GetAuthenticatedUsername()); |
1438 } | 1438 } |
1439 | 1439 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1497 const local_discovery::DeviceDescription* device_description = | 1497 const local_discovery::DeviceDescription* device_description = |
1498 printer_lister_->GetDeviceDescription(name); | 1498 printer_lister_->GetDeviceDescription(name); |
1499 | 1499 |
1500 if (!device_description) { | 1500 if (!device_description) { |
1501 SendPrivetCapabilitiesError(name); | 1501 SendPrivetCapabilitiesError(name); |
1502 return false; | 1502 return false; |
1503 } | 1503 } |
1504 | 1504 |
1505 privet_http_factory_ = | 1505 privet_http_factory_ = |
1506 local_discovery::PrivetHTTPAsynchronousFactory::CreateInstance( | 1506 local_discovery::PrivetHTTPAsynchronousFactory::CreateInstance( |
1507 service_discovery_client_, | 1507 service_discovery_client_.get(), |
1508 Profile::FromWebUI(web_ui())->GetRequestContext()); | 1508 Profile::FromWebUI(web_ui())->GetRequestContext()); |
1509 privet_http_resolution_ = privet_http_factory_->CreatePrivetHTTP( | 1509 privet_http_resolution_ = privet_http_factory_->CreatePrivetHTTP( |
1510 name, device_description->address, callback); | 1510 name, device_description->address, callback); |
1511 privet_http_resolution_->Start(); | 1511 privet_http_resolution_->Start(); |
1512 | 1512 |
1513 return true; | 1513 return true; |
1514 } | 1514 } |
1515 | 1515 |
1516 void PrintPreviewHandler::OnPrivetPrintingDone( | 1516 void PrintPreviewHandler::OnPrivetPrintingDone( |
1517 const local_discovery::PrivetLocalPrintOperation* print_operation) { | 1517 const local_discovery::PrivetLocalPrintOperation* print_operation) { |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1556 | 1556 |
1557 void PrintPreviewHandler::UnregisterForMergeSession() { | 1557 void PrintPreviewHandler::UnregisterForMergeSession() { |
1558 if (reconcilor_) | 1558 if (reconcilor_) |
1559 reconcilor_->RemoveMergeSessionObserver(this); | 1559 reconcilor_->RemoveMergeSessionObserver(this); |
1560 } | 1560 } |
1561 | 1561 |
1562 void PrintPreviewHandler::SetPdfSavedClosureForTesting( | 1562 void PrintPreviewHandler::SetPdfSavedClosureForTesting( |
1563 const base::Closure& closure) { | 1563 const base::Closure& closure) { |
1564 pdf_file_saved_closure_ = closure; | 1564 pdf_file_saved_closure_ = closure; |
1565 } | 1565 } |
OLD | NEW |