OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "components/wifi_sync/wifi_config_delegate_chromeos.h" |
| 6 |
| 7 #include "base/bind.h" |
| 8 #include "base/logging.h" |
| 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/values.h" |
| 11 #include "chromeos/network/managed_network_configuration_handler.h" |
| 12 #include "components/wifi_sync/network_state_helper_chromeos.h" |
| 13 #include "components/wifi_sync/wifi_credential.h" |
| 14 |
| 15 namespace wifi_sync { |
| 16 |
| 17 namespace { |
| 18 |
| 19 void DoNothingWithString(const std::string& arg) {} |
| 20 |
| 21 void OnCreateConfigurationFailed( |
| 22 const WifiCredential& wifi_credential, |
| 23 const std::string& config_handler_error_message, |
| 24 scoped_ptr<base::DictionaryValue> error_data) { |
| 25 LOG(ERROR) << "Create configuration failed"; |
| 26 // TODO(quiche): check if there is a matching network already. If |
| 27 // so, try to configure it with |wifi_credential|. |
| 28 } |
| 29 |
| 30 } // namespace |
| 31 |
| 32 WifiConfigDelegateChromeOs::WifiConfigDelegateChromeOs( |
| 33 const std::string& user_hash, |
| 34 chromeos::ManagedNetworkConfigurationHandler* managed_net_config_handler) |
| 35 : user_hash_(user_hash), |
| 36 managed_network_configuration_handler_(managed_net_config_handler) { |
| 37 DCHECK(!user_hash_.empty()); |
| 38 DCHECK(managed_network_configuration_handler_); |
| 39 } |
| 40 |
| 41 WifiConfigDelegateChromeOs::~WifiConfigDelegateChromeOs() { |
| 42 } |
| 43 |
| 44 void WifiConfigDelegateChromeOs::AddToLocalNetworks( |
| 45 const WifiCredential& network_credential) { |
| 46 CreateWifiNetworkInShillUserProfile( |
| 47 managed_network_configuration_handler_, |
| 48 user_hash_, |
| 49 network_credential, |
| 50 base::Bind(DoNothingWithString), // success_callback |
| 51 base::Bind(OnCreateConfigurationFailed, network_credential)); |
| 52 } |
| 53 |
| 54 } // namespace wifi_sync |
OLD | NEW |