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/supervised_user/child_accounts/child_account_service.h" | 5 #include "chrome/browser/supervised_user/child_accounts/child_account_service.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/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 FROM_HERE, delay, this, &ChildAccountService::StartFetchingFamilyInfo); | 299 FROM_HERE, delay, this, &ChildAccountService::StartFetchingFamilyInfo); |
300 } | 300 } |
301 | 301 |
302 void ChildAccountService::StartFetchingServiceFlags() { | 302 void ChildAccountService::StartFetchingServiceFlags() { |
303 if (!IsChildAccountDetectionEnabled()) { | 303 if (!IsChildAccountDetectionEnabled()) { |
304 SetIsChildAccount(false); | 304 SetIsChildAccount(false); |
305 return; | 305 return; |
306 } | 306 } |
307 account_id_ = SigninManagerFactory::GetForProfile(profile_) | 307 account_id_ = SigninManagerFactory::GetForProfile(profile_) |
308 ->GetAuthenticatedAccountId(); | 308 ->GetAuthenticatedAccountId(); |
| 309 flag_fetcher_.reset(new AccountServiceFlagFetcher( |
| 310 account_id_, |
| 311 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_), |
| 312 profile_->GetRequestContext(), |
| 313 base::Bind(&ChildAccountService::OnFlagsFetched, |
| 314 weak_ptr_factory_.GetWeakPtr()))); |
309 } | 315 } |
310 | 316 |
311 void ChildAccountService::CancelFetchingServiceFlags() { | 317 void ChildAccountService::CancelFetchingServiceFlags() { |
312 flag_fetcher_.reset(); | 318 flag_fetcher_.reset(); |
313 account_id_.clear(); | 319 account_id_.clear(); |
314 flag_fetch_timer_.Stop(); | 320 flag_fetch_timer_.Stop(); |
315 } | 321 } |
316 | 322 |
317 void ChildAccountService::OnFlagsFetched( | 323 void ChildAccountService::OnFlagsFetched( |
318 AccountServiceFlagFetcher::ResultCode result, | 324 AccountServiceFlagFetcher::ResultCode result, |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 command_line->AppendSwitch(switches::kEnableSupervisedUserBlacklist); | 437 command_line->AppendSwitch(switches::kEnableSupervisedUserBlacklist); |
432 | 438 |
433 // Query-based filtering also defaults to enabled. | 439 // Query-based filtering also defaults to enabled. |
434 bool has_enable_safesites = | 440 bool has_enable_safesites = |
435 command_line->HasSwitch(switches::kEnableSupervisedUserSafeSites); | 441 command_line->HasSwitch(switches::kEnableSupervisedUserSafeSites); |
436 bool has_disable_safesites = | 442 bool has_disable_safesites = |
437 command_line->HasSwitch(switches::kDisableSupervisedUserSafeSites); | 443 command_line->HasSwitch(switches::kDisableSupervisedUserSafeSites); |
438 if (!has_enable_safesites && !has_disable_safesites) | 444 if (!has_enable_safesites && !has_disable_safesites) |
439 command_line->AppendSwitch(switches::kEnableSupervisedUserSafeSites); | 445 command_line->AppendSwitch(switches::kEnableSupervisedUserSafeSites); |
440 } | 446 } |
OLD | NEW |