| 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 "components/user_manager/fake_user_manager.h" | 5 #include "components/user_manager/fake_user_manager.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/sys_info.h" | 9 #include "base/sys_info.h" |
| 10 #include "base/task_runner.h" | 10 #include "base/task_runner.h" |
| 11 #include "chromeos/chromeos_switches.h" | 11 #include "chromeos/chromeos_switches.h" |
| 12 #include "chromeos/login/user_names.h" | 12 #include "components/user_manager/user_names.h" |
| 13 #include "components/user_manager/user_type.h" | 13 #include "components/user_manager/user_type.h" |
| 14 | 14 |
| 15 namespace { | 15 namespace { |
| 16 | 16 |
| 17 class FakeTaskRunner : public base::TaskRunner { | 17 class FakeTaskRunner : public base::TaskRunner { |
| 18 public: | 18 public: |
| 19 bool PostDelayedTask(const tracked_objects::Location& from_here, | 19 bool PostDelayedTask(const tracked_objects::Location& from_here, |
| 20 const base::Closure& task, | 20 const base::Closure& task, |
| 21 base::TimeDelta delay) override { | 21 base::TimeDelta delay) override { |
| 22 task.Run(); | 22 task.Run(); |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 | 275 |
| 276 PrefService* FakeUserManager::GetLocalState() const { | 276 PrefService* FakeUserManager::GetLocalState() const { |
| 277 return nullptr; | 277 return nullptr; |
| 278 } | 278 } |
| 279 | 279 |
| 280 bool FakeUserManager::IsEnterpriseManaged() const { | 280 bool FakeUserManager::IsEnterpriseManaged() const { |
| 281 return false; | 281 return false; |
| 282 } | 282 } |
| 283 | 283 |
| 284 bool FakeUserManager::IsDemoApp(const AccountId& account_id) const { | 284 bool FakeUserManager::IsDemoApp(const AccountId& account_id) const { |
| 285 return account_id == chromeos::login::DemoAccountId(); | 285 return account_id == DemoAccountId(); |
| 286 } | 286 } |
| 287 | 287 |
| 288 bool FakeUserManager::IsDeviceLocalAccountMarkedForRemoval( | 288 bool FakeUserManager::IsDeviceLocalAccountMarkedForRemoval( |
| 289 const AccountId& account_id) const { | 289 const AccountId& account_id) const { |
| 290 return false; | 290 return false; |
| 291 } | 291 } |
| 292 | 292 |
| 293 void FakeUserManager::UpdateLoginState(const user_manager::User* active_user, | 293 void FakeUserManager::UpdateLoginState(const user_manager::User* active_user, |
| 294 const user_manager::User* primary_user, | 294 const user_manager::User* primary_user, |
| 295 bool is_current_user_owner) const {} | 295 bool is_current_user_owner) const {} |
| 296 | 296 |
| 297 bool FakeUserManager::GetPlatformKnownUserId(const std::string& user_email, | 297 bool FakeUserManager::GetPlatformKnownUserId(const std::string& user_email, |
| 298 const std::string& gaia_id, | 298 const std::string& gaia_id, |
| 299 AccountId* out_account_id) const { | 299 AccountId* out_account_id) const { |
| 300 if (user_email == chromeos::login::kStubUser) { | 300 if (user_email == kStubUser) { |
| 301 *out_account_id = chromeos::login::StubAccountId(); | 301 *out_account_id = StubAccountId(); |
| 302 return true; | 302 return true; |
| 303 } | 303 } |
| 304 | 304 |
| 305 if (user_email == chromeos::login::kGuestUserName) { | 305 if (user_email == kGuestUserName) { |
| 306 *out_account_id = chromeos::login::GuestAccountId(); | 306 *out_account_id = GuestAccountId(); |
| 307 return true; | 307 return true; |
| 308 } | 308 } |
| 309 return false; | 309 return false; |
| 310 } | 310 } |
| 311 | 311 |
| 312 const AccountId& FakeUserManager::GetGuestAccountId() const { | 312 const AccountId& FakeUserManager::GetGuestAccountId() const { |
| 313 return chromeos::login::GuestAccountId(); | 313 return GuestAccountId(); |
| 314 } | 314 } |
| 315 | 315 |
| 316 bool FakeUserManager::IsFirstExecAfterBoot() const { | 316 bool FakeUserManager::IsFirstExecAfterBoot() const { |
| 317 return base::CommandLine::ForCurrentProcess()->HasSwitch( | 317 return base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 318 chromeos::switches::kFirstExecAfterBoot); | 318 chromeos::switches::kFirstExecAfterBoot); |
| 319 } | 319 } |
| 320 | 320 |
| 321 void FakeUserManager::AsyncRemoveCryptohome(const AccountId& account_id) const { | 321 void FakeUserManager::AsyncRemoveCryptohome(const AccountId& account_id) const { |
| 322 NOTIMPLEMENTED(); | 322 NOTIMPLEMENTED(); |
| 323 } | 323 } |
| 324 | 324 |
| 325 bool FakeUserManager::IsGuestAccountId(const AccountId& account_id) const { | 325 bool FakeUserManager::IsGuestAccountId(const AccountId& account_id) const { |
| 326 return account_id == chromeos::login::GuestAccountId(); | 326 return account_id == GuestAccountId(); |
| 327 } | 327 } |
| 328 | 328 |
| 329 bool FakeUserManager::IsStubAccountId(const AccountId& account_id) const { | 329 bool FakeUserManager::IsStubAccountId(const AccountId& account_id) const { |
| 330 return account_id == chromeos::login::StubAccountId(); | 330 return account_id == StubAccountId(); |
| 331 } | 331 } |
| 332 | 332 |
| 333 bool FakeUserManager::IsSupervisedAccountId(const AccountId& account_id) const { | 333 bool FakeUserManager::IsSupervisedAccountId(const AccountId& account_id) const { |
| 334 return false; | 334 return false; |
| 335 } | 335 } |
| 336 | 336 |
| 337 bool FakeUserManager::HasBrowserRestarted() const { | 337 bool FakeUserManager::HasBrowserRestarted() const { |
| 338 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 338 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 339 return base::SysInfo::IsRunningOnChromeOS() && | 339 return base::SysInfo::IsRunningOnChromeOS() && |
| 340 command_line->HasSwitch(chromeos::switches::kLoginUser); | 340 command_line->HasSwitch(chromeos::switches::kLoginUser); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 356 NOTIMPLEMENTED(); | 356 NOTIMPLEMENTED(); |
| 357 return; | 357 return; |
| 358 } | 358 } |
| 359 | 359 |
| 360 bool FakeUserManager::IsValidDefaultUserImageId(int image_index) const { | 360 bool FakeUserManager::IsValidDefaultUserImageId(int image_index) const { |
| 361 NOTIMPLEMENTED(); | 361 NOTIMPLEMENTED(); |
| 362 return false; | 362 return false; |
| 363 } | 363 } |
| 364 | 364 |
| 365 } // namespace user_manager | 365 } // namespace user_manager |
| OLD | NEW |