| 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/api/sync_error.h" |
| 10 #include "chrome/browser/sync/glue/extension_sync_traits.h" | 11 #include "chrome/browser/sync/glue/extension_sync_traits.h" |
| 11 #include "chrome/browser/sync/glue/model_associator.h" | 12 #include "chrome/browser/sync/glue/model_associator.h" |
| 12 #include "chrome/browser/sync/syncable/model_type.h" | 13 #include "chrome/browser/sync/syncable/model_type.h" |
| 13 | 14 |
| 14 class ExtensionServiceInterface; | 15 class ExtensionServiceInterface; |
| 15 | 16 |
| 16 namespace sync_api { | 17 namespace sync_api { |
| 17 struct UserShare; | 18 struct UserShare; |
| 18 } // namespace sync_api | 19 } // namespace sync_api |
| 19 | 20 |
| 20 namespace browser_sync { | 21 namespace browser_sync { |
| 21 | 22 |
| 22 // Contains all logic for associating the Chrome extensions model and | 23 // Contains all logic for associating the Chrome extensions model and |
| 23 // the sync extensions model. | 24 // the sync extensions model. |
| 24 class ExtensionModelAssociator : public AssociatorInterface { | 25 class ExtensionModelAssociator : public AssociatorInterface { |
| 25 public: | 26 public: |
| 26 // Does not take ownership of |extension_service| or |user_share|. | 27 // Does not take ownership of |extension_service| or |user_share|. |
| 27 ExtensionModelAssociator(ExtensionServiceInterface* extension_service, | 28 ExtensionModelAssociator(ExtensionServiceInterface* extension_service, |
| 28 sync_api::UserShare* user_share); | 29 sync_api::UserShare* user_share); |
| 29 virtual ~ExtensionModelAssociator(); | 30 virtual ~ExtensionModelAssociator(); |
| 30 | 31 |
| 31 // Used by profile_sync_test_util.h. | 32 // Used by profile_sync_test_util.h. |
| 32 static syncable::ModelType model_type() { return syncable::EXTENSIONS; } | 33 static syncable::ModelType model_type() { return syncable::EXTENSIONS; } |
| 33 | 34 |
| 34 // AssociatorInterface implementation. | 35 // AssociatorInterface implementation. |
| 35 virtual bool AssociateModels(); | 36 virtual bool AssociateModels(SyncError* error); |
| 36 virtual bool DisassociateModels(); | 37 virtual bool DisassociateModels(SyncError* error); |
| 37 virtual bool SyncModelHasUserCreatedNodes(bool* has_nodes); | 38 virtual bool SyncModelHasUserCreatedNodes(bool* has_nodes); |
| 38 virtual void AbortAssociation(); | 39 virtual void AbortAssociation(); |
| 39 virtual bool CryptoReadyIfNecessary(); | 40 virtual bool CryptoReadyIfNecessary(); |
| 40 private: | 41 private: |
| 41 const ExtensionSyncTraits traits_; | 42 const ExtensionSyncTraits traits_; |
| 42 ExtensionServiceInterface* const extension_service_; | 43 ExtensionServiceInterface* const extension_service_; |
| 43 sync_api::UserShare* const user_share_; | 44 sync_api::UserShare* const user_share_; |
| 44 | 45 |
| 45 DISALLOW_COPY_AND_ASSIGN(ExtensionModelAssociator); | 46 DISALLOW_COPY_AND_ASSIGN(ExtensionModelAssociator); |
| 46 }; | 47 }; |
| 47 | 48 |
| 48 } // namespace browser_sync | 49 } // namespace browser_sync |
| 49 | 50 |
| 50 #endif // CHROME_BROWSER_SYNC_GLUE_EXTENSION_MODEL_ASSOCIATOR_H_ | 51 #endif // CHROME_BROWSER_SYNC_GLUE_EXTENSION_MODEL_ASSOCIATOR_H_ |
| OLD | NEW |