OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "extensions/common/manifest_handlers/requirements_info.h" | 5 #include "extensions/common/manifest_handlers/requirements_info.h" |
6 | 6 |
7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 } | 53 } |
54 | 54 |
55 const std::vector<std::string> RequirementsHandler::Keys() const { | 55 const std::vector<std::string> RequirementsHandler::Keys() const { |
56 return SingleKey(keys::kRequirements); | 56 return SingleKey(keys::kRequirements); |
57 } | 57 } |
58 | 58 |
59 bool RequirementsHandler::AlwaysParseForType(Manifest::Type type) const { | 59 bool RequirementsHandler::AlwaysParseForType(Manifest::Type type) const { |
60 return true; | 60 return true; |
61 } | 61 } |
62 | 62 |
63 bool RequirementsHandler::Parse(Extension* extension, string16* error) { | 63 bool RequirementsHandler::Parse(Extension* extension, base::string16* error) { |
64 scoped_ptr<RequirementsInfo> requirements( | 64 scoped_ptr<RequirementsInfo> requirements( |
65 new RequirementsInfo(extension->manifest())); | 65 new RequirementsInfo(extension->manifest())); |
66 | 66 |
67 if (!extension->manifest()->HasKey(keys::kRequirements)) { | 67 if (!extension->manifest()->HasKey(keys::kRequirements)) { |
68 extension->SetManifestData(keys::kRequirements, requirements.release()); | 68 extension->SetManifestData(keys::kRequirements, requirements.release()); |
69 return true; | 69 return true; |
70 } | 70 } |
71 | 71 |
72 const base::DictionaryValue* requirements_value = NULL; | 72 const base::DictionaryValue* requirements_value = NULL; |
73 if (!extension->manifest()->GetDictionary(keys::kRequirements, | 73 if (!extension->manifest()->GetDictionary(keys::kRequirements, |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 *error = ASCIIToUTF16(errors::kInvalidRequirements); | 132 *error = ASCIIToUTF16(errors::kInvalidRequirements); |
133 return false; | 133 return false; |
134 } | 134 } |
135 } | 135 } |
136 | 136 |
137 extension->SetManifestData(keys::kRequirements, requirements.release()); | 137 extension->SetManifestData(keys::kRequirements, requirements.release()); |
138 return true; | 138 return true; |
139 } | 139 } |
140 | 140 |
141 } // namespace extensions | 141 } // namespace extensions |
OLD | NEW |