| OLD | NEW |
| 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/chromeos/login/users/supervised_user_manager_impl.h" | 5 #include "chrome/browser/chromeos/login/users/supervised_user_manager_impl.h" |
| 6 | 6 |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| 11 #include "base/strings/stringprintf.h" | 11 #include "base/strings/stringprintf.h" |
| 12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
| 13 #include "base/threading/sequenced_worker_pool.h" | 13 #include "base/task_scheduler/post_task.h" |
| 14 #include "base/values.h" | 14 #include "base/values.h" |
| 15 #include "chrome/browser/browser_process.h" | 15 #include "chrome/browser/browser_process.h" |
| 16 #include "chrome/browser/chromeos/login/supervised/supervised_user_authenticatio
n.h" | 16 #include "chrome/browser/chromeos/login/supervised/supervised_user_authenticatio
n.h" |
| 17 #include "chrome/browser/chromeos/login/supervised/supervised_user_constants.h" | 17 #include "chrome/browser/chromeos/login/supervised/supervised_user_constants.h" |
| 18 #include "chrome/browser/chromeos/login/users/chrome_user_manager_impl.h" | 18 #include "chrome/browser/chromeos/login/users/chrome_user_manager_impl.h" |
| 19 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 19 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 20 #include "chrome/browser/supervised_user/supervised_user_service.h" | 20 #include "chrome/browser/supervised_user/supervised_user_service.h" |
| 21 #include "chrome/browser/supervised_user/supervised_user_service_factory.h" | 21 #include "chrome/browser/supervised_user/supervised_user_service_factory.h" |
| 22 #include "chromeos/settings/cros_settings_names.h" | 22 #include "chromeos/settings/cros_settings_names.h" |
| 23 #include "components/prefs/pref_registry_simple.h" | 23 #include "components/prefs/pref_registry_simple.h" |
| (...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 509 return authentication_.get(); | 509 return authentication_.get(); |
| 510 } | 510 } |
| 511 | 511 |
| 512 void SupervisedUserManagerImpl::LoadSupervisedUserToken( | 512 void SupervisedUserManagerImpl::LoadSupervisedUserToken( |
| 513 Profile* profile, | 513 Profile* profile, |
| 514 const LoadTokenCallback& callback) { | 514 const LoadTokenCallback& callback) { |
| 515 // TODO(antrim): use profile->GetPath() once we sure it is safe. | 515 // TODO(antrim): use profile->GetPath() once we sure it is safe. |
| 516 base::FilePath profile_dir = ProfileHelper::GetProfilePathByUserIdHash( | 516 base::FilePath profile_dir = ProfileHelper::GetProfilePathByUserIdHash( |
| 517 ProfileHelper::Get()->GetUserByProfile(profile)->username_hash()); | 517 ProfileHelper::Get()->GetUserByProfile(profile)->username_hash()); |
| 518 PostTaskAndReplyWithResult( | 518 PostTaskAndReplyWithResult( |
| 519 content::BrowserThread::GetBlockingPool() | 519 base::CreateTaskRunnerWithTraits( |
| 520 ->GetTaskRunnerWithShutdownBehavior( | 520 base::TaskTraits() |
| 521 base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN) | 521 .MayBlock() |
| 522 .WithPriority(base::TaskPriority::BACKGROUND) |
| 523 .WithShutdownBehavior( |
| 524 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN)) |
| 522 .get(), | 525 .get(), |
| 523 FROM_HERE, base::Bind(&LoadSyncToken, profile_dir), callback); | 526 FROM_HERE, base::Bind(&LoadSyncToken, profile_dir), callback); |
| 524 } | 527 } |
| 525 | 528 |
| 526 void SupervisedUserManagerImpl::ConfigureSyncWithToken( | 529 void SupervisedUserManagerImpl::ConfigureSyncWithToken( |
| 527 Profile* profile, | 530 Profile* profile, |
| 528 const std::string& token) { | 531 const std::string& token) { |
| 529 if (!token.empty()) | 532 if (!token.empty()) |
| 530 SupervisedUserServiceFactory::GetForProfile(profile)->InitSync(token); | 533 SupervisedUserServiceFactory::GetForProfile(profile)->InitSync(token); |
| 531 } | 534 } |
| 532 | 535 |
| 533 } // namespace chromeos | 536 } // namespace chromeos |
| OLD | NEW |