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

Side by Side Diff: extensions/browser/api/networking_config/networking_config_service.cc

Issue 1471043004: Convert various vector_as_array calls to vector::data. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 <algorithm> 5 #include <algorithm>
6 #include <vector> 6 #include <vector>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 const chromeos::NetworkState* network = chromeos::NetworkHandler::Get() 178 const chromeos::NetworkState* network = chromeos::NetworkHandler::Get()
179 ->network_state_handler() 179 ->network_state_handler()
180 ->GetNetworkStateFromGuid(guid); 180 ->GetNetworkStateFromGuid(guid);
181 if (!network) 181 if (!network)
182 return nullptr; 182 return nullptr;
183 183
184 // Populate the NetworkInfo object. 184 // Populate the NetworkInfo object.
185 api::networking_config::NetworkInfo network_info; 185 api::networking_config::NetworkInfo network_info;
186 network_info.type = api::networking_config::NETWORK_TYPE_WIFI; 186 network_info.type = api::networking_config::NETWORK_TYPE_WIFI;
187 const std::vector<uint8_t>& raw_ssid = network->raw_ssid(); 187 const std::vector<uint8_t>& raw_ssid = network->raw_ssid();
188 std::string hex_ssid = 188 std::string hex_ssid = base::HexEncode(raw_ssid.data(), raw_ssid.size());
189 base::HexEncode(vector_as_array(&raw_ssid), raw_ssid.size());
190 network_info.hex_ssid = make_scoped_ptr(new std::string(hex_ssid)); 189 network_info.hex_ssid = make_scoped_ptr(new std::string(hex_ssid));
191 network_info.ssid = make_scoped_ptr(new std::string(network->name())); 190 network_info.ssid = make_scoped_ptr(new std::string(network->name()));
192 network_info.guid = make_scoped_ptr(new std::string(network->guid())); 191 network_info.guid = make_scoped_ptr(new std::string(network->guid()));
193 if (bssid) 192 if (bssid)
194 network_info.bssid.reset(new std::string(*bssid)); 193 network_info.bssid.reset(new std::string(*bssid));
195 scoped_ptr<base::ListValue> results = 194 scoped_ptr<base::ListValue> results =
196 api::networking_config::OnCaptivePortalDetected::Create(network_info); 195 api::networking_config::OnCaptivePortalDetected::Create(network_info);
197 scoped_ptr<Event> event( 196 scoped_ptr<Event> event(
198 new Event(events::NETWORKING_CONFIG_ON_CAPTIVE_PORTAL_DETECTED, 197 new Event(events::NETWORKING_CONFIG_ON_CAPTIVE_PORTAL_DETECTED,
199 api::networking_config::OnCaptivePortalDetected::kEventName, 198 api::networking_config::OnCaptivePortalDetected::kEventName,
(...skipping 22 matching lines...) Expand all
222 network_handler->managed_network_configuration_handler()->GetProperties( 221 network_handler->managed_network_configuration_handler()->GetProperties(
223 "" /* empty userhash */, service_path, 222 "" /* empty userhash */, service_path,
224 base::Bind(&NetworkingConfigService::OnGotProperties, 223 base::Bind(&NetworkingConfigService::OnGotProperties,
225 weak_factory_.GetWeakPtr(), extension_id, guid, 224 weak_factory_.GetWeakPtr(), extension_id, guid,
226 authentication_callback), 225 authentication_callback),
227 base::Bind(&NetworkingConfigService::OnGetPropertiesFailed, 226 base::Bind(&NetworkingConfigService::OnGetPropertiesFailed,
228 weak_factory_.GetWeakPtr(), extension_id, guid)); 227 weak_factory_.GetWeakPtr(), extension_id, guid));
229 } 228 }
230 229
231 } // namespace extensions 230 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/api/hid/hid_api.cc ('k') | extensions/browser/updater/update_data_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698