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()))); | |
270 } | 264 } |
271 | 265 |
272 void ChildAccountService::CancelFetchingServiceFlags() { | 266 void ChildAccountService::CancelFetchingServiceFlags() { |
273 flag_fetcher_.reset(); | 267 flag_fetcher_.reset(); |
274 account_id_.clear(); | 268 account_id_.clear(); |
275 flag_fetch_timer_.Stop(); | 269 flag_fetch_timer_.Stop(); |
276 } | 270 } |
277 | 271 |
278 void ChildAccountService::OnFlagsFetched( | 272 void ChildAccountService::OnFlagsFetched( |
279 AccountServiceFlagFetcher::ResultCode result, | 273 AccountServiceFlagFetcher::ResultCode result, |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 command_line->AppendSwitch(switches::kEnableSupervisedUserBlacklist); | 375 command_line->AppendSwitch(switches::kEnableSupervisedUserBlacklist); |
382 | 376 |
383 // Query-based filtering also defaults to enabled. | 377 // Query-based filtering also defaults to enabled. |
384 bool has_enable_safesites = | 378 bool has_enable_safesites = |
385 command_line->HasSwitch(switches::kEnableSupervisedUserSafeSites); | 379 command_line->HasSwitch(switches::kEnableSupervisedUserSafeSites); |
386 bool has_disable_safesites = | 380 bool has_disable_safesites = |
387 command_line->HasSwitch(switches::kDisableSupervisedUserSafeSites); | 381 command_line->HasSwitch(switches::kDisableSupervisedUserSafeSites); |
388 if (!has_enable_safesites && !has_disable_safesites) | 382 if (!has_enable_safesites && !has_disable_safesites) |
389 command_line->AppendSwitch(switches::kEnableSupervisedUserSafeSites); | 383 command_line->AppendSwitch(switches::kEnableSupervisedUserSafeSites); |
390 } | 384 } |
OLD | NEW |