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

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

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

Powered by Google App Engine
This is Rietveld 408576698