| OLD | NEW |
| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/json/json_file_value_serializer.h" | 9 #include "base/json/json_file_value_serializer.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 *error_message = "Invalid manifest file."; | 57 *error_message = "Invalid manifest file."; |
| 58 return scoped_ptr<NativeMessagingHostManifest>(); | 58 return scoped_ptr<NativeMessagingHostManifest>(); |
| 59 } | 59 } |
| 60 | 60 |
| 61 scoped_ptr<NativeMessagingHostManifest> result( | 61 scoped_ptr<NativeMessagingHostManifest> result( |
| 62 new NativeMessagingHostManifest()); | 62 new NativeMessagingHostManifest()); |
| 63 if (!result->Parse(dictionary, error_message)) { | 63 if (!result->Parse(dictionary, error_message)) { |
| 64 return scoped_ptr<NativeMessagingHostManifest>(); | 64 return scoped_ptr<NativeMessagingHostManifest>(); |
| 65 } | 65 } |
| 66 | 66 |
| 67 return result.Pass(); | 67 return result; |
| 68 } | 68 } |
| 69 | 69 |
| 70 NativeMessagingHostManifest::NativeMessagingHostManifest() { | 70 NativeMessagingHostManifest::NativeMessagingHostManifest() { |
| 71 } | 71 } |
| 72 | 72 |
| 73 bool NativeMessagingHostManifest::Parse(base::DictionaryValue* dictionary, | 73 bool NativeMessagingHostManifest::Parse(base::DictionaryValue* dictionary, |
| 74 std::string* error_message) { | 74 std::string* error_message) { |
| 75 if (!dictionary->GetString("name", &name_) || | 75 if (!dictionary->GetString("name", &name_) || |
| 76 !IsValidName(name_)) { | 76 !IsValidName(name_)) { |
| 77 *error_message = "Invalid value for name."; | 77 *error_message = "Invalid value for name."; |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 return false; | 131 return false; |
| 132 } | 132 } |
| 133 | 133 |
| 134 allowed_origins_.AddPattern(pattern); | 134 allowed_origins_.AddPattern(pattern); |
| 135 } | 135 } |
| 136 | 136 |
| 137 return true; | 137 return true; |
| 138 } | 138 } |
| 139 | 139 |
| 140 } // namespace extensions | 140 } // namespace extensions |
| OLD | NEW |