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_settings_service.h" | 5 #include "chrome/browser/supervised_user/supervised_user_settings_service.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "base/json/json_reader.h" | 11 #include "base/json/json_reader.h" |
12 #include "base/json/json_writer.h" | 12 #include "base/json/json_writer.h" |
| 13 #include "base/metrics/histogram.h" |
13 #include "base/prefs/json_pref_store.h" | 14 #include "base/prefs/json_pref_store.h" |
14 #include "base/prefs/pref_filter.h" | 15 #include "base/prefs/pref_filter.h" |
15 #include "base/strings/string_util.h" | 16 #include "base/strings/string_util.h" |
16 #include "base/threading/sequenced_worker_pool.h" | 17 #include "base/threading/sequenced_worker_pool.h" |
17 #include "chrome/browser/supervised_user/supervised_user_url_filter.h" | 18 #include "chrome/browser/supervised_user/supervised_user_url_filter.h" |
18 #include "chrome/common/chrome_constants.h" | 19 #include "chrome/common/chrome_constants.h" |
19 #include "content/public/browser/browser_thread.h" | 20 #include "content/public/browser/browser_thread.h" |
20 #include "content/public/browser/user_metrics.h" | 21 #include "content/public/browser/user_metrics.h" |
21 #include "sync/api/sync_change.h" | 22 #include "sync/api/sync_change.h" |
22 #include "sync/api/sync_error_factory.h" | 23 #include "sync/api/sync_error_factory.h" |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 | 231 |
231 SyncMergeResult result(SUPERVISED_USER_SETTINGS); | 232 SyncMergeResult result(SUPERVISED_USER_SETTINGS); |
232 // Process all the accumulated changes from the queued items. | 233 // Process all the accumulated changes from the queued items. |
233 if (change_list.size() > 0) { | 234 if (change_list.size() > 0) { |
234 store_->ReportValueChanged(kQueuedItems, | 235 store_->ReportValueChanged(kQueuedItems, |
235 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); | 236 WriteablePrefStore::DEFAULT_PREF_WRITE_FLAGS); |
236 result.set_error( | 237 result.set_error( |
237 sync_processor_->ProcessSyncChanges(FROM_HERE, change_list)); | 238 sync_processor_->ProcessSyncChanges(FROM_HERE, change_list)); |
238 } | 239 } |
239 | 240 |
240 // TODO(bauerb): Statistics? | 241 UMA_HISTOGRAM_ENUMERATION("SupervisedUserSettingService.SyncMergeResult", |
| 242 result.model_type(), syncer::MODEL_TYPE_COUNT); |
| 243 |
241 return result; | 244 return result; |
242 } | 245 } |
243 | 246 |
244 void SupervisedUserSettingsService::StopSyncing(ModelType type) { | 247 void SupervisedUserSettingsService::StopSyncing(ModelType type) { |
245 DCHECK_EQ(syncer::SUPERVISED_USER_SETTINGS, type); | 248 DCHECK_EQ(syncer::SUPERVISED_USER_SETTINGS, type); |
246 sync_processor_.reset(); | 249 sync_processor_.reset(); |
247 error_handler_.reset(); | 250 error_handler_.reset(); |
248 } | 251 } |
249 | 252 |
250 SyncDataList SupervisedUserSettingsService::GetAllSyncData( | 253 SyncDataList SupervisedUserSettingsService::GetAllSyncData( |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 return settings; | 413 return settings; |
411 } | 414 } |
412 | 415 |
413 void SupervisedUserSettingsService::InformSubscribers() { | 416 void SupervisedUserSettingsService::InformSubscribers() { |
414 if (!IsReady()) | 417 if (!IsReady()) |
415 return; | 418 return; |
416 | 419 |
417 scoped_ptr<base::DictionaryValue> settings = GetSettings(); | 420 scoped_ptr<base::DictionaryValue> settings = GetSettings(); |
418 callback_list_.Notify(settings.get()); | 421 callback_list_.Notify(settings.get()); |
419 } | 422 } |
OLD | NEW |