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 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 } | 254 } |
255 | 255 |
256 void ChildAccountService::ScheduleNextFamilyInfoUpdate(base::TimeDelta delay) { | 256 void ChildAccountService::ScheduleNextFamilyInfoUpdate(base::TimeDelta delay) { |
257 family_fetch_timer_.Start( | 257 family_fetch_timer_.Start( |
258 FROM_HERE, delay, this, &ChildAccountService::StartFetchingFamilyInfo); | 258 FROM_HERE, delay, this, &ChildAccountService::StartFetchingFamilyInfo); |
259 } | 259 } |
260 | 260 |
261 void ChildAccountService::StartFetchingServiceFlags() { | 261 void ChildAccountService::StartFetchingServiceFlags() { |
262 account_id_ = SigninManagerFactory::GetForProfile(profile_) | 262 account_id_ = SigninManagerFactory::GetForProfile(profile_) |
263 ->GetAuthenticatedAccountId(); | 263 ->GetAuthenticatedAccountId(); |
| 264 flag_fetcher_.reset(new AccountServiceFlagFetcher( |
| 265 account_id_, |
| 266 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_), |
| 267 profile_->GetRequestContext(), |
| 268 base::Bind(&ChildAccountService::OnFlagsFetched, |
| 269 weak_ptr_factory_.GetWeakPtr()))); |
264 } | 270 } |
265 | 271 |
266 void ChildAccountService::CancelFetchingServiceFlags() { | 272 void ChildAccountService::CancelFetchingServiceFlags() { |
267 flag_fetcher_.reset(); | 273 flag_fetcher_.reset(); |
268 account_id_.clear(); | 274 account_id_.clear(); |
269 flag_fetch_timer_.Stop(); | 275 flag_fetch_timer_.Stop(); |
270 } | 276 } |
271 | 277 |
272 void ChildAccountService::OnFlagsFetched( | 278 void ChildAccountService::OnFlagsFetched( |
273 AccountServiceFlagFetcher::ResultCode result, | 279 AccountServiceFlagFetcher::ResultCode result, |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 command_line->AppendSwitch(switches::kEnableSupervisedUserBlacklist); | 381 command_line->AppendSwitch(switches::kEnableSupervisedUserBlacklist); |
376 | 382 |
377 // Query-based filtering also defaults to enabled. | 383 // Query-based filtering also defaults to enabled. |
378 bool has_enable_safesites = | 384 bool has_enable_safesites = |
379 command_line->HasSwitch(switches::kEnableSupervisedUserSafeSites); | 385 command_line->HasSwitch(switches::kEnableSupervisedUserSafeSites); |
380 bool has_disable_safesites = | 386 bool has_disable_safesites = |
381 command_line->HasSwitch(switches::kDisableSupervisedUserSafeSites); | 387 command_line->HasSwitch(switches::kDisableSupervisedUserSafeSites); |
382 if (!has_enable_safesites && !has_disable_safesites) | 388 if (!has_enable_safesites && !has_disable_safesites) |
383 command_line->AppendSwitch(switches::kEnableSupervisedUserSafeSites); | 389 command_line->AppendSwitch(switches::kEnableSupervisedUserSafeSites); |
384 } | 390 } |
OLD | NEW |