| 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/updater/safe_manifest_parser.h" | 5 #include "chrome/browser/extensions/updater/safe_manifest_parser.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 | 44 |
| 45 void SafeManifestParser::ParseInSandbox() { | 45 void SafeManifestParser::ParseInSandbox() { |
| 46 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 46 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 47 | 47 |
| 48 // TODO(asargent) we shouldn't need to do this branch here - instead | 48 // TODO(asargent) we shouldn't need to do this branch here - instead |
| 49 // UtilityProcessHost should handle it for us. (http://crbug.com/19192) | 49 // UtilityProcessHost should handle it for us. (http://crbug.com/19192) |
| 50 bool use_utility_process = content::ResourceDispatcherHost::Get() && | 50 bool use_utility_process = content::ResourceDispatcherHost::Get() && |
| 51 !CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess); | 51 !CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess); |
| 52 if (use_utility_process) { | 52 if (use_utility_process) { |
| 53 content::UtilityProcessHost* host = content::UtilityProcessHost::Create( | 53 content::UtilityProcessHost* host = content::UtilityProcessHost::Create( |
| 54 this, BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI)); | 54 this, |
| 55 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI).get()); |
| 55 host->EnableZygote(); | 56 host->EnableZygote(); |
| 56 host->Send(new ChromeUtilityMsg_ParseUpdateManifest(xml_)); | 57 host->Send(new ChromeUtilityMsg_ParseUpdateManifest(xml_)); |
| 57 } else { | 58 } else { |
| 58 UpdateManifest manifest; | 59 UpdateManifest manifest; |
| 59 if (manifest.Parse(xml_)) { | 60 if (manifest.Parse(xml_)) { |
| 60 if (!BrowserThread::PostTask( | 61 if (!BrowserThread::PostTask( |
| 61 BrowserThread::UI, FROM_HERE, | 62 BrowserThread::UI, FROM_HERE, |
| 62 base::Bind( | 63 base::Bind( |
| 63 &SafeManifestParser::OnParseUpdateManifestSucceeded, this, | 64 &SafeManifestParser::OnParseUpdateManifestSucceeded, this, |
| 64 manifest.results()))) { | 65 manifest.results()))) { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 | 98 |
| 98 void SafeManifestParser::OnParseUpdateManifestFailed( | 99 void SafeManifestParser::OnParseUpdateManifestFailed( |
| 99 const std::string& error_message) { | 100 const std::string& error_message) { |
| 100 VLOG(2) << "parsing manifest failed (" << fetch_data_->full_url() << ")"; | 101 VLOG(2) << "parsing manifest failed (" << fetch_data_->full_url() << ")"; |
| 101 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 102 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 102 LOG(WARNING) << "Error parsing update manifest:\n" << error_message; | 103 LOG(WARNING) << "Error parsing update manifest:\n" << error_message; |
| 103 update_callback_.Run(*fetch_data_, NULL); | 104 update_callback_.Run(*fetch_data_, NULL); |
| 104 } | 105 } |
| 105 | 106 |
| 106 } // namespace extensions | 107 } // namespace extensions |
| OLD | NEW |