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/app_data_type_controller.h" 6 7 #include "base/metrics/histogram.h" 8 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/sync/profile_sync_factory.h" 10 11 namespace browser_sync { 12 13 AppDataTypeController::AppDataTypeController( 14 ProfileSyncFactory* profile_sync_factory, 15 Profile* profile, 16 ProfileSyncService* sync_service) 17 : FrontendDataTypeController(profile_sync_factory, 18 profile, 19 sync_service) { 20 } 21 22 AppDataTypeController::~AppDataTypeController() { 23 } 24 25 syncable::ModelType AppDataTypeController::type() const { 26 return syncable::APPS; 27 } 28 29 bool AppDataTypeController::StartModels() { 30 profile_->InitExtensions(true); 31 return true; 32 } 33 34 void AppDataTypeController::CreateSyncComponents() { 35 ProfileSyncFactory::SyncComponents sync_components = 36 profile_sync_factory_->CreateAppSyncComponents(sync_service_, 37 this); 38 model_associator_.reset(sync_components.model_associator); 39 change_processor_.reset(sync_components.change_processor); 40 } 41 42 void AppDataTypeController::RecordUnrecoverableError( 43 const tracked_objects::Location& from_here, 44 const std::string& message) { 45 UMA_HISTOGRAM_COUNTS("Sync.AppRunFailures", 1); 46 } 47 48 void AppDataTypeController::RecordAssociationTime(base::TimeDelta time) { 49 UMA_HISTOGRAM_TIMES("Sync.AppAssociationTime", time); 50 } 51 52 void AppDataTypeController::RecordStartFailure(StartResult result) { 53 UMA_HISTOGRAM_ENUMERATION("Sync.AppStartFailures", 54 result, 55 MAX_START_RESULT); 56 } 57 58 } // namespace browser_sync 59