| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/sync/glue/extension_util.h" | 5 #include "chrome/browser/sync/glue/extension_util.h" |
| 6 | 6 |
| 7 #include <sstream> | 7 #include <sstream> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/scoped_ptr.h" | 10 #include "base/scoped_ptr.h" |
| 11 #include "base/stl_util-inl.h" | 11 #include "base/stl_util-inl.h" |
| 12 #include "base/version.h" | 12 #include "base/version.h" |
| 13 #include "chrome/browser/extensions/extension_prefs.h" | 13 #include "chrome/browser/extensions/extension_prefs.h" |
| 14 #include "chrome/browser/extensions/extensions_service.h" | 14 #include "chrome/browser/extensions/extension_service.h" |
| 15 #include "chrome/browser/sync/protocol/extension_specifics.pb.h" | 15 #include "chrome/browser/sync/protocol/extension_specifics.pb.h" |
| 16 #include "chrome/common/extensions/extension.h" | 16 #include "chrome/common/extensions/extension.h" |
| 17 #include "chrome/common/extensions/extension_constants.h" | 17 #include "chrome/common/extensions/extension_constants.h" |
| 18 #include "googleurl/src/gurl.h" | 18 #include "googleurl/src/gurl.h" |
| 19 | 19 |
| 20 namespace browser_sync { | 20 namespace browser_sync { |
| 21 | 21 |
| 22 ExtensionType GetExtensionType(const Extension& extension) { | 22 ExtensionType GetExtensionType(const Extension& extension) { |
| 23 if (extension.is_theme()) { | 23 if (extension.is_theme()) { |
| 24 return THEME; | 24 return THEME; |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 Version::GetVersionFromString(specifics.version())); | 223 Version::GetVersionFromString(specifics.version())); |
| 224 if (!specifics_version.get()) { | 224 if (!specifics_version.get()) { |
| 225 // If version is invalid, assume we're up-to-date. | 225 // If version is invalid, assume we're up-to-date. |
| 226 return false; | 226 return false; |
| 227 } | 227 } |
| 228 return extension.version()->CompareTo(*specifics_version) < 0; | 228 return extension.version()->CompareTo(*specifics_version) < 0; |
| 229 } | 229 } |
| 230 | 230 |
| 231 void SetExtensionProperties( | 231 void SetExtensionProperties( |
| 232 const sync_pb::ExtensionSpecifics& specifics, | 232 const sync_pb::ExtensionSpecifics& specifics, |
| 233 ExtensionsService* extensions_service, const Extension* extension) { | 233 ExtensionService* extensions_service, const Extension* extension) { |
| 234 DcheckIsExtensionSpecificsValid(specifics); | 234 DcheckIsExtensionSpecificsValid(specifics); |
| 235 CHECK(extensions_service); | 235 CHECK(extensions_service); |
| 236 CHECK(extension); | 236 CHECK(extension); |
| 237 DCHECK(IsExtensionValid(*extension)); | 237 DCHECK(IsExtensionValid(*extension)); |
| 238 const std::string& id = extension->id(); | 238 const std::string& id = extension->id(); |
| 239 GURL update_url(specifics.update_url()); | 239 GURL update_url(specifics.update_url()); |
| 240 if (update_url != extension->update_url()) { | 240 if (update_url != extension->update_url()) { |
| 241 LOG(WARNING) << "specifics for extension " << id | 241 LOG(WARNING) << "specifics for extension " << id |
| 242 << "has a different update URL than the extension: " | 242 << "has a different update URL than the extension: " |
| 243 << update_url.spec() << " vs. " << extension->update_url(); | 243 << update_url.spec() << " vs. " << extension->update_url(); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 // |specifics| has a more recent or the same version, so merge it | 279 // |specifics| has a more recent or the same version, so merge it |
| 280 // in. | 280 // in. |
| 281 CopyNonUserProperties(specifics, merged_specifics); | 281 CopyNonUserProperties(specifics, merged_specifics); |
| 282 if (merge_user_properties) { | 282 if (merge_user_properties) { |
| 283 CopyUserProperties(specifics, merged_specifics); | 283 CopyUserProperties(specifics, merged_specifics); |
| 284 } | 284 } |
| 285 } | 285 } |
| 286 } | 286 } |
| 287 | 287 |
| 288 } // namespace browser_sync | 288 } // namespace browser_sync |
| OLD | NEW |