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

Side by Side Diff: chrome/browser/sync/test/integration/wifi_credentials_helper_chromeos.cc

Issue 1882243004: Convert //chrome/browser/sync from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address feedback Created 4 years, 8 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
« no previous file with comments | « chrome/browser/sync/test/integration/wifi_credentials_helper.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/sync/test/integration/wifi_credentials_helper_chromeos. h" 5 #include "chrome/browser/sync/test/integration/wifi_credentials_helper_chromeos. h"
6 6
7 #include <memory>
7 #include <string> 8 #include <string>
8 9
9 #include "base/bind.h" 10 #include "base/bind.h"
10 #include "base/files/file_path.h" 11 #include "base/files/file_path.h"
11 #include "base/logging.h" 12 #include "base/logging.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "base/message_loop/message_loop.h" 13 #include "base/message_loop/message_loop.h"
14 #include "base/strings/stringprintf.h" 14 #include "base/strings/stringprintf.h"
15 #include "base/values.h" 15 #include "base/values.h"
16 #include "chromeos/dbus/dbus_thread_manager.h" 16 #include "chromeos/dbus/dbus_thread_manager.h"
17 #include "chromeos/dbus/shill_profile_client.h" 17 #include "chromeos/dbus/shill_profile_client.h"
18 #include "chromeos/network/managed_network_configuration_handler.h" 18 #include "chromeos/network/managed_network_configuration_handler.h"
19 #include "chromeos/network/network_handler.h" 19 #include "chromeos/network/network_handler.h"
20 #include "chromeos/network/network_state_handler.h" 20 #include "chromeos/network/network_state_handler.h"
21 #include "components/onc/onc_constants.h" 21 #include "components/onc/onc_constants.h"
22 #include "components/wifi_sync/network_state_helper_chromeos.h" 22 #include "components/wifi_sync/network_state_helper_chromeos.h"
23 #include "components/wifi_sync/wifi_credential_syncable_service_factory.h" 23 #include "components/wifi_sync/wifi_credential_syncable_service_factory.h"
24 #include "content/public/browser/browser_context.h" 24 #include "content/public/browser/browser_context.h"
25 25
26 using wifi_sync::WifiCredential; 26 using wifi_sync::WifiCredential;
27 27
28 using WifiCredentialSet = wifi_sync::WifiCredential::CredentialSet; 28 using WifiCredentialSet = wifi_sync::WifiCredential::CredentialSet;
29 29
30 namespace wifi_credentials_helper { 30 namespace wifi_credentials_helper {
31 31
32 namespace { 32 namespace {
33 33
34 const char kProfilePrefix[] = "/profile/"; 34 const char kProfilePrefix[] = "/profile/";
35 35
36 void LogCreateConfigurationFailure( 36 void LogCreateConfigurationFailure(
37 const std::string& debug_hint, 37 const std::string& debug_hint,
38 const std::string& /* network_config_error_message */, 38 const std::string& /* network_config_error_message */,
39 scoped_ptr<base::DictionaryValue> /* network_config_error_data */) { 39 std::unique_ptr<base::DictionaryValue> /* network_config_error_data */) {
40 LOG(FATAL) << debug_hint; 40 LOG(FATAL) << debug_hint;
41 } 41 }
42 42
43 std::string ChromeOsUserHashForBrowserContext( 43 std::string ChromeOsUserHashForBrowserContext(
44 const content::BrowserContext& context) { 44 const content::BrowserContext& context) {
45 return context.GetPath().BaseName().value(); 45 return context.GetPath().BaseName().value();
46 } 46 }
47 47
48 // Return value is distinct per |context|, but otherwise arbitrary. 48 // Return value is distinct per |context|, but otherwise arbitrary.
49 std::string ShillProfilePathForBrowserContext( 49 std::string ShillProfilePathForBrowserContext(
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 ->SetPolicy(onc::ONC_SOURCE_UNKNOWN, 95 ->SetPolicy(onc::ONC_SOURCE_UNKNOWN,
96 ChromeOsUserHashForBrowserContext(*browser_context), 96 ChromeOsUserHashForBrowserContext(*browser_context),
97 policy_network_configs, 97 policy_network_configs,
98 policy_global_config); 98 policy_global_config);
99 } 99 }
100 100
101 void AddWifiCredentialToProfileChromeOs( 101 void AddWifiCredentialToProfileChromeOs(
102 const content::BrowserContext* browser_context, 102 const content::BrowserContext* browser_context,
103 const WifiCredential& credential) { 103 const WifiCredential& credential) {
104 DCHECK(browser_context); 104 DCHECK(browser_context);
105 scoped_ptr<base::DictionaryValue> onc_properties = 105 std::unique_ptr<base::DictionaryValue> onc_properties =
106 credential.ToOncProperties(); 106 credential.ToOncProperties();
107 CHECK(onc_properties) << "Failed to generate ONC properties for " 107 CHECK(onc_properties) << "Failed to generate ONC properties for "
108 << credential.ToString(); 108 << credential.ToString();
109 GetManagedNetworkConfigurationHandler()->CreateConfiguration( 109 GetManagedNetworkConfigurationHandler()->CreateConfiguration(
110 ChromeOsUserHashForBrowserContext(*browser_context), *onc_properties, 110 ChromeOsUserHashForBrowserContext(*browser_context), *onc_properties,
111 ::chromeos::network_handler::ServiceResultCallback(), 111 ::chromeos::network_handler::ServiceResultCallback(),
112 base::Bind(LogCreateConfigurationFailure, 112 base::Bind(LogCreateConfigurationFailure,
113 base::StringPrintf("Failed to add credential %s", 113 base::StringPrintf("Failed to add credential %s",
114 credential.ToString().c_str()))); 114 credential.ToString().c_str())));
115 base::MessageLoop::current()->RunUntilIdle(); 115 base::MessageLoop::current()->RunUntilIdle();
116 } 116 }
117 117
118 WifiCredentialSet GetWifiCredentialsForProfileChromeOs( 118 WifiCredentialSet GetWifiCredentialsForProfileChromeOs(
119 const content::BrowserContext* browser_context) { 119 const content::BrowserContext* browser_context) {
120 DCHECK(browser_context); 120 DCHECK(browser_context);
121 return wifi_sync::GetWifiCredentialsForShillProfile( 121 return wifi_sync::GetWifiCredentialsForShillProfile(
122 GetNetworkStateHandler(), 122 GetNetworkStateHandler(),
123 ShillProfilePathForBrowserContext(*browser_context)); 123 ShillProfilePathForBrowserContext(*browser_context));
124 } 124 }
125 125
126 } // namespace chromeos 126 } // namespace chromeos
127 127
128 } // namespace wifi_credentials_helper 128 } // namespace wifi_credentials_helper
OLDNEW
« no previous file with comments | « chrome/browser/sync/test/integration/wifi_credentials_helper.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698