| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef CHROME_BROWSER_SYNC_GLUE_NEW_NON_FRONTEND_DATA_TYPE_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_SYNC_GLUE_NEW_NON_FRONTEND_DATA_TYPE_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_SYNC_GLUE_NEW_NON_FRONTEND_DATA_TYPE_CONTROLLER_H_ | 6 #define CHROME_BROWSER_SYNC_GLUE_NEW_NON_FRONTEND_DATA_TYPE_CONTROLLER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| 11 #include "chrome/browser/sync/glue/non_frontend_data_type_controller.h" | 11 #include "chrome/browser/sync/glue/non_frontend_data_type_controller.h" |
| 12 #include "chrome/browser/sync/glue/shared_change_processor.h" | 12 #include "chrome/browser/sync/glue/shared_change_processor.h" |
| 13 | 13 |
| 14 namespace { |
| 14 class SyncableService; | 15 class SyncableService; |
| 16 } |
| 15 | 17 |
| 16 namespace browser_sync { | 18 namespace browser_sync { |
| 17 | 19 |
| 18 class NewNonFrontendDataTypeController : public NonFrontendDataTypeController { | 20 class NewNonFrontendDataTypeController : public NonFrontendDataTypeController { |
| 19 public: | 21 public: |
| 20 NewNonFrontendDataTypeController( | 22 NewNonFrontendDataTypeController( |
| 21 ProfileSyncComponentsFactory* profile_sync_factory, | 23 ProfileSyncComponentsFactory* profile_sync_factory, |
| 22 Profile* profile, | 24 Profile* profile, |
| 23 ProfileSyncService* sync_service); | 25 ProfileSyncService* sync_service); |
| 24 | 26 |
| 25 // DataTypeController interface. | 27 // DataTypeController interface. |
| 26 virtual void LoadModels( | 28 virtual void LoadModels( |
| 27 const ModelLoadCallback& model_load_callback) OVERRIDE; | 29 const ModelLoadCallback& model_load_callback) OVERRIDE; |
| 28 virtual void StartAssociating(const StartCallback& start_callback) OVERRIDE; | 30 virtual void StartAssociating(const StartCallback& start_callback) OVERRIDE; |
| 29 | 31 |
| 30 virtual void Stop() OVERRIDE; | 32 virtual void Stop() OVERRIDE; |
| 31 | 33 |
| 32 protected: | 34 protected: |
| 33 friend class NewNonFrontendDataTypeControllerMock; | 35 friend class NewNonFrontendDataTypeControllerMock; |
| 34 | 36 |
| 35 NewNonFrontendDataTypeController(); | 37 NewNonFrontendDataTypeController(); |
| 36 virtual ~NewNonFrontendDataTypeController(); | 38 virtual ~NewNonFrontendDataTypeController(); |
| 37 | 39 |
| 38 // DataTypeController interface. | 40 // DataTypeController interface. |
| 39 virtual void OnModelLoaded() OVERRIDE; | 41 virtual void OnModelLoaded() OVERRIDE; |
| 40 | 42 |
| 41 // Overrides of NonFrontendDataTypeController methods. | 43 // Overrides of NonFrontendDataTypeController methods. |
| 42 virtual void StartDone(DataTypeController::StartResult result, | 44 virtual void StartDone(DataTypeController::StartResult result, |
| 43 DataTypeController::State new_state, | 45 DataTypeController::State new_state, |
| 44 const SyncError& error) OVERRIDE; | 46 const csync::SyncError& error) OVERRIDE; |
| 45 virtual void StartDoneImpl(DataTypeController::StartResult result, | 47 virtual void StartDoneImpl(DataTypeController::StartResult result, |
| 46 DataTypeController::State new_state, | 48 DataTypeController::State new_state, |
| 47 const SyncError& error) OVERRIDE; | 49 const csync::SyncError& error) OVERRIDE; |
| 48 | 50 |
| 49 private: | 51 private: |
| 50 // This overrides the same method in |NonFrontendDataTypeController|. | 52 // This overrides the same method in |NonFrontendDataTypeController|. |
| 51 virtual bool StartAssociationAsync() OVERRIDE; | 53 virtual bool StartAssociationAsync() OVERRIDE; |
| 52 | 54 |
| 53 // Posted on the backend thread by StartAssociationAsync(). | 55 // Posted on the backend thread by StartAssociationAsync(). |
| 54 void StartAssociationWithSharedChangeProcessor( | 56 void StartAssociationWithSharedChangeProcessor( |
| 55 const scoped_refptr<SharedChangeProcessor>& shared_change_processor); | 57 const scoped_refptr<SharedChangeProcessor>& shared_change_processor); |
| 56 | 58 |
| 57 // Calls Disconnect() on |shared_change_processor_|, then sets it to | 59 // Calls Disconnect() on |shared_change_processor_|, then sets it to |
| (...skipping 26 matching lines...) Expand all Loading... |
| 84 // backend thread may still have references to it (which is okay, | 86 // backend thread may still have references to it (which is okay, |
| 85 // since we call Disconnect() before releasing the UI thread | 87 // since we call Disconnect() before releasing the UI thread |
| 86 // reference). | 88 // reference). |
| 87 scoped_refptr<SharedChangeProcessor> shared_change_processor_; | 89 scoped_refptr<SharedChangeProcessor> shared_change_processor_; |
| 88 | 90 |
| 89 // A weak pointer to the actual local syncable service, which performs all the | 91 // A weak pointer to the actual local syncable service, which performs all the |
| 90 // real work. We do not own the object, and it is only safe to access on the | 92 // real work. We do not own the object, and it is only safe to access on the |
| 91 // DataType's thread. | 93 // DataType's thread. |
| 92 // Lifetime: it gets set in StartAssociation() and released in | 94 // Lifetime: it gets set in StartAssociation() and released in |
| 93 // StopLocalService(). | 95 // StopLocalService(). |
| 94 base::WeakPtr<SyncableService> local_service_; | 96 base::WeakPtr<csync::SyncableService> local_service_; |
| 95 }; | 97 }; |
| 96 | 98 |
| 97 } // namespace browser_sync | 99 } // namespace browser_sync |
| 98 | 100 |
| 99 #endif // CHROME_BROWSER_SYNC_GLUE_NEW_NON_FRONTEND_DATA_TYPE_CONTROLLER_H_ | 101 #endif // CHROME_BROWSER_SYNC_GLUE_NEW_NON_FRONTEND_DATA_TYPE_CONTROLLER_H_ |
| OLD | NEW |