| 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 #ifndef EXTENSIONS_COMMON_EXTENSION_BUILDER_H_ | 5 #ifndef EXTENSIONS_COMMON_EXTENSION_BUILDER_H_ |
| 6 #define EXTENSIONS_COMMON_EXTENSION_BUILDER_H_ | 6 #define EXTENSIONS_COMMON_EXTENSION_BUILDER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 // CHECKs that the extension was created successfully. | 33 // CHECKs that the extension was created successfully. |
| 34 scoped_refptr<Extension> Build(); | 34 scoped_refptr<Extension> Build(); |
| 35 | 35 |
| 36 // Defaults to FilePath(). | 36 // Defaults to FilePath(). |
| 37 ExtensionBuilder& SetPath(const base::FilePath& path); | 37 ExtensionBuilder& SetPath(const base::FilePath& path); |
| 38 | 38 |
| 39 // Defaults to Manifest::UNPACKED. | 39 // Defaults to Manifest::UNPACKED. |
| 40 ExtensionBuilder& SetLocation(Manifest::Location location); | 40 ExtensionBuilder& SetLocation(Manifest::Location location); |
| 41 | 41 |
| 42 ExtensionBuilder& SetManifest(scoped_ptr<base::DictionaryValue> manifest); | 42 ExtensionBuilder& SetManifest(scoped_ptr<base::DictionaryValue> manifest); |
| 43 ExtensionBuilder& SetManifest(DictionaryBuilder manifest_builder) { | |
| 44 return SetManifest(manifest_builder.Build()); | |
| 45 } | |
| 46 | 43 |
| 47 // Adds the keys from the DictionaryBuilder to the manifest, with new keys | 44 // Merge another manifest into the current manifest, with new keys taking |
| 48 // taking precedence. | 45 // precedence. |
| 49 ExtensionBuilder& MergeManifest(DictionaryBuilder& builder); | 46 ExtensionBuilder& MergeManifest(scoped_ptr<base::DictionaryValue> manifest); |
| 50 | 47 |
| 51 ExtensionBuilder& AddFlags(int init_from_value_flags); | 48 ExtensionBuilder& AddFlags(int init_from_value_flags); |
| 52 | 49 |
| 53 // Defaults to the default extension ID created in Extension::Create. | 50 // Defaults to the default extension ID created in Extension::Create. |
| 54 ExtensionBuilder& SetID(const std::string& id); | 51 ExtensionBuilder& SetID(const std::string& id); |
| 55 | 52 |
| 56 private: | 53 private: |
| 57 base::FilePath path_; | 54 base::FilePath path_; |
| 58 Manifest::Location location_; | 55 Manifest::Location location_; |
| 59 scoped_ptr<base::DictionaryValue> manifest_; | 56 scoped_ptr<base::DictionaryValue> manifest_; |
| 60 int flags_; | 57 int flags_; |
| 61 std::string id_; | 58 std::string id_; |
| 62 | 59 |
| 63 DISALLOW_COPY_AND_ASSIGN(ExtensionBuilder); | 60 DISALLOW_COPY_AND_ASSIGN(ExtensionBuilder); |
| 64 }; | 61 }; |
| 65 | 62 |
| 66 } // namespace extensions | 63 } // namespace extensions |
| 67 | 64 |
| 68 #endif // EXTENSIONS_COMMON_EXTENSION_BUILDER_H_ | 65 #endif // EXTENSIONS_COMMON_EXTENSION_BUILDER_H_ |
| OLD | NEW |