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 29 matching lines...) Expand all Loading... |
40 // If we're using UtilityProcessHost, we may not be destroyed on | 40 // If we're using UtilityProcessHost, we may not be destroyed on |
41 // the UI or IO thread. | 41 // the UI or IO thread. |
42 } | 42 } |
43 | 43 |
44 void SafeManifestParser::ParseInSandbox() { | 44 void SafeManifestParser::ParseInSandbox() { |
45 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 45 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
46 | 46 |
47 content::UtilityProcessHost* host = content::UtilityProcessHost::Create( | 47 content::UtilityProcessHost* host = content::UtilityProcessHost::Create( |
48 this, | 48 this, |
49 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI).get()); | 49 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI).get()); |
50 host->EnableZygote(); | |
51 host->Send(new ChromeUtilityMsg_ParseUpdateManifest(xml_)); | 50 host->Send(new ChromeUtilityMsg_ParseUpdateManifest(xml_)); |
52 } | 51 } |
53 | 52 |
54 bool SafeManifestParser::OnMessageReceived(const IPC::Message& message) { | 53 bool SafeManifestParser::OnMessageReceived(const IPC::Message& message) { |
55 bool handled = true; | 54 bool handled = true; |
56 IPC_BEGIN_MESSAGE_MAP(SafeManifestParser, message) | 55 IPC_BEGIN_MESSAGE_MAP(SafeManifestParser, message) |
57 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_ParseUpdateManifest_Succeeded, | 56 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_ParseUpdateManifest_Succeeded, |
58 OnParseUpdateManifestSucceeded) | 57 OnParseUpdateManifestSucceeded) |
59 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_ParseUpdateManifest_Failed, | 58 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_ParseUpdateManifest_Failed, |
60 OnParseUpdateManifestFailed) | 59 OnParseUpdateManifestFailed) |
(...skipping 11 matching lines...) Expand all Loading... |
72 | 71 |
73 void SafeManifestParser::OnParseUpdateManifestFailed( | 72 void SafeManifestParser::OnParseUpdateManifestFailed( |
74 const std::string& error_message) { | 73 const std::string& error_message) { |
75 VLOG(2) << "parsing manifest failed (" << fetch_data_->full_url() << ")"; | 74 VLOG(2) << "parsing manifest failed (" << fetch_data_->full_url() << ")"; |
76 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 75 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
77 LOG(WARNING) << "Error parsing update manifest:\n" << error_message; | 76 LOG(WARNING) << "Error parsing update manifest:\n" << error_message; |
78 update_callback_.Run(*fetch_data_, NULL); | 77 update_callback_.Run(*fetch_data_, NULL); |
79 } | 78 } |
80 | 79 |
81 } // namespace extensions | 80 } // namespace extensions |
OLD | NEW |