Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Side by Side Diff: chrome/browser/sync/glue/extension_setting_data_type_controller.cc

Issue 7775008: Enable sync for the settings from the Extension Settings API. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Review #1 Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/sync/glue/extension_setting_data_type_controller.h"
6
7 #include "base/metrics/histogram.h"
8 #include "chrome/browser/sync/api/syncable_service.h"
9 #include "chrome/browser/sync/glue/generic_change_processor.h"
10 #include "content/browser/browser_thread.h"
11
12 namespace browser_sync {
13
14 ExtensionSettingDataTypeController::ExtensionSettingDataTypeController(
15 ProfileSyncFactory* profile_sync_factory,
16 Profile* profile,
17 ProfileSyncService* profile_sync_service)
18 : NonFrontendDataTypeController(profile_sync_factory, profile),
19 profile_sync_service_(profile_sync_service) {}
20
21 ExtensionSettingDataTypeController::~ExtensionSettingDataTypeController() {}
22
23 syncable::ModelType ExtensionSettingDataTypeController::type() const {
24 return syncable::EXTENSION_SETTINGS;
25 }
26
27 browser_sync::ModelSafeGroup
28 ExtensionSettingDataTypeController::model_safe_group() const {
29 return browser_sync::GROUP_FILE;
30 }
31
32 bool ExtensionSettingDataTypeController::StartModels() {
33 return true;
34 }
35
36 bool ExtensionSettingDataTypeController::StartAssociationAsync() {
37 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
38 DCHECK_EQ(state(), ASSOCIATING);
39 BrowserThread::PostTask(
akalin 2011/09/15 19:56:44 if (!PostTask) { NOTREACHED(); }
not at google - send to devlin 2011/09/16 05:18:59 Done.
40 BrowserThread::FILE,
41 FROM_HERE,
42 base::Bind(&ExtensionSettingDataTypeController::StartAssociation, this));
43 return true;
44 }
45
46 void ExtensionSettingDataTypeController::CreateSyncComponents() {
47 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
48 DCHECK_EQ(state(), ASSOCIATING);
49 ProfileSyncFactory::SyncComponents sync_components =
50 profile_sync_factory()->CreateExtensionSettingSyncComponents(
51 profile_sync_service_, this);
52 set_model_associator(sync_components.model_associator);
53 set_change_processor(sync_components.change_processor);
54 }
55
56 bool ExtensionSettingDataTypeController::StopAssociationAsync() {
57 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
58 DCHECK_EQ(state(), STOPPING);
59 BrowserThread::PostTask(
akalin 2011/09/15 19:56:44 if (!PostTask()) { NOTREACHED(); }
not at google - send to devlin 2011/09/16 05:18:59 Done.
60 BrowserThread::FILE,
61 FROM_HERE,
62 base::Bind(&ExtensionSettingDataTypeController::StopAssociation, this));
63 return true;
64 }
65
66 void ExtensionSettingDataTypeController::RecordUnrecoverableError(
67 const tracked_objects::Location& from_here,
68 const std::string& message) {
69 UMA_HISTOGRAM_COUNTS("Sync.ExtensionSettingRunFailures", 1);
70 }
71
72 void ExtensionSettingDataTypeController::RecordAssociationTime(
73 base::TimeDelta time) {
74 UMA_HISTOGRAM_TIMES("Sync.ExtensionSettingAssociationTime", time);
75 }
76
77 void ExtensionSettingDataTypeController::RecordStartFailure(
78 StartResult result) {
79 UMA_HISTOGRAM_ENUMERATION(
80 "Sync.ExtensionSettingStartFailures", result, MAX_START_RESULT);
81 }
82
83 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698