| 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 #include "chrome/browser/extensions/extension_sync_data.h" | 5 #include "chrome/browser/extensions/extension_sync_data.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "chrome/browser/extensions/app_sync_data.h" | 8 #include "chrome/browser/extensions/app_sync_data.h" |
| 9 #include "chrome/browser/extensions/extension_service.h" | 9 #include "chrome/browser/extensions/extension_service.h" |
| 10 #include "chrome/common/extensions/api/extension_urls/extension_urls_handler.h" |
| 10 #include "chrome/common/extensions/extension.h" | 11 #include "chrome/common/extensions/extension.h" |
| 11 #include "sync/api/sync_data.h" | 12 #include "sync/api/sync_data.h" |
| 12 #include "sync/protocol/extension_specifics.pb.h" | 13 #include "sync/protocol/extension_specifics.pb.h" |
| 13 #include "sync/protocol/sync.pb.h" | 14 #include "sync/protocol/sync.pb.h" |
| 14 | 15 |
| 15 namespace extensions { | 16 namespace extensions { |
| 16 | 17 |
| 17 ExtensionSyncData::ExtensionSyncData() | 18 ExtensionSyncData::ExtensionSyncData() |
| 18 : uninstalled_(false), | 19 : uninstalled_(false), |
| 19 enabled_(false), | 20 enabled_(false), |
| (...skipping 16 matching lines...) Expand all Loading... |
| 36 } | 37 } |
| 37 | 38 |
| 38 ExtensionSyncData::ExtensionSyncData(const Extension& extension, | 39 ExtensionSyncData::ExtensionSyncData(const Extension& extension, |
| 39 bool enabled, | 40 bool enabled, |
| 40 bool incognito_enabled) | 41 bool incognito_enabled) |
| 41 : id_(extension.id()), | 42 : id_(extension.id()), |
| 42 uninstalled_(false), | 43 uninstalled_(false), |
| 43 enabled_(enabled), | 44 enabled_(enabled), |
| 44 incognito_enabled_(incognito_enabled), | 45 incognito_enabled_(incognito_enabled), |
| 45 version_(*extension.version()), | 46 version_(*extension.version()), |
| 46 update_url_(extension.update_url()), | 47 update_url_(ExtensionURL::GetUpdateURL(&extension)), |
| 47 name_(extension.non_localized_name()) { | 48 name_(extension.non_localized_name()) { |
| 48 } | 49 } |
| 49 | 50 |
| 50 ExtensionSyncData::~ExtensionSyncData() {} | 51 ExtensionSyncData::~ExtensionSyncData() {} |
| 51 | 52 |
| 52 syncer::SyncData ExtensionSyncData::GetSyncData() const { | 53 syncer::SyncData ExtensionSyncData::GetSyncData() const { |
| 53 sync_pb::EntitySpecifics specifics; | 54 sync_pb::EntitySpecifics specifics; |
| 54 PopulateExtensionSpecifics(specifics.mutable_extension()); | 55 PopulateExtensionSpecifics(specifics.mutable_extension()); |
| 55 | 56 |
| 56 return syncer::SyncData::CreateLocalData(id_, name_, specifics); | 57 return syncer::SyncData::CreateLocalData(id_, name_, specifics); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 const sync_pb::EntitySpecifics& entity_specifics = sync_data.GetSpecifics(); | 106 const sync_pb::EntitySpecifics& entity_specifics = sync_data.GetSpecifics(); |
| 106 | 107 |
| 107 if (entity_specifics.has_extension()) { | 108 if (entity_specifics.has_extension()) { |
| 108 PopulateFromExtensionSpecifics(entity_specifics.extension()); | 109 PopulateFromExtensionSpecifics(entity_specifics.extension()); |
| 109 } else { | 110 } else { |
| 110 LOG(FATAL) << "Attempt to sync bad EntitySpecifics."; | 111 LOG(FATAL) << "Attempt to sync bad EntitySpecifics."; |
| 111 } | 112 } |
| 112 } | 113 } |
| 113 | 114 |
| 114 } // namespace extensions | 115 } // namespace extensions |
| OLD | NEW |