| 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_model_associator.h" | 5 #include "chrome/browser/sync/glue/extension_model_associator.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 specifics, extension_specifics)) | 378 specifics, extension_specifics)) |
| 379 << ExtensionSpecificsToString(specifics) << ", " | 379 << ExtensionSpecificsToString(specifics) << ", " |
| 380 << ExtensionSpecificsToString(extension_specifics); | 380 << ExtensionSpecificsToString(extension_specifics); |
| 381 } | 381 } |
| 382 if (!IsExtensionOutdated(*extension, specifics)) { | 382 if (!IsExtensionOutdated(*extension, specifics)) { |
| 383 extension_data->ResolveData(ExtensionData::CLIENT); | 383 extension_data->ResolveData(ExtensionData::CLIENT); |
| 384 DCHECK(!extension_data->NeedsUpdate(ExtensionData::CLIENT)); | 384 DCHECK(!extension_data->NeedsUpdate(ExtensionData::CLIENT)); |
| 385 } | 385 } |
| 386 } else { | 386 } else { |
| 387 GURL update_url(specifics.update_url()); | 387 GURL update_url(specifics.update_url()); |
| 388 // TODO(akalin): The version number should be used only to | |
| 389 // determine auto-updating permissions, not to send to the | |
| 390 // auto-update server. | |
| 391 scoped_ptr<Version> version( | |
| 392 Version::GetVersionFromString("0.0.0.0")); | |
| 393 CHECK(version.get()); | |
| 394 // TODO(akalin): Replace silent update with a list of enabled | 388 // TODO(akalin): Replace silent update with a list of enabled |
| 395 // permissions. | 389 // permissions. |
| 396 // | |
| 397 // TODO(akalin): Pass through the enabled/incognito_enabled state. | |
| 398 // We can't do it on OnClientUpdate() because we'd run into | |
| 399 // problems with triggering notifications while we're in a | |
| 400 // notification handler. The bug that this causes is that syncing | |
| 401 // a fresh client (i.e., no extensions) re-enables disabled | |
| 402 // extensions. | |
| 403 extensions_service->AddPendingExtension( | 390 extensions_service->AddPendingExtension( |
| 404 id, update_url, *version, false, true); | 391 id, update_url, false, true, |
| 392 specifics.enabled(), specifics.incognito_enabled()); |
| 405 } | 393 } |
| 406 DCHECK(!extension_data->NeedsUpdate(ExtensionData::SERVER)); | 394 DCHECK(!extension_data->NeedsUpdate(ExtensionData::SERVER)); |
| 407 } | 395 } |
| 408 | 396 |
| 409 void ExtensionModelAssociator::NudgeExtensionUpdater() { | 397 void ExtensionModelAssociator::NudgeExtensionUpdater() { |
| 410 ExtensionUpdater* extension_updater = GetExtensionsService()->updater(); | 398 ExtensionUpdater* extension_updater = GetExtensionsService()->updater(); |
| 411 // Auto-updates should now be on always (see the construction of the | 399 // Auto-updates should now be on always (see the construction of the |
| 412 // ExtensionsService in ProfileImpl::InitExtensions()). | 400 // ExtensionsService in ProfileImpl::InitExtensions()). |
| 413 if (extension_updater) { | 401 if (extension_updater) { |
| 414 extension_updater->CheckNow(); | 402 extension_updater->CheckNow(); |
| 415 } else { | 403 } else { |
| 416 LOG(DFATAL) << "Extension updater unexpectedly NULL; " | 404 LOG(DFATAL) << "Extension updater unexpectedly NULL; " |
| 417 << "auto-updates may be turned off"; | 405 << "auto-updates may be turned off"; |
| 418 } | 406 } |
| 419 } | 407 } |
| 420 | 408 |
| 421 } // namespace browser_sync | 409 } // namespace browser_sync |
| OLD | NEW |