| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/component_updater/component_updater_service.h" | 5 #include "chrome/browser/component_updater/component_updater_service.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/at_exit.h" | 10 #include "base/at_exit.h" |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 // UtilityProcessHost::Client callbacks so CrxUpdateService does | 203 // UtilityProcessHost::Client callbacks so CrxUpdateService does |
| 204 // not have to derive from it because that is refcounted. | 204 // not have to derive from it because that is refcounted. |
| 205 class ManifestParserBridge : public UtilityProcessHost::Client { | 205 class ManifestParserBridge : public UtilityProcessHost::Client { |
| 206 public: | 206 public: |
| 207 explicit ManifestParserBridge(CrxUpdateService* service) | 207 explicit ManifestParserBridge(CrxUpdateService* service) |
| 208 : service_(service) {} | 208 : service_(service) {} |
| 209 | 209 |
| 210 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE { | 210 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE { |
| 211 bool handled = true; | 211 bool handled = true; |
| 212 IPC_BEGIN_MESSAGE_MAP(ManifestParserBridge, message) | 212 IPC_BEGIN_MESSAGE_MAP(ManifestParserBridge, message) |
| 213 IPC_MESSAGE_HANDLER(UtilityHostMsg_ParseUpdateManifest_Succeeded, | 213 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_ParseUpdateManifest_Succeeded, |
| 214 OnParseUpdateManifestSucceeded) | 214 OnParseUpdateManifestSucceeded) |
| 215 IPC_MESSAGE_HANDLER(UtilityHostMsg_ParseUpdateManifest_Failed, | 215 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_ParseUpdateManifest_Failed, |
| 216 OnParseUpdateManifestFailed) | 216 OnParseUpdateManifestFailed) |
| 217 IPC_MESSAGE_UNHANDLED(handled = false) | 217 IPC_MESSAGE_UNHANDLED(handled = false) |
| 218 IPC_END_MESSAGE_MAP() | 218 IPC_END_MESSAGE_MAP() |
| 219 return handled; | 219 return handled; |
| 220 } | 220 } |
| 221 | 221 |
| 222 private: | 222 private: |
| 223 // Omaha update response XML was succesfuly parsed. | 223 // Omaha update response XML was succesfuly parsed. |
| 224 void OnParseUpdateManifestSucceeded(const UpdateManifest::Results& r) { | 224 void OnParseUpdateManifestSucceeded(const UpdateManifest::Results& r) { |
| 225 service_->OnParseUpdateManifestSucceeded(r); | 225 service_->OnParseUpdateManifestSucceeded(r); |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 554 UpdateManifest manifest; | 554 UpdateManifest manifest; |
| 555 if (!manifest.Parse(xml)) { | 555 if (!manifest.Parse(xml)) { |
| 556 CrxUpdateService::OnParseUpdateManifestFailed(manifest.errors()); | 556 CrxUpdateService::OnParseUpdateManifestFailed(manifest.errors()); |
| 557 } else { | 557 } else { |
| 558 CrxUpdateService::OnParseUpdateManifestSucceeded(manifest.results()); | 558 CrxUpdateService::OnParseUpdateManifestSucceeded(manifest.results()); |
| 559 } | 559 } |
| 560 } else { | 560 } else { |
| 561 UtilityProcessHost* host = | 561 UtilityProcessHost* host = |
| 562 new UtilityProcessHost(new ManifestParserBridge(this), | 562 new UtilityProcessHost(new ManifestParserBridge(this), |
| 563 BrowserThread::UI); | 563 BrowserThread::UI); |
| 564 host->Send(new UtilityMsg_ParseUpdateManifest(xml)); | 564 host->Send(new ChromeUtilityMsg_ParseUpdateManifest(xml)); |
| 565 } | 565 } |
| 566 } | 566 } |
| 567 | 567 |
| 568 // A valid Omaha update check has arrived, from only the list of components that | 568 // A valid Omaha update check has arrived, from only the list of components that |
| 569 // we are currently upgrading we check for a match in which the server side | 569 // we are currently upgrading we check for a match in which the server side |
| 570 // version is newer, if so we queue them for an upgrade. The next time we call | 570 // version is newer, if so we queue them for an upgrade. The next time we call |
| 571 // ProcessPendingItems() one of them will be drafted for the upgrade process. | 571 // ProcessPendingItems() one of them will be drafted for the upgrade process. |
| 572 void CrxUpdateService::OnParseUpdateManifestSucceeded( | 572 void CrxUpdateService::OnParseUpdateManifestSucceeded( |
| 573 const UpdateManifest::Results& results) { | 573 const UpdateManifest::Results& results) { |
| 574 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 574 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 699 ScheduleNextRun(false); | 699 ScheduleNextRun(false); |
| 700 } | 700 } |
| 701 | 701 |
| 702 // The component update factory. Using the component updater as a singleton | 702 // The component update factory. Using the component updater as a singleton |
| 703 // is the job of the browser process. | 703 // is the job of the browser process. |
| 704 ComponentUpdateService* ComponentUpdateServiceFactory( | 704 ComponentUpdateService* ComponentUpdateServiceFactory( |
| 705 ComponentUpdateService::Configurator* config) { | 705 ComponentUpdateService::Configurator* config) { |
| 706 DCHECK(config); | 706 DCHECK(config); |
| 707 return new CrxUpdateService(config); | 707 return new CrxUpdateService(config); |
| 708 } | 708 } |
| OLD | NEW |