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