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