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/supervised_user_service.h" | 5 #include "chrome/browser/supervised_user/supervised_user_service.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
11 #include "base/strings/string_number_conversions.h" | 11 #include "base/strings/string_number_conversions.h" |
12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
13 #include "chrome/browser/browser_process.h" | 13 #include "chrome/browser/browser_process.h" |
| 14 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
14 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
15 #include "chrome/browser/profiles/profile_info_cache.h" | 16 #include "chrome/browser/profiles/profile_info_cache.h" |
16 #include "chrome/browser/profiles/profile_manager.h" | 17 #include "chrome/browser/profiles/profile_manager.h" |
17 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 18 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
18 #include "chrome/browser/signin/signin_manager_factory.h" | 19 #include "chrome/browser/signin/signin_manager_factory.h" |
19 #include "chrome/browser/supervised_user/custodian_profile_downloader_service.h" | 20 #include "chrome/browser/supervised_user/custodian_profile_downloader_service.h" |
20 #include "chrome/browser/supervised_user/custodian_profile_downloader_service_fa
ctory.h" | 21 #include "chrome/browser/supervised_user/custodian_profile_downloader_service_fa
ctory.h" |
21 #include "chrome/browser/supervised_user/experimental/supervised_user_blacklist_
downloader.h" | 22 #include "chrome/browser/supervised_user/experimental/supervised_user_blacklist_
downloader.h" |
22 #include "chrome/browser/supervised_user/permission_request_creator_apiary.h" | 23 #include "chrome/browser/supervised_user/permission_request_creator_apiary.h" |
23 #include "chrome/browser/supervised_user/permission_request_creator_sync.h" | 24 #include "chrome/browser/supervised_user/permission_request_creator_sync.h" |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 result.Put(syncer::EXTENSIONS); | 449 result.Put(syncer::EXTENSIONS); |
449 result.Put(syncer::EXTENSION_SETTINGS); | 450 result.Put(syncer::EXTENSION_SETTINGS); |
450 result.Put(syncer::APPS); | 451 result.Put(syncer::APPS); |
451 result.Put(syncer::APP_SETTINGS); | 452 result.Put(syncer::APP_SETTINGS); |
452 result.Put(syncer::APP_NOTIFICATIONS); | 453 result.Put(syncer::APP_NOTIFICATIONS); |
453 result.Put(syncer::APP_LIST); | 454 result.Put(syncer::APP_LIST); |
454 return result; | 455 return result; |
455 } | 456 } |
456 | 457 |
457 void SupervisedUserService::OnHistoryRecordingStateChanged() { | 458 void SupervisedUserService::OnHistoryRecordingStateChanged() { |
458 includes_sync_sessions_type_ = | 459 bool record_history = |
459 profile_->GetPrefs()->GetBoolean(prefs::kRecordHistory); | 460 profile_->GetPrefs()->GetBoolean(prefs::kRecordHistory); |
| 461 GetSettingsService()->SetLocalSetting( |
| 462 supervised_users::kAllowDeletingBrowserHistory, |
| 463 make_scoped_ptr(new base::FundamentalValue(!record_history))); |
| 464 GetSettingsService()->SetLocalSetting( |
| 465 supervised_users::kIncognitoModeAvailability, |
| 466 make_scoped_ptr(new base::FundamentalValue( |
| 467 record_history ? IncognitoModePrefs::DISABLED |
| 468 : IncognitoModePrefs::ENABLED))); |
| 469 |
| 470 includes_sync_sessions_type_ = record_history; |
460 ProfileSyncServiceFactory::GetForProfile(profile_) | 471 ProfileSyncServiceFactory::GetForProfile(profile_) |
461 ->ReconfigureDatatypeManager(); | 472 ->ReconfigureDatatypeManager(); |
462 } | 473 } |
463 | 474 |
464 bool SupervisedUserService::IncludesSyncSessionsType() const { | 475 bool SupervisedUserService::IncludesSyncSessionsType() const { |
465 return includes_sync_sessions_type_; | 476 return includes_sync_sessions_type_; |
466 } | 477 } |
467 | 478 |
468 void SupervisedUserService::OnStateChanged() { | 479 void SupervisedUserService::OnStateChanged() { |
469 ProfileSyncService* service = | 480 ProfileSyncService* service = |
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
996 // The active user can be NULL in unit tests. | 1007 // The active user can be NULL in unit tests. |
997 if (user_manager::UserManager::Get()->GetActiveUser()) { | 1008 if (user_manager::UserManager::Get()->GetActiveUser()) { |
998 return UTF16ToUTF8(user_manager::UserManager::Get()->GetUserDisplayName( | 1009 return UTF16ToUTF8(user_manager::UserManager::Get()->GetUserDisplayName( |
999 user_manager::UserManager::Get()->GetActiveUser()->GetUserID())); | 1010 user_manager::UserManager::Get()->GetActiveUser()->GetUserID())); |
1000 } | 1011 } |
1001 return std::string(); | 1012 return std::string(); |
1002 #else | 1013 #else |
1003 return profile_->GetPrefs()->GetString(prefs::kProfileName); | 1014 return profile_->GetPrefs()->GetString(prefs::kProfileName); |
1004 #endif | 1015 #endif |
1005 } | 1016 } |
OLD | NEW |