OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/api/networking_private/networking_private_ch
romeos.h" | 5 #include "chrome/browser/extensions/api/networking_private/networking_private_ch
romeos.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 10 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 NetworkHandler::Get()->network_device_handler()->GetWifiTDLSStatus( | 276 NetworkHandler::Get()->network_device_handler()->GetWifiTDLSStatus( |
277 ip_or_mac_address, | 277 ip_or_mac_address, |
278 success_callback, | 278 success_callback, |
279 base::Bind(&NetworkHandlerFailureCallback, failure_callback)); | 279 base::Bind(&NetworkHandlerFailureCallback, failure_callback)); |
280 } | 280 } |
281 | 281 |
282 void NetworkingPrivateChromeOS::GetCaptivePortalStatus( | 282 void NetworkingPrivateChromeOS::GetCaptivePortalStatus( |
283 const std::string& guid, | 283 const std::string& guid, |
284 const StringCallback& success_callback, | 284 const StringCallback& success_callback, |
285 const FailureCallback& failure_callback) { | 285 const FailureCallback& failure_callback) { |
286 chromeos::NetworkPortalDetector* detector = | 286 if (!chromeos::NetworkPortalDetector::IsInitialized()) { |
287 chromeos::NetworkPortalDetector::Get(); | |
288 if (!detector) { | |
289 failure_callback.Run(networking_private::kErrorNotReady); | 287 failure_callback.Run(networking_private::kErrorNotReady); |
290 return; | 288 return; |
291 } | 289 } |
292 | 290 |
293 chromeos::NetworkPortalDetector::CaptivePortalState state = | 291 chromeos::NetworkPortalDetector::CaptivePortalState state = |
294 detector->GetCaptivePortalState(guid); | 292 chromeos::NetworkPortalDetector::Get()->GetCaptivePortalState(guid); |
295 success_callback.Run( | 293 success_callback.Run( |
296 chromeos::NetworkPortalDetector::CaptivePortalStatusString(state.status)); | 294 chromeos::NetworkPortalDetector::CaptivePortalStatusString(state.status)); |
297 } | 295 } |
298 | 296 |
299 scoped_ptr<base::ListValue> | 297 scoped_ptr<base::ListValue> |
300 NetworkingPrivateChromeOS::GetEnabledNetworkTypes() { | 298 NetworkingPrivateChromeOS::GetEnabledNetworkTypes() { |
301 chromeos::NetworkStateHandler* state_handler = GetStateHandler(); | 299 chromeos::NetworkStateHandler* state_handler = GetStateHandler(); |
302 | 300 |
303 scoped_ptr<base::ListValue> network_list(new base::ListValue); | 301 scoped_ptr<base::ListValue> network_list(new base::ListValue); |
304 | 302 |
(...skipping 28 matching lines...) Expand all Loading... |
333 | 331 |
334 return true; | 332 return true; |
335 } | 333 } |
336 | 334 |
337 bool NetworkingPrivateChromeOS::RequestScan() { | 335 bool NetworkingPrivateChromeOS::RequestScan() { |
338 GetStateHandler()->RequestScan(); | 336 GetStateHandler()->RequestScan(); |
339 return true; | 337 return true; |
340 } | 338 } |
341 | 339 |
342 } // namespace extensions | 340 } // namespace extensions |
OLD | NEW |