| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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_EXTENSION_MODEL_ASSOCIATOR_H_ | 5 #ifndef CHROME_BROWSER_SYNC_GLUE_EXTENSION_MODEL_ASSOCIATOR_H_ |
| 6 #define CHROME_BROWSER_SYNC_GLUE_EXTENSION_MODEL_ASSOCIATOR_H_ | 6 #define CHROME_BROWSER_SYNC_GLUE_EXTENSION_MODEL_ASSOCIATOR_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "chrome/browser/sync/glue/extension_sync_traits.h" | 10 #include "chrome/browser/sync/glue/extension_sync_traits.h" |
| 11 #include "chrome/browser/sync/glue/model_associator.h" | 11 #include "chrome/browser/sync/glue/model_associator.h" |
| 12 #include "chrome/browser/sync/syncable/model_type.h" | 12 #include "chrome/browser/sync/syncable/model_type.h" |
| 13 | 13 |
| 14 class ExtensionServiceInterface; | 14 class ExtensionServiceInterface; |
| 15 | 15 |
| 16 namespace sync_api { | 16 namespace sync_api { |
| 17 struct UserShare; | 17 struct UserShare; |
| 18 } // namespace sync_api | 18 } // namespace sync_api |
| 19 | 19 |
| 20 namespace browser_sync { | 20 namespace browser_sync { |
| 21 | 21 |
| 22 // Contains all logic for associating the Chrome extensions model and | 22 // Contains all logic for associating the Chrome extensions model and |
| 23 // the sync extensions model. | 23 // the sync extensions model. |
| 24 class ExtensionModelAssociator : public AssociatorInterface { | 24 class ExtensionModelAssociator |
| 25 : public NewAssociatorInterface { |
| 25 public: | 26 public: |
| 26 // Does not take ownership of sync_service. | 27 // Does not take ownership of sync_service. |
| 27 ExtensionModelAssociator(const ExtensionSyncTraits& traits, | 28 ExtensionModelAssociator(const ExtensionSyncTraits& traits, |
| 28 ExtensionServiceInterface* extension_service, | 29 ExtensionServiceInterface* extension_service, |
| 29 sync_api::UserShare* user_share); | 30 sync_api::UserShare* user_share); |
| 30 virtual ~ExtensionModelAssociator(); | |
| 31 | 31 |
| 32 // Used by profile_sync_test_util.h. | 32 // Used by profile_sync_test_util.h. |
| 33 static syncable::ModelType model_type() { return syncable::EXTENSIONS; } | |
| 34 | 33 |
| 35 // AssociatorInterface implementation. | 34 // AssociatorInterface implementation. |
| 36 virtual bool AssociateModels(); | 35 virtual bool AssociateModels(); |
| 37 virtual bool DisassociateModels(); | 36 virtual bool DisassociateModels(); |
| 38 virtual bool SyncModelHasUserCreatedNodes(bool* has_nodes); | 37 virtual bool SyncModelHasUserCreatedNodes(bool* has_nodes); |
| 39 virtual void AbortAssociation() { | 38 virtual void AbortAssociation() { |
| 40 // No implementation needed, this associator runs on the main | 39 // No implementation needed, this associator runs on the main |
| 41 // thread. | 40 // thread. |
| 42 } | 41 } |
| 43 virtual bool CryptoReadyIfNecessary(); | 42 virtual bool CryptoReadyIfNecessary(); |
| 44 private: | 43 private: |
| 44 virtual ~ExtensionModelAssociator(); |
| 45 |
| 45 const ExtensionSyncTraits traits_; | 46 const ExtensionSyncTraits traits_; |
| 46 ExtensionServiceInterface* const extension_service_; | 47 ExtensionServiceInterface* const extension_service_; |
| 47 sync_api::UserShare* const user_share_; | 48 sync_api::UserShare* const user_share_; |
| 48 | 49 |
| 49 DISALLOW_COPY_AND_ASSIGN(ExtensionModelAssociator); | 50 DISALLOW_COPY_AND_ASSIGN(ExtensionModelAssociator); |
| 50 }; | 51 }; |
| 51 | 52 |
| 52 } // namespace browser_sync | 53 } // namespace browser_sync |
| 53 | 54 |
| 54 #endif // CHROME_BROWSER_SYNC_GLUE_EXTENSION_MODEL_ASSOCIATOR_H_ | 55 #endif // CHROME_BROWSER_SYNC_GLUE_EXTENSION_MODEL_ASSOCIATOR_H_ |
| OLD | NEW |