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

Unified Diff: chrome/browser/sync/test/integration/wifi_credentials_helper_chromeos.cc

Issue 709683004: components: add wifi_sync component (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@submit-1-security-class
Patch Set: fix android_aosp build Created 6 years 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/sync/test/integration/wifi_credentials_helper_chromeos.cc
diff --git a/chrome/browser/sync/test/integration/wifi_credentials_helper_chromeos.cc b/chrome/browser/sync/test/integration/wifi_credentials_helper_chromeos.cc
new file mode 100644
index 0000000000000000000000000000000000000000..8e5400247c21808abee5edcbbdf3b236208d1440
--- /dev/null
+++ b/chrome/browser/sync/test/integration/wifi_credentials_helper_chromeos.cc
@@ -0,0 +1,49 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/sync/test/integration/wifi_credentials_helper_chromeos.h"
+
+#include <string>
+
+#include "base/files/file_path.h"
+#include "base/logging.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chromeos/network/network_handler.h"
+#include "chromeos/network/network_state.h"
+#include "chromeos/network/network_state_handler.h"
+#include "components/wifi_sync/network_state_helper_chromeos.h"
+#include "components/wifi_sync/wifi_security_class.h"
+
+using WifiCredentialSet = wifi_sync::WifiCredential::CredentialSet;
+
+namespace wifi_credentials_helper {
+
+namespace {
+
+const char kProfilePrefix[] = "/profile/";
+
+std::string ChromeOsUserHashForBrowserContext(
+ const content::BrowserContext& context) {
+ return context.GetPath().BaseName().value();
+}
+
+std::string ShillProfilePathForBrowserContext(
+ const content::BrowserContext& context) {
+ return kProfilePrefix + ChromeOsUserHashForBrowserContext(context);
+}
+
+chromeos::NetworkStateHandler* GetNetworkStateHandler() {
+ DCHECK(chromeos::NetworkHandler::Get()->network_state_handler());
+ return chromeos::NetworkHandler::Get()->network_state_handler();
+}
+
+} // namespace
+
+WifiCredentialSet GetWifiCredentialsForProfileChromeOs(const Profile* profile) {
+ DCHECK(profile);
+ return wifi_sync::GetWifiCredentialsForShillProfile(
+ GetNetworkStateHandler(), ShillProfilePathForBrowserContext(*profile));
+}
+
+} // namespace wifi_credentials_helper
« no previous file with comments | « chrome/browser/sync/test/integration/wifi_credentials_helper_chromeos.h ('k') | chrome/chrome_browser_chromeos.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698