OLD | NEW |
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 "chrome/browser/extensions/api/permissions/permissions_api_helpers.h" | 5 #include "chrome/browser/extensions/api/permissions/permissions_api_helpers.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 } | 53 } |
54 } | 54 } |
55 | 55 |
56 // TODO(rpaquay): We currently don't expose manifest permissions | 56 // TODO(rpaquay): We currently don't expose manifest permissions |
57 // to apps/extensions via the permissions API. | 57 // to apps/extensions via the permissions API. |
58 | 58 |
59 permissions->origins.reset(new std::vector<std::string>()); | 59 permissions->origins.reset(new std::vector<std::string>()); |
60 for (const URLPattern& pattern : set.explicit_hosts()) | 60 for (const URLPattern& pattern : set.explicit_hosts()) |
61 permissions->origins->push_back(pattern.GetAsString()); | 61 permissions->origins->push_back(pattern.GetAsString()); |
62 | 62 |
63 return permissions.Pass(); | 63 return permissions; |
64 } | 64 } |
65 | 65 |
66 scoped_ptr<const PermissionSet> UnpackPermissionSet( | 66 scoped_ptr<const PermissionSet> UnpackPermissionSet( |
67 const Permissions& permissions, | 67 const Permissions& permissions, |
68 bool allow_file_access, | 68 bool allow_file_access, |
69 std::string* error) { | 69 std::string* error) { |
70 DCHECK(error); | 70 DCHECK(error); |
71 APIPermissionSet apis; | 71 APIPermissionSet apis; |
72 std::vector<std::string>* permissions_list = permissions.permissions.get(); | 72 std::vector<std::string>* permissions_list = permissions.permissions.get(); |
73 if (permissions_list) { | 73 if (permissions_list) { |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 origins.AddPattern(origin); | 144 origins.AddPattern(origin); |
145 } | 145 } |
146 } | 146 } |
147 | 147 |
148 return make_scoped_ptr( | 148 return make_scoped_ptr( |
149 new PermissionSet(apis, manifest_permissions, origins, URLPatternSet())); | 149 new PermissionSet(apis, manifest_permissions, origins, URLPatternSet())); |
150 } | 150 } |
151 | 151 |
152 } // namespace permissions_api_helpers | 152 } // namespace permissions_api_helpers |
153 } // namespace extensions | 153 } // namespace extensions |
OLD | NEW |