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()->network_state_handler()); |
| 38 return chromeos::NetworkHandler::Get()->network_state_handler(); |
| 39 } |
| 40 |
| 41 } // namespace |
| 42 |
| 43 WifiCredentialSet GetWifiCredentialsForProfileChromeOs(const Profile* profile) { |
| 44 DCHECK(profile); |
| 45 return wifi_sync::GetWifiCredentialsForShillProfile( |
| 46 GetNetworkStateHandler(), ShillProfilePathForBrowserContext(*profile)); |
| 47 } |
| 48 |
| 49 } // namespace wifi_credentials_helper |
OLD | NEW |