Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(210)

Side by Side Diff: chrome/browser/local_discovery/privet_http_impl.cc

Issue 1440063002: Use net::HostPortPair::HostForURL to fix IPv6 in URLs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@context4
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after
709 const PrivetJSONOperation::ResultCallback& callback) { 709 const PrivetJSONOperation::ResultCallback& callback) {
710 return scoped_ptr<PrivetJSONOperation>( 710 return scoped_ptr<PrivetJSONOperation>(
711 new PrivetInfoOperationImpl(this, callback)); 711 new PrivetInfoOperationImpl(this, callback));
712 } 712 }
713 713
714 scoped_ptr<PrivetURLFetcher> PrivetHTTPClientImpl::CreateURLFetcher( 714 scoped_ptr<PrivetURLFetcher> PrivetHTTPClientImpl::CreateURLFetcher(
715 const GURL& url, 715 const GURL& url,
716 net::URLFetcher::RequestType request_type, 716 net::URLFetcher::RequestType request_type,
717 PrivetURLFetcher::Delegate* delegate) { 717 PrivetURLFetcher::Delegate* delegate) {
718 GURL::Replacements replacements; 718 GURL::Replacements replacements;
719 replacements.SetHostStr(host_port_.host()); 719 std::string host = host_port_.HostForURL();
720 replacements.SetHostStr(host);
720 std::string port = base::UintToString(host_port_.port()); 721 std::string port = base::UintToString(host_port_.port());
721 replacements.SetPortStr(port); 722 replacements.SetPortStr(port);
722 std::string scheme = IsInHttpsMode() ? "https" : "http"; 723 std::string scheme = IsInHttpsMode() ? "https" : "http";
723 replacements.SetSchemeStr(scheme); 724 replacements.SetSchemeStr(scheme);
724 return scoped_ptr<PrivetURLFetcher>( 725 return scoped_ptr<PrivetURLFetcher>(
725 new PrivetURLFetcher(url.ReplaceComponents(replacements), request_type, 726 new PrivetURLFetcher(url.ReplaceComponents(replacements), request_type,
726 context_getter_, delegate)); 727 context_getter_, delegate));
727 } 728 }
728 729
729 void PrivetHTTPClientImpl::RefreshPrivetToken( 730 void PrivetHTTPClientImpl::RefreshPrivetToken(
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
812 PrivetLocalPrintOperation::Delegate* delegate) { 813 PrivetLocalPrintOperation::Delegate* delegate) {
813 #if defined(ENABLE_PRINT_PREVIEW) 814 #if defined(ENABLE_PRINT_PREVIEW)
814 return scoped_ptr<PrivetLocalPrintOperation>( 815 return scoped_ptr<PrivetLocalPrintOperation>(
815 new PrivetLocalPrintOperationImpl(info_client(), delegate)); 816 new PrivetLocalPrintOperationImpl(info_client(), delegate));
816 #else 817 #else
817 return scoped_ptr<PrivetLocalPrintOperation>(); 818 return scoped_ptr<PrivetLocalPrintOperation>();
818 #endif // ENABLE_PRINT_PREVIEW 819 #endif // ENABLE_PRINT_PREVIEW
819 } 820 }
820 821
821 } // namespace local_discovery 822 } // namespace local_discovery
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698