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

Side by Side Diff: chrome/browser/extensions/extension_web_socket_proxy_private_api.cc

Issue 10309002: Reimplements net::AddressList without struct addrinfo. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: get_canonical_name -> canonical_name. iterator to indexing Created 8 years, 7 months 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/extensions/api/socket/socket.cc ('k') | chrome/browser/net/network_stats.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/extensions/extension_web_socket_proxy_private_api.h" 5 #include "chrome/browser/extensions/extension_web_socket_proxy_private_api.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "base/string_number_conversions.h" 9 #include "base/string_number_conversions.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 } 121 }
122 #else 122 #else
123 Finalize(); 123 Finalize();
124 #endif 124 #endif
125 125
126 return true; 126 return true;
127 } 127 }
128 128
129 void WebSocketProxyPrivate::OnHostResolution(int result) { 129 void WebSocketProxyPrivate::OnHostResolution(int result) {
130 #if defined(OS_CHROMEOS) 130 #if defined(OS_CHROMEOS)
131 if (result == 0 && addr_.head() != NULL) { 131 if (result == 0 && !addr_.empty()) {
132 std::string ip = net::NetAddressToString(addr_.head()); 132 std::string ip = addr_.front().ToStringWithoutPort();
133 if (!ip.empty() && ip.find(':') != std::string::npos && ip[0] != '[') 133 if (!ip.empty() && ip.find(':') != std::string::npos && ip[0] != '[')
134 ip = '[' + ip + ']'; 134 ip = '[' + ip + ']';
135 map_["addr"] = ip; 135 map_["addr"] = ip;
136 } 136 }
137 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, 137 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE,
138 base::Bind(&WebSocketProxyPrivate::Finalize, this)); 138 base::Bind(&WebSocketProxyPrivate::Finalize, this));
139 #endif 139 #endif
140 } 140 }
141 141
142 WebSocketProxyPrivateGetURLForTCPFunction:: 142 WebSocketProxyPrivateGetURLForTCPFunction::
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 void WebSocketProxyPrivateGetPassportForTCPFunction::CustomFinalize() { 196 void WebSocketProxyPrivateGetPassportForTCPFunction::CustomFinalize() {
197 #if defined(OS_CHROMEOS) 197 #if defined(OS_CHROMEOS)
198 std::string passport = 198 std::string passport =
199 browser::InternalAuthGeneration::GeneratePassport( 199 browser::InternalAuthGeneration::GeneratePassport(
200 "web_socket_proxy", map_) + std::string(":"); 200 "web_socket_proxy", map_) + std::string(":");
201 if (ContainsKey(map_, "addr")) 201 if (ContainsKey(map_, "addr"))
202 passport += map_["addr"]; 202 passport += map_["addr"];
203 result_.reset(Value::CreateStringValue(passport)); 203 result_.reset(Value::CreateStringValue(passport));
204 #endif 204 #endif
205 } 205 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/socket/socket.cc ('k') | chrome/browser/net/network_stats.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698