| 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/manifest_url_handler.h" | 10 #include "chrome/common/extensions/manifest_url_handler.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 25 ExtensionSyncData::ExtensionSyncData(const syncer::SyncData& sync_data) | 25 ExtensionSyncData::ExtensionSyncData(const syncer::SyncData& sync_data) |
| 26 : uninstalled_(false), | 26 : uninstalled_(false), |
| 27 enabled_(false), | 27 enabled_(false), |
| 28 incognito_enabled_(false), | 28 incognito_enabled_(false), |
| 29 remote_install_(false) { | 29 remote_install_(false) { |
| 30 PopulateFromSyncData(sync_data); | 30 PopulateFromSyncData(sync_data); |
| 31 } | 31 } |
| 32 | 32 |
| 33 ExtensionSyncData::ExtensionSyncData(const syncer::SyncChange& sync_change) | 33 ExtensionSyncData::ExtensionSyncData(const syncer::SyncChange& sync_change) |
| 34 : uninstalled_( | 34 : uninstalled_(sync_change.change_type() == |
| 35 sync_change.change_type() == syncer::SyncChange::ACTION_DELETE), | 35 syncer::SyncChange::ACTION_DELETE), |
| 36 enabled_(false), | 36 enabled_(false), |
| 37 incognito_enabled_(false), | 37 incognito_enabled_(false), |
| 38 remote_install_(false) { | 38 remote_install_(false) { |
| 39 PopulateFromSyncData(sync_change.sync_data()); | 39 PopulateFromSyncData(sync_change.sync_data()); |
| 40 } | 40 } |
| 41 | 41 |
| 42 ExtensionSyncData::ExtensionSyncData(const Extension& extension, | 42 ExtensionSyncData::ExtensionSyncData(const Extension& extension, |
| 43 bool enabled, | 43 bool enabled, |
| 44 bool incognito_enabled) | 44 bool incognito_enabled, |
| 45 : id_(extension.id()), | 45 bool remote_install) |
| 46 : id_(extension.id()), |
| 46 uninstalled_(false), | 47 uninstalled_(false), |
| 47 enabled_(enabled), | 48 enabled_(enabled), |
| 48 incognito_enabled_(incognito_enabled), | 49 incognito_enabled_(incognito_enabled), |
| 49 remote_install_(false), | 50 remote_install_(remote_install), |
| 50 version_(extension.from_bookmark() ? base::Version("0") | 51 version_(extension.from_bookmark() ? base::Version("0") |
| 51 : *extension.version()), | 52 : *extension.version()), |
| 52 update_url_(ManifestURL::GetUpdateURL(&extension)), | 53 update_url_(ManifestURL::GetUpdateURL(&extension)), |
| 53 name_(extension.non_localized_name()) { | 54 name_(extension.non_localized_name()) { |
| 54 } | 55 } |
| 55 | 56 |
| 56 ExtensionSyncData::~ExtensionSyncData() {} | 57 ExtensionSyncData::~ExtensionSyncData() {} |
| 57 | 58 |
| 58 syncer::SyncData ExtensionSyncData::GetSyncData() const { | 59 syncer::SyncData ExtensionSyncData::GetSyncData() const { |
| 59 sync_pb::EntitySpecifics specifics; | 60 sync_pb::EntitySpecifics specifics; |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 const sync_pb::EntitySpecifics& entity_specifics = sync_data.GetSpecifics(); | 114 const sync_pb::EntitySpecifics& entity_specifics = sync_data.GetSpecifics(); |
| 114 | 115 |
| 115 if (entity_specifics.has_extension()) { | 116 if (entity_specifics.has_extension()) { |
| 116 PopulateFromExtensionSpecifics(entity_specifics.extension()); | 117 PopulateFromExtensionSpecifics(entity_specifics.extension()); |
| 117 } else { | 118 } else { |
| 118 LOG(FATAL) << "Attempt to sync bad EntitySpecifics."; | 119 LOG(FATAL) << "Attempt to sync bad EntitySpecifics."; |
| 119 } | 120 } |
| 120 } | 121 } |
| 121 | 122 |
| 122 } // namespace extensions | 123 } // namespace extensions |
| OLD | NEW |