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 "base/file_path.h" | 5 #include "base/file_path.h" |
6 #include "base/json/json_file_value_serializer.h" | 6 #include "base/json/json_file_value_serializer.h" |
7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 .AppendASCII("permissions") | 95 .AppendASCII("permissions") |
96 .AppendASCII("optional") | 96 .AppendASCII("optional") |
97 .AppendASCII("manifest.json"); | 97 .AppendASCII("manifest.json"); |
98 | 98 |
99 JSONFileValueSerializer serializer(path); | 99 JSONFileValueSerializer serializer(path); |
100 scoped_ptr<Value> result(serializer.Deserialize(NULL, error)); | 100 scoped_ptr<Value> result(serializer.Deserialize(NULL, error)); |
101 if (!result.get()) | 101 if (!result.get()) |
102 return NULL; | 102 return NULL; |
103 | 103 |
104 scoped_refptr<Extension> extension = Extension::Create( | 104 scoped_refptr<Extension> extension = Extension::Create( |
105 path.DirName(), Extension::INTERNAL, | 105 path.DirName(), Manifest::INTERNAL, |
106 *static_cast<DictionaryValue*>(result.get()), Extension::NO_FLAGS, error); | 106 *static_cast<DictionaryValue*>(result.get()), Extension::NO_FLAGS, error); |
107 return extension; | 107 return extension; |
108 } | 108 } |
109 | 109 |
110 void AddPattern(URLPatternSet* extent, const std::string& pattern) { | 110 void AddPattern(URLPatternSet* extent, const std::string& pattern) { |
111 int schemes = URLPattern::SCHEME_ALL; | 111 int schemes = URLPattern::SCHEME_ALL; |
112 extent->AddPattern(URLPattern(schemes, pattern)); | 112 extent->AddPattern(URLPattern(schemes, pattern)); |
113 } | 113 } |
114 | 114 |
115 } // namespace | 115 } // namespace |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 // Verify that the extension prefs hold the new active permissions and the | 202 // Verify that the extension prefs hold the new active permissions and the |
203 // same granted permissions. | 203 // same granted permissions. |
204 from_prefs = prefs->GetActivePermissions(extension->id()); | 204 from_prefs = prefs->GetActivePermissions(extension->id()); |
205 ASSERT_EQ(*active_permissions, *from_prefs); | 205 ASSERT_EQ(*active_permissions, *from_prefs); |
206 | 206 |
207 from_prefs = prefs->GetGrantedPermissions(extension->id()); | 207 from_prefs = prefs->GetGrantedPermissions(extension->id()); |
208 ASSERT_EQ(*granted_permissions, *from_prefs); | 208 ASSERT_EQ(*granted_permissions, *from_prefs); |
209 } | 209 } |
210 | 210 |
211 } // namespace extensions | 211 } // namespace extensions |
OLD | NEW |