OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/local_discovery/privet_http_impl.h" | 5 #include "chrome/browser/local_discovery/privet_http_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | |
9 #include <algorithm> | 8 #include <algorithm> |
| 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/bind.h" | 12 #include "base/bind.h" |
13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
14 #include "base/location.h" | 14 #include "base/location.h" |
15 #include "base/rand_util.h" | 15 #include "base/rand_util.h" |
16 #include "base/strings/string_number_conversions.h" | 16 #include "base/strings/string_number_conversions.h" |
17 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
18 #include "base/thread_task_runner_handle.h" | 18 #include "base/thread_task_runner_handle.h" |
19 #include "chrome/browser/extensions/api/gcd_private/privet_v3_context_getter.h" | 19 #include "chrome/browser/extensions/api/gcd_private/privet_v3_context_getter.h" |
(...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
683 offline_ = offline; | 683 offline_ = offline; |
684 } | 684 } |
685 | 685 |
686 void PrivetLocalPrintOperationImpl::SetPageSize(const gfx::Size& page_size) { | 686 void PrivetLocalPrintOperationImpl::SetPageSize(const gfx::Size& page_size) { |
687 DCHECK(!started_); | 687 DCHECK(!started_); |
688 page_size_ = page_size; | 688 page_size_ = page_size; |
689 } | 689 } |
690 | 690 |
691 void PrivetLocalPrintOperationImpl::SetPWGRasterConverterForTesting( | 691 void PrivetLocalPrintOperationImpl::SetPWGRasterConverterForTesting( |
692 scoped_ptr<PWGRasterConverter> pwg_raster_converter) { | 692 scoped_ptr<PWGRasterConverter> pwg_raster_converter) { |
693 pwg_raster_converter_ = pwg_raster_converter.Pass(); | 693 pwg_raster_converter_ = std::move(pwg_raster_converter); |
694 } | 694 } |
695 #endif // ENABLE_PRINT_PREVIEW | 695 #endif // ENABLE_PRINT_PREVIEW |
696 | 696 |
697 PrivetHTTPClientImpl::PrivetHTTPClientImpl( | 697 PrivetHTTPClientImpl::PrivetHTTPClientImpl( |
698 const std::string& name, | 698 const std::string& name, |
699 const net::HostPortPair& host_port, | 699 const net::HostPortPair& host_port, |
700 const scoped_refptr<net::URLRequestContextGetter>& context_getter) | 700 const scoped_refptr<net::URLRequestContextGetter>& context_getter) |
701 : name_(name), context_getter_(context_getter), host_port_(host_port) {} | 701 : name_(name), context_getter_(context_getter), host_port_(host_port) {} |
702 | 702 |
703 PrivetHTTPClientImpl::~PrivetHTTPClientImpl() { | 703 PrivetHTTPClientImpl::~PrivetHTTPClientImpl() { |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
754 token_callbacks_.swap(token_callbacks); | 754 token_callbacks_.swap(token_callbacks); |
755 | 755 |
756 for (TokenCallbackVector::iterator i = token_callbacks.begin(); | 756 for (TokenCallbackVector::iterator i = token_callbacks.begin(); |
757 i != token_callbacks.end(); i++) { | 757 i != token_callbacks.end(); i++) { |
758 i->Run(token); | 758 i->Run(token); |
759 } | 759 } |
760 } | 760 } |
761 | 761 |
762 PrivetV1HTTPClientImpl::PrivetV1HTTPClientImpl( | 762 PrivetV1HTTPClientImpl::PrivetV1HTTPClientImpl( |
763 scoped_ptr<PrivetHTTPClient> info_client) | 763 scoped_ptr<PrivetHTTPClient> info_client) |
764 : info_client_(info_client.Pass()) { | 764 : info_client_(std::move(info_client)) {} |
765 } | |
766 | 765 |
767 PrivetV1HTTPClientImpl::~PrivetV1HTTPClientImpl() { | 766 PrivetV1HTTPClientImpl::~PrivetV1HTTPClientImpl() { |
768 } | 767 } |
769 | 768 |
770 const std::string& PrivetV1HTTPClientImpl::GetName() { | 769 const std::string& PrivetV1HTTPClientImpl::GetName() { |
771 return info_client()->GetName(); | 770 return info_client()->GetName(); |
772 } | 771 } |
773 | 772 |
774 scoped_ptr<PrivetJSONOperation> PrivetV1HTTPClientImpl::CreateInfoOperation( | 773 scoped_ptr<PrivetJSONOperation> PrivetV1HTTPClientImpl::CreateInfoOperation( |
775 const PrivetJSONOperation::ResultCallback& callback) { | 774 const PrivetJSONOperation::ResultCallback& callback) { |
(...skipping 20 matching lines...) Expand all Loading... |
796 PrivetLocalPrintOperation::Delegate* delegate) { | 795 PrivetLocalPrintOperation::Delegate* delegate) { |
797 #if defined(ENABLE_PRINT_PREVIEW) | 796 #if defined(ENABLE_PRINT_PREVIEW) |
798 return scoped_ptr<PrivetLocalPrintOperation>( | 797 return scoped_ptr<PrivetLocalPrintOperation>( |
799 new PrivetLocalPrintOperationImpl(info_client(), delegate)); | 798 new PrivetLocalPrintOperationImpl(info_client(), delegate)); |
800 #else | 799 #else |
801 return scoped_ptr<PrivetLocalPrintOperation>(); | 800 return scoped_ptr<PrivetLocalPrintOperation>(); |
802 #endif // ENABLE_PRINT_PREVIEW | 801 #endif // ENABLE_PRINT_PREVIEW |
803 } | 802 } |
804 | 803 |
805 } // namespace local_discovery | 804 } // namespace local_discovery |
OLD | NEW |