| 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 "base/metrics/histogram_macros.h" | 8 #include "base/metrics/histogram_macros.h" |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 | 234 |
| 235 bool ExtensionSyncData::PopulateFromExtensionSpecifics( | 235 bool ExtensionSyncData::PopulateFromExtensionSpecifics( |
| 236 const sync_pb::ExtensionSpecifics& specifics) { | 236 const sync_pb::ExtensionSpecifics& specifics) { |
| 237 if (!crx_file::id_util::IdIsValid(specifics.id())) { | 237 if (!crx_file::id_util::IdIsValid(specifics.id())) { |
| 238 LOG(ERROR) << "Attempt to sync bad ExtensionSpecifics (bad ID):\n" | 238 LOG(ERROR) << "Attempt to sync bad ExtensionSpecifics (bad ID):\n" |
| 239 << GetExtensionSpecificsLogMessage(specifics); | 239 << GetExtensionSpecificsLogMessage(specifics); |
| 240 RecordBadSyncData(BAD_EXTENSION_ID); | 240 RecordBadSyncData(BAD_EXTENSION_ID); |
| 241 return false; | 241 return false; |
| 242 } | 242 } |
| 243 | 243 |
| 244 Version specifics_version(specifics.version()); | 244 base::Version specifics_version(specifics.version()); |
| 245 if (!specifics_version.IsValid()) { | 245 if (!specifics_version.IsValid()) { |
| 246 LOG(ERROR) << "Attempt to sync bad ExtensionSpecifics (bad version):\n" | 246 LOG(ERROR) << "Attempt to sync bad ExtensionSpecifics (bad version):\n" |
| 247 << GetExtensionSpecificsLogMessage(specifics); | 247 << GetExtensionSpecificsLogMessage(specifics); |
| 248 RecordBadSyncData(BAD_VERSION); | 248 RecordBadSyncData(BAD_VERSION); |
| 249 return false; | 249 return false; |
| 250 } | 250 } |
| 251 | 251 |
| 252 // The update URL must be either empty or valid. | 252 // The update URL must be either empty or valid. |
| 253 GURL specifics_update_url(specifics.update_url()); | 253 GURL specifics_update_url(specifics.update_url()); |
| 254 if (!specifics_update_url.is_empty() && !specifics_update_url.is_valid()) { | 254 if (!specifics_update_url.is_empty() && !specifics_update_url.is_valid()) { |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 | 320 |
| 321 if (entity_specifics.has_extension()) | 321 if (entity_specifics.has_extension()) |
| 322 return PopulateFromExtensionSpecifics(entity_specifics.extension()); | 322 return PopulateFromExtensionSpecifics(entity_specifics.extension()); |
| 323 | 323 |
| 324 LOG(ERROR) << "Attempt to sync bad EntitySpecifics: no extension data."; | 324 LOG(ERROR) << "Attempt to sync bad EntitySpecifics: no extension data."; |
| 325 RecordBadSyncData(NO_EXTENSION_SPECIFICS); | 325 RecordBadSyncData(NO_EXTENSION_SPECIFICS); |
| 326 return false; | 326 return false; |
| 327 } | 327 } |
| 328 | 328 |
| 329 } // namespace extensions | 329 } // namespace extensions |
| OLD | NEW |