| 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/extensions/extension_updater.h" | 5 #include "chrome/browser/extensions/extension_updater.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 635 void ParseInSandbox(ResourceDispatcherHost* rdh) { | 635 void ParseInSandbox(ResourceDispatcherHost* rdh) { |
| 636 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 636 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 637 | 637 |
| 638 // TODO(asargent) we shouldn't need to do this branch here - instead | 638 // TODO(asargent) we shouldn't need to do this branch here - instead |
| 639 // UtilityProcessHost should handle it for us. (http://crbug.com/19192) | 639 // UtilityProcessHost should handle it for us. (http://crbug.com/19192) |
| 640 bool use_utility_process = rdh && | 640 bool use_utility_process = rdh && |
| 641 !CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess); | 641 !CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess); |
| 642 if (use_utility_process) { | 642 if (use_utility_process) { |
| 643 UtilityProcessHost* host = new UtilityProcessHost( | 643 UtilityProcessHost* host = new UtilityProcessHost( |
| 644 this, BrowserThread::UI); | 644 this, BrowserThread::UI); |
| 645 host->Send(new UtilityMsg_ParseUpdateManifest(xml_)); | 645 host->Send(new ChromeUtilityMsg_ParseUpdateManifest(xml_)); |
| 646 } else { | 646 } else { |
| 647 UpdateManifest manifest; | 647 UpdateManifest manifest; |
| 648 if (manifest.Parse(xml_)) { | 648 if (manifest.Parse(xml_)) { |
| 649 if (!BrowserThread::PostTask( | 649 if (!BrowserThread::PostTask( |
| 650 BrowserThread::UI, FROM_HERE, | 650 BrowserThread::UI, FROM_HERE, |
| 651 NewRunnableMethod( | 651 NewRunnableMethod( |
| 652 this, &SafeManifestParser::OnParseUpdateManifestSucceeded, | 652 this, &SafeManifestParser::OnParseUpdateManifestSucceeded, |
| 653 manifest.results()))) { | 653 manifest.results()))) { |
| 654 NOTREACHED(); | 654 NOTREACHED(); |
| 655 } | 655 } |
| 656 } else { | 656 } else { |
| 657 if (!BrowserThread::PostTask( | 657 if (!BrowserThread::PostTask( |
| 658 BrowserThread::UI, FROM_HERE, | 658 BrowserThread::UI, FROM_HERE, |
| 659 NewRunnableMethod( | 659 NewRunnableMethod( |
| 660 this, &SafeManifestParser::OnParseUpdateManifestFailed, | 660 this, &SafeManifestParser::OnParseUpdateManifestFailed, |
| 661 manifest.errors()))) { | 661 manifest.errors()))) { |
| 662 NOTREACHED(); | 662 NOTREACHED(); |
| 663 } | 663 } |
| 664 } | 664 } |
| 665 } | 665 } |
| 666 } | 666 } |
| 667 | 667 |
| 668 // UtilityProcessHost::Client | 668 // UtilityProcessHost::Client |
| 669 virtual bool OnMessageReceived(const IPC::Message& message) { | 669 virtual bool OnMessageReceived(const IPC::Message& message) { |
| 670 bool handled = true; | 670 bool handled = true; |
| 671 IPC_BEGIN_MESSAGE_MAP(SafeManifestParser, message) | 671 IPC_BEGIN_MESSAGE_MAP(SafeManifestParser, message) |
| 672 IPC_MESSAGE_HANDLER(UtilityHostMsg_ParseUpdateManifest_Succeeded, | 672 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_ParseUpdateManifest_Succeeded, |
| 673 OnParseUpdateManifestSucceeded) | 673 OnParseUpdateManifestSucceeded) |
| 674 IPC_MESSAGE_HANDLER(UtilityHostMsg_ParseUpdateManifest_Failed, | 674 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_ParseUpdateManifest_Failed, |
| 675 OnParseUpdateManifestFailed) | 675 OnParseUpdateManifestFailed) |
| 676 IPC_MESSAGE_UNHANDLED(handled = false) | 676 IPC_MESSAGE_UNHANDLED(handled = false) |
| 677 IPC_END_MESSAGE_MAP() | 677 IPC_END_MESSAGE_MAP() |
| 678 return handled; | 678 return handled; |
| 679 } | 679 } |
| 680 | 680 |
| 681 void OnParseUpdateManifestSucceeded( | 681 void OnParseUpdateManifestSucceeded( |
| 682 const UpdateManifest::Results& results) { | 682 const UpdateManifest::Results& results) { |
| 683 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 683 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 684 if (!updater_) { | 684 if (!updater_) { |
| (...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1242 std::set<std::string>::const_iterator i; | 1242 std::set<std::string>::const_iterator i; |
| 1243 for (i = ids.begin(); i != ids.end(); ++i) | 1243 for (i = ids.begin(); i != ids.end(); ++i) |
| 1244 in_progress_ids_.insert(*i); | 1244 in_progress_ids_.insert(*i); |
| 1245 } | 1245 } |
| 1246 | 1246 |
| 1247 void ExtensionUpdater::RemoveFromInProgress(const std::set<std::string>& ids) { | 1247 void ExtensionUpdater::RemoveFromInProgress(const std::set<std::string>& ids) { |
| 1248 std::set<std::string>::const_iterator i; | 1248 std::set<std::string>::const_iterator i; |
| 1249 for (i = ids.begin(); i != ids.end(); ++i) | 1249 for (i = ids.begin(); i != ids.end(); ++i) |
| 1250 in_progress_ids_.erase(*i); | 1250 in_progress_ids_.erase(*i); |
| 1251 } | 1251 } |
| OLD | NEW |