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

Unified Diff: chrome/browser/chromeos/login/supervised_user_manager_impl.cc

Issue 132803012: Attempt to recover sync token for managed user once we detected that sync auth fails. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix usage of metrics Created 6 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/chromeos/login/supervised_user_manager_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/login/supervised_user_manager_impl.cc
diff --git a/chrome/browser/chromeos/login/supervised_user_manager_impl.cc b/chrome/browser/chromeos/login/supervised_user_manager_impl.cc
index 15132ea3abba57ed8935ec44f18b2832be45d01a..2c86e238359107494c74ce802ce3101e73ef0cfa 100644
--- a/chrome/browser/chromeos/login/supervised_user_manager_impl.cc
+++ b/chrome/browser/chromeos/login/supervised_user_manager_impl.cc
@@ -4,16 +4,23 @@
#include "chrome/browser/chromeos/login/supervised_user_manager_impl.h"
+#include "base/file_util.h"
+#include "base/files/file_path.h"
#include "base/prefs/pref_registry_simple.h"
#include "base/prefs/pref_service.h"
#include "base/prefs/scoped_user_pref_update.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
+#include "base/threading/sequenced_worker_pool.h"
#include "base/values.h"
#include "chrome/browser/browser_process.h"
+#include "chrome/browser/chromeos/login/managed/locally_managed_user_constants.h"
#include "chrome/browser/chromeos/login/managed/supervised_user_authentication.h"
#include "chrome/browser/chromeos/login/user_manager_impl.h"
+#include "chrome/browser/chromeos/profiles/profile_helper.h"
+#include "chrome/browser/managed_mode/managed_user_service.h"
+#include "chrome/browser/managed_mode/managed_user_service_factory.h"
#include "chromeos/settings/cros_settings_names.h"
#include "content/public/browser/browser_thread.h"
#include "google_apis/gaia/gaia_auth_util.h"
@@ -67,6 +74,16 @@ const char kSupervisedUserPasswordSalt[] =
const char kSupervisedUserPasswordRevision[] =
"SupervisedUserPasswordRevision";
+std::string LoadSyncToken(base::FilePath profile_dir) {
+ std::string token;
+ base::FilePath token_file =
+ profile_dir.Append(chromeos::kManagedUserTokenFilename);
+ VLOG(1) << "Loading" << token_file.value();
+ if (!base::ReadFileToString(token_file, &token))
+ return std::string();
+ return token;
+}
+
} // namespace
namespace chromeos {
@@ -417,4 +434,24 @@ SupervisedUserAuthentication* SupervisedUserManagerImpl::GetAuthentication() {
return authentication_.get();
}
+void SupervisedUserManagerImpl::LoadSupervisedUserToken(
+ Profile* profile,
+ const LoadTokenCallback& callback) {
+ // TODO(antrim): use profile->GetPath() once we sure it is safe.
+ base::FilePath profile_dir = ProfileHelper::GetProfilePathByUserIdHash(
+ UserManager::Get()->GetUserByProfile(profile)->username_hash());
+ PostTaskAndReplyWithResult(
+ content::BrowserThread::GetBlockingPool(),
+ FROM_HERE,
+ base::Bind(&LoadSyncToken, profile_dir),
+ callback);
+}
+
+void SupervisedUserManagerImpl::ConfigureSyncWithToken(
+ Profile* profile,
+ const std::string& token) {
+ if (!token.empty())
+ ManagedUserServiceFactory::GetForProfile(profile)->InitSync(token);
+}
+
} // namespace chromeos
« no previous file with comments | « chrome/browser/chromeos/login/supervised_user_manager_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698