| 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/storage/settings_test_util.h" | 5 #include "chrome/browser/extensions/api/storage/settings_test_util.h" |
| 6 | 6 |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "chrome/browser/extensions/api/storage/settings_frontend.h" | 8 #include "chrome/browser/extensions/api/storage/settings_frontend.h" |
| 9 #include "chrome/browser/extensions/extension_system_factory.h" | 9 #include "chrome/browser/extensions/extension_system_factory.h" |
| 10 #include "chrome/common/extensions/extension.h" | 10 #include "chrome/common/extensions/extension.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 void MockExtensionService::AddExtensionWithId( | 53 void MockExtensionService::AddExtensionWithId( |
| 54 const std::string& id, Manifest::Type type) { | 54 const std::string& id, Manifest::Type type) { |
| 55 std::set<std::string> empty_permissions; | 55 std::set<std::string> empty_permissions; |
| 56 AddExtensionWithIdAndPermissions(id, type, empty_permissions); | 56 AddExtensionWithIdAndPermissions(id, type, empty_permissions); |
| 57 } | 57 } |
| 58 | 58 |
| 59 void MockExtensionService::AddExtensionWithIdAndPermissions( | 59 void MockExtensionService::AddExtensionWithIdAndPermissions( |
| 60 const std::string& id, | 60 const std::string& id, |
| 61 Manifest::Type type, | 61 Manifest::Type type, |
| 62 const std::set<std::string>& permissions_set) { | 62 const std::set<std::string>& permissions_set) { |
| 63 DictionaryValue manifest; | 63 base::DictionaryValue manifest; |
| 64 manifest.SetString("name", std::string("Test extension ") + id); | 64 manifest.SetString("name", std::string("Test extension ") + id); |
| 65 manifest.SetString("version", "1.0"); | 65 manifest.SetString("version", "1.0"); |
| 66 | 66 |
| 67 scoped_ptr<ListValue> permissions(new ListValue()); | 67 scoped_ptr<base::ListValue> permissions(new base::ListValue()); |
| 68 for (std::set<std::string>::const_iterator it = permissions_set.begin(); | 68 for (std::set<std::string>::const_iterator it = permissions_set.begin(); |
| 69 it != permissions_set.end(); ++it) { | 69 it != permissions_set.end(); ++it) { |
| 70 permissions->Append(Value::CreateStringValue(*it)); | 70 permissions->Append(Value::CreateStringValue(*it)); |
| 71 } | 71 } |
| 72 manifest.Set("permissions", permissions.release()); | 72 manifest.Set("permissions", permissions.release()); |
| 73 | 73 |
| 74 switch (type) { | 74 switch (type) { |
| 75 case Manifest::TYPE_EXTENSION: | 75 case Manifest::TYPE_EXTENSION: |
| 76 break; | 76 break; |
| 77 | 77 |
| 78 case Manifest::TYPE_LEGACY_PACKAGED_APP: { | 78 case Manifest::TYPE_LEGACY_PACKAGED_APP: { |
| 79 DictionaryValue* app = new DictionaryValue(); | 79 base::DictionaryValue* app = new base::DictionaryValue(); |
| 80 DictionaryValue* app_launch = new DictionaryValue(); | 80 base::DictionaryValue* app_launch = new base::DictionaryValue(); |
| 81 app_launch->SetString("local_path", "fake.html"); | 81 app_launch->SetString("local_path", "fake.html"); |
| 82 app->Set("launch", app_launch); | 82 app->Set("launch", app_launch); |
| 83 manifest.Set("app", app); | 83 manifest.Set("app", app); |
| 84 break; | 84 break; |
| 85 } | 85 } |
| 86 | 86 |
| 87 default: | 87 default: |
| 88 NOTREACHED(); | 88 NOTREACHED(); |
| 89 } | 89 } |
| 90 | 90 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 ValueStore* ScopedSettingsStorageFactory::Create( | 157 ValueStore* ScopedSettingsStorageFactory::Create( |
| 158 const base::FilePath& base_path, | 158 const base::FilePath& base_path, |
| 159 const std::string& extension_id) { | 159 const std::string& extension_id) { |
| 160 DCHECK(delegate_.get()); | 160 DCHECK(delegate_.get()); |
| 161 return delegate_->Create(base_path, extension_id); | 161 return delegate_->Create(base_path, extension_id); |
| 162 } | 162 } |
| 163 | 163 |
| 164 } // namespace settings_test_util | 164 } // namespace settings_test_util |
| 165 | 165 |
| 166 } // namespace extensions | 166 } // namespace extensions |
| OLD | NEW |