Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(415)

Side by Side Diff: extensions/browser/updater/safe_manifest_parser.cc

Issue 924603003: Remove ManifestFetchData parameter from SafeManifestParser (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merged latest from origin/master Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « extensions/browser/updater/safe_manifest_parser.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "content/public/browser/browser_thread.h" 11 #include "content/public/browser/browser_thread.h"
12 #include "content/public/browser/utility_process_host.h" 12 #include "content/public/browser/utility_process_host.h"
13 #include "content/public/common/content_switches.h" 13 #include "content/public/common/content_switches.h"
14 #include "extensions/common/extension_utility_messages.h" 14 #include "extensions/common/extension_utility_messages.h"
15 #include "ipc/ipc_message_macros.h" 15 #include "ipc/ipc_message_macros.h"
16 16
17 using content::BrowserThread; 17 using content::BrowserThread;
18 18
19 namespace extensions { 19 namespace extensions {
20 20
21 SafeManifestParser::SafeManifestParser(const std::string& xml, 21 SafeManifestParser::SafeManifestParser(const std::string& xml,
22 ManifestFetchData* fetch_data, 22 const ResultsCallback& results_callback)
23 const UpdateCallback& update_callback) 23 : xml_(xml), results_callback_(results_callback) {
24 : xml_(xml), fetch_data_(fetch_data), update_callback_(update_callback) {
25 DCHECK_CURRENTLY_ON(BrowserThread::UI); 24 DCHECK_CURRENTLY_ON(BrowserThread::UI);
26 } 25 }
27 26
28 void SafeManifestParser::Start() { 27 void SafeManifestParser::Start() {
29 DCHECK_CURRENTLY_ON(BrowserThread::UI); 28 DCHECK_CURRENTLY_ON(BrowserThread::UI);
30 if (!BrowserThread::PostTask( 29 if (!BrowserThread::PostTask(
31 BrowserThread::IO, 30 BrowserThread::IO,
32 FROM_HERE, 31 FROM_HERE,
33 base::Bind(&SafeManifestParser::ParseInSandbox, this))) { 32 base::Bind(&SafeManifestParser::ParseInSandbox, this))) {
34 NOTREACHED(); 33 NOTREACHED();
(...skipping 21 matching lines...) Expand all
56 OnParseUpdateManifestSucceeded) 55 OnParseUpdateManifestSucceeded)
57 IPC_MESSAGE_HANDLER(ExtensionUtilityHostMsg_ParseUpdateManifest_Failed, 56 IPC_MESSAGE_HANDLER(ExtensionUtilityHostMsg_ParseUpdateManifest_Failed,
58 OnParseUpdateManifestFailed) 57 OnParseUpdateManifestFailed)
59 IPC_MESSAGE_UNHANDLED(handled = false) 58 IPC_MESSAGE_UNHANDLED(handled = false)
60 IPC_END_MESSAGE_MAP() 59 IPC_END_MESSAGE_MAP()
61 return handled; 60 return handled;
62 } 61 }
63 62
64 void SafeManifestParser::OnParseUpdateManifestSucceeded( 63 void SafeManifestParser::OnParseUpdateManifestSucceeded(
65 const UpdateManifest::Results& results) { 64 const UpdateManifest::Results& results) {
66 VLOG(2) << "parsing manifest succeeded (" << fetch_data_->full_url() << ")";
67 DCHECK_CURRENTLY_ON(BrowserThread::UI); 65 DCHECK_CURRENTLY_ON(BrowserThread::UI);
68 update_callback_.Run(*fetch_data_, &results); 66 results_callback_.Run(&results);
69 } 67 }
70 68
71 void SafeManifestParser::OnParseUpdateManifestFailed( 69 void SafeManifestParser::OnParseUpdateManifestFailed(
72 const std::string& error_message) { 70 const std::string& error_message) {
73 VLOG(2) << "parsing manifest failed (" << fetch_data_->full_url() << ")";
74 DCHECK_CURRENTLY_ON(BrowserThread::UI); 71 DCHECK_CURRENTLY_ON(BrowserThread::UI);
75 LOG(WARNING) << "Error parsing update manifest:\n" << error_message; 72 LOG(WARNING) << "Error parsing update manifest:\n" << error_message;
76 update_callback_.Run(*fetch_data_, NULL); 73 results_callback_.Run(NULL);
77 } 74 }
78 75
79 } // namespace extensions 76 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/updater/safe_manifest_parser.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698