| 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 "extensions/browser/updater/safe_manifest_parser.h" | 5 #include "extensions/browser/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 27 matching lines...) Expand all Loading... |
| 38 | 38 |
| 39 SafeManifestParser::~SafeManifestParser() { | 39 SafeManifestParser::~SafeManifestParser() { |
| 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_CURRENTLY_ON(BrowserThread::IO); | 45 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 46 | 46 |
| 47 content::UtilityProcessHost* host = content::UtilityProcessHost::Create( | 47 content::UtilityProcessHost* host = content::UtilityProcessHost::Create( |
| 48 this, | 48 this, BrowserThread::GetTaskRunnerForThread(BrowserThread::UI).get()); |
| 49 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI).get()); | |
| 50 host->SetName( | 49 host->SetName( |
| 51 l10n_util::GetStringUTF16(IDS_UTILITY_PROCESS_MANIFEST_PARSER_NAME)); | 50 l10n_util::GetStringUTF16(IDS_UTILITY_PROCESS_MANIFEST_PARSER_NAME)); |
| 52 host->Send(new ExtensionUtilityMsg_ParseUpdateManifest(xml_)); | 51 host->Send(new ExtensionUtilityMsg_ParseUpdateManifest(xml_)); |
| 53 } | 52 } |
| 54 | 53 |
| 55 bool SafeManifestParser::OnMessageReceived(const IPC::Message& message) { | 54 bool SafeManifestParser::OnMessageReceived(const IPC::Message& message) { |
| 56 bool handled = true; | 55 bool handled = true; |
| 57 IPC_BEGIN_MESSAGE_MAP(SafeManifestParser, message) | 56 IPC_BEGIN_MESSAGE_MAP(SafeManifestParser, message) |
| 58 IPC_MESSAGE_HANDLER(ExtensionUtilityHostMsg_ParseUpdateManifest_Succeeded, | 57 IPC_MESSAGE_HANDLER(ExtensionUtilityHostMsg_ParseUpdateManifest_Succeeded, |
| 59 OnParseUpdateManifestSucceeded) | 58 OnParseUpdateManifestSucceeded) |
| (...skipping 11 matching lines...) Expand all Loading... |
| 71 } | 70 } |
| 72 | 71 |
| 73 void SafeManifestParser::OnParseUpdateManifestFailed( | 72 void SafeManifestParser::OnParseUpdateManifestFailed( |
| 74 const std::string& error_message) { | 73 const std::string& error_message) { |
| 75 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 74 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 76 LOG(WARNING) << "Error parsing update manifest:\n" << error_message; | 75 LOG(WARNING) << "Error parsing update manifest:\n" << error_message; |
| 77 results_callback_.Run(NULL); | 76 results_callback_.Run(NULL); |
| 78 } | 77 } |
| 79 | 78 |
| 80 } // namespace extensions | 79 } // namespace extensions |
| OLD | NEW |