| 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_sync_data_type_controll
er.h" | 5 #include "chrome/browser/supervised_user/supervised_user_sync_data_type_controll
er.h" |
| 6 | 6 |
| 7 #include "chrome/browser/profiles/profile.h" | 7 #include "chrome/browser/profiles/profile.h" |
| 8 #include "chrome/browser/supervised_user/supervised_user_service.h" | |
| 9 #include "chrome/browser/supervised_user/supervised_user_service_factory.h" | |
| 10 #include "chrome/browser/sync/glue/chrome_report_unrecoverable_error.h" | 8 #include "chrome/browser/sync/glue/chrome_report_unrecoverable_error.h" |
| 11 #include "content/public/browser/browser_thread.h" | 9 #include "content/public/browser/browser_thread.h" |
| 12 | 10 |
| 13 SupervisedUserSyncDataTypeController::SupervisedUserSyncDataTypeController( | 11 SupervisedUserSyncDataTypeController::SupervisedUserSyncDataTypeController( |
| 14 syncer::ModelType type, | 12 syncer::ModelType type, |
| 15 sync_driver::SyncApiComponentFactory* sync_factory, | 13 sync_driver::SyncApiComponentFactory* sync_factory, |
| 16 Profile* profile) | 14 Profile* profile) |
| 17 : sync_driver::UIDataTypeController( | 15 : sync_driver::UIDataTypeController( |
| 18 content::BrowserThread::GetMessageLoopProxyForThread( | 16 content::BrowserThread::GetMessageLoopProxyForThread( |
| 19 content::BrowserThread::UI), | 17 content::BrowserThread::UI), |
| 20 base::Bind(&browser_sync::ChromeReportUnrecoverableError), | 18 base::Bind(&browser_sync::ChromeReportUnrecoverableError), |
| 21 type, | 19 type, |
| 22 sync_factory), | 20 sync_factory), |
| 23 profile_(profile) { | 21 profile_(profile) { |
| 24 DCHECK(type == syncer::SUPERVISED_USERS || | 22 DCHECK(type == syncer::SUPERVISED_USERS || |
| 25 type == syncer::SUPERVISED_USER_SETTINGS || | 23 type == syncer::SUPERVISED_USER_SETTINGS || |
| 26 type == syncer::SUPERVISED_USER_SHARED_SETTINGS); | 24 type == syncer::SUPERVISED_USER_SHARED_SETTINGS); |
| 27 } | 25 } |
| 28 | 26 |
| 29 SupervisedUserSyncDataTypeController::~SupervisedUserSyncDataTypeController() {} | 27 SupervisedUserSyncDataTypeController::~SupervisedUserSyncDataTypeController() {} |
| 30 | 28 |
| 31 bool SupervisedUserSyncDataTypeController::ReadyForStart() const { | 29 bool SupervisedUserSyncDataTypeController::ReadyForStart() const { |
| 32 switch (type()) { | 30 switch (type()) { |
| 33 case syncer::SUPERVISED_USERS: | 31 case syncer::SUPERVISED_USERS: |
| 34 return !profile_->IsSupervised(); | 32 return !profile_->IsSupervised(); |
| 35 case syncer::SUPERVISED_USER_SETTINGS: | 33 case syncer::SUPERVISED_USER_SETTINGS: |
| 36 return profile_->IsSupervised(); | 34 return profile_->IsSupervised(); |
| 37 case syncer::SUPERVISED_USER_SHARED_SETTINGS: | 35 case syncer::SUPERVISED_USER_SHARED_SETTINGS: |
| 38 return !SupervisedUserServiceFactory::GetForProfile(profile_) | 36 return !profile_->IsChild(); |
| 39 ->IsChildAccount(); | |
| 40 default: | 37 default: |
| 41 NOTREACHED(); | 38 NOTREACHED(); |
| 42 } | 39 } |
| 43 return false; | 40 return false; |
| 44 } | 41 } |
| OLD | NEW |