Chromium Code Reviews| 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 "chrome/browser/sync/test/integration/wifi_credentials_helper_chromeos. h" | |
| 6 | |
| 7 #include <string> | |
| 8 | |
| 9 #include "base/files/file_path.h" | |
| 10 #include "base/logging.h" | |
| 11 #include "chrome/browser/profiles/profile.h" | |
| 12 #include "chromeos/network/network_handler.h" | |
| 13 #include "chromeos/network/network_state.h" | |
| 14 #include "chromeos/network/network_state_handler.h" | |
| 15 #include "components/wifi_sync/network_state_helper_chromeos.h" | |
| 16 #include "components/wifi_sync/wifi_security_class.h" | |
| 17 | |
| 18 using WifiCredentialSet = wifi_sync::WifiCredential::CredentialSet; | |
| 19 | |
| 20 namespace wifi_credentials_helper { | |
| 21 | |
| 22 namespace { | |
| 23 | |
| 24 const char kProfilePrefix[] = "/profile/"; | |
| 25 | |
| 26 std::string ChromeOsUserHashForBrowserContext( | |
| 27 const content::BrowserContext& context) { | |
| 28 return context.GetPath().BaseName().value(); | |
| 29 } | |
| 30 | |
| 31 std::string ShillProfilePathForBrowserContext( | |
| 32 const content::BrowserContext& context) { | |
| 33 return kProfilePrefix + ChromeOsUserHashForBrowserContext(context); | |
| 34 } | |
| 35 | |
| 36 chromeos::NetworkStateHandler* GetNetworkStateHandler() { | |
| 37 DCHECK(chromeos::NetworkHandler::Get()); | |
| 38 DCHECK(chromeos::NetworkHandler::Get()->network_state_handler()); | |
|
stevenjb
2014/12/05 20:28:17
Get() asserts if not initialized. You can use Netw
mukesh agrawal
2014/12/05 23:48:10
Done.
I've taken "don't need either check" to mea
| |
| 39 return chromeos::NetworkHandler::Get()->network_state_handler(); | |
| 40 } | |
| 41 | |
| 42 } // namespace | |
| 43 | |
| 44 WifiCredentialSet GetWifiCredentialsForProfileChromeOs(const Profile* profile) { | |
| 45 DCHECK(profile); | |
| 46 return wifi_sync::GetWifiCredentialsForShillProfile( | |
| 47 GetNetworkStateHandler(), ShillProfilePathForBrowserContext(*profile)); | |
| 48 } | |
| 49 | |
| 50 } // namespace wifi_credentials_helper | |
| OLD | NEW |