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

Side by Side Diff: components/wifi_sync/wifi_config_delegate_chromeos.cc

Issue 2463463004: [Sync] Rename wifi_sync to sync_wifi. (Closed)
Patch Set: Created 4 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "components/wifi_sync/wifi_config_delegate_chromeos.h"
6
7 #include <memory>
8
9 #include "base/bind.h"
10 #include "base/logging.h"
11 #include "base/values.h"
12 #include "chromeos/network/managed_network_configuration_handler.h"
13 #include "components/wifi_sync/wifi_credential.h"
14
15 namespace wifi_sync {
16
17 namespace {
18
19 void OnCreateConfigurationFailed(
20 const WifiCredential& wifi_credential,
21 const std::string& config_handler_error_message,
22 std::unique_ptr<base::DictionaryValue> error_data) {
23 LOG(ERROR) << "Create configuration failed";
24 // TODO(quiche): check if there is a matching network already. If
25 // so, try to configure it with |wifi_credential|.
26 }
27
28 } // namespace
29
30 WifiConfigDelegateChromeOs::WifiConfigDelegateChromeOs(
31 const std::string& user_hash,
32 chromeos::ManagedNetworkConfigurationHandler* managed_net_config_handler)
33 : user_hash_(user_hash),
34 managed_network_configuration_handler_(managed_net_config_handler) {
35 DCHECK(!user_hash_.empty());
36 DCHECK(managed_network_configuration_handler_);
37 }
38
39 WifiConfigDelegateChromeOs::~WifiConfigDelegateChromeOs() {
40 }
41
42 void WifiConfigDelegateChromeOs::AddToLocalNetworks(
43 const WifiCredential& network_credential) {
44 std::unique_ptr<base::DictionaryValue> onc_properties(
45 network_credential.ToOncProperties());
46 // TODO(quiche): Replace with DCHECK, once ONC supports non-UTF-8 SSIDs.
47 // crbug.com/432546
48 if (!onc_properties) {
49 LOG(ERROR) << "Failed to generate ONC properties for "
50 << network_credential.ToString();
51 return;
52 }
53
54 managed_network_configuration_handler_->CreateConfiguration(
55 user_hash_, *onc_properties,
56 chromeos::network_handler::ServiceResultCallback(),
57 base::Bind(OnCreateConfigurationFailed, network_credential));
58 }
59
60 } // namespace wifi_sync
OLDNEW
« no previous file with comments | « components/wifi_sync/wifi_config_delegate_chromeos.h ('k') | components/wifi_sync/wifi_config_delegate_chromeos_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698