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

Side by Side Diff: chrome/browser/extensions/api/messaging/native_messaging_host_manifest.cc

Issue 925783002: Split ValueSerializer into separate Serializer and Deserializer classes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed cpplint warnings. Created 5 years, 9 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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/api/messaging/native_messaging_host_manifest .h" 5 #include "chrome/browser/extensions/api/messaging/native_messaging_host_manifest .h"
6 6
7 #include "base/json/json_file_value_serializer.h" 7 #include "base/json/json_file_value_serializer.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 10
(...skipping 25 matching lines...) Expand all
36 36
37 return true; 37 return true;
38 } 38 }
39 39
40 // static 40 // static
41 scoped_ptr<NativeMessagingHostManifest> NativeMessagingHostManifest::Load( 41 scoped_ptr<NativeMessagingHostManifest> NativeMessagingHostManifest::Load(
42 const base::FilePath& file_path, 42 const base::FilePath& file_path,
43 std::string* error_message) { 43 std::string* error_message) {
44 DCHECK(error_message); 44 DCHECK(error_message);
45 45
46 JSONFileValueSerializer serializer(file_path); 46 JSONFileValueDeserializer deserializer(file_path);
47 scoped_ptr<base::Value> parsed(serializer.Deserialize(NULL, error_message)); 47 scoped_ptr<base::Value> parsed(deserializer.Deserialize(NULL, error_message));
48 if (!parsed) { 48 if (!parsed) {
49 return scoped_ptr<NativeMessagingHostManifest>(); 49 return scoped_ptr<NativeMessagingHostManifest>();
50 } 50 }
51 51
52 base::DictionaryValue* dictionary; 52 base::DictionaryValue* dictionary;
53 if (!parsed->GetAsDictionary(&dictionary)) { 53 if (!parsed->GetAsDictionary(&dictionary)) {
54 *error_message = "Invalid manifest file."; 54 *error_message = "Invalid manifest file.";
55 return scoped_ptr<NativeMessagingHostManifest>(); 55 return scoped_ptr<NativeMessagingHostManifest>();
56 } 56 }
57 57
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 return false; 128 return false;
129 } 129 }
130 130
131 allowed_origins_.AddPattern(pattern); 131 allowed_origins_.AddPattern(pattern);
132 } 132 }
133 133
134 return true; 134 return true;
135 } 135 }
136 136
137 } // namespace extensions 137 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/drive/fake_drive_service.cc ('k') | chrome/browser/extensions/chrome_info_map_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698