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

Side by Side Diff: components/update_client/component_unpacker.cc

Issue 1394993004: Make ValueDeserializer::Deserialize return scoped_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix and add todo about not failed trybot Created 5 years, 2 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/update_client/component_unpacker.h" 5 #include "components/update_client/component_unpacker.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 // extension unpacker will reject, so that a component cannot be installed 56 // extension unpacker will reject, so that a component cannot be installed
57 // as an extension. 57 // as an extension.
58 scoped_ptr<base::DictionaryValue> ReadManifest( 58 scoped_ptr<base::DictionaryValue> ReadManifest(
59 const base::FilePath& unpack_path) { 59 const base::FilePath& unpack_path) {
60 base::FilePath manifest = 60 base::FilePath manifest =
61 unpack_path.Append(FILE_PATH_LITERAL("manifest.json")); 61 unpack_path.Append(FILE_PATH_LITERAL("manifest.json"));
62 if (!base::PathExists(manifest)) 62 if (!base::PathExists(manifest))
63 return scoped_ptr<base::DictionaryValue>(); 63 return scoped_ptr<base::DictionaryValue>();
64 JSONFileValueDeserializer deserializer(manifest); 64 JSONFileValueDeserializer deserializer(manifest);
65 std::string error; 65 std::string error;
66 scoped_ptr<base::Value> root(deserializer.Deserialize(NULL, &error)); 66 scoped_ptr<base::Value> root = deserializer.Deserialize(NULL, &error);
67 if (!root.get()) 67 if (!root.get())
68 return scoped_ptr<base::DictionaryValue>(); 68 return scoped_ptr<base::DictionaryValue>();
69 if (!root->IsType(base::Value::TYPE_DICTIONARY)) 69 if (!root->IsType(base::Value::TYPE_DICTIONARY))
70 return scoped_ptr<base::DictionaryValue>(); 70 return scoped_ptr<base::DictionaryValue>();
71 return scoped_ptr<base::DictionaryValue>( 71 return scoped_ptr<base::DictionaryValue>(
72 static_cast<base::DictionaryValue*>(root.release())).Pass(); 72 static_cast<base::DictionaryValue*>(root.release())).Pass();
73 } 73 }
74 74
75 bool ComponentUnpacker::UnpackInternal() { 75 bool ComponentUnpacker::UnpackInternal() {
76 return Verify() && Unzip() && BeginPatching(); 76 return Verify() && Unzip() && BeginPatching();
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 if (!unpack_path_.empty()) 206 if (!unpack_path_.empty())
207 base::DeleteFile(unpack_path_, true); 207 base::DeleteFile(unpack_path_, true);
208 task_runner_->PostTask(FROM_HERE, 208 task_runner_->PostTask(FROM_HERE,
209 base::Bind(callback_, error_, extended_error_)); 209 base::Bind(callback_, error_, extended_error_));
210 } 210 }
211 211
212 ComponentUnpacker::~ComponentUnpacker() { 212 ComponentUnpacker::~ComponentUnpacker() {
213 } 213 }
214 214
215 } // namespace update_client 215 } // namespace update_client
OLDNEW
« no previous file with comments | « components/update_client/component_patcher.cc ('k') | extensions/browser/api/printer_provider/printer_provider_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698