| 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/common/extensions/extension_builder.h" | 5 #include "chrome/common/extensions/extension_builder.h" |
| 6 | 6 |
| 7 #include "chrome/common/extensions/extension.h" | 7 #include "chrome/common/extensions/extension.h" |
| 8 | 8 |
| 9 namespace extensions { | 9 namespace extensions { |
| 10 | 10 |
| 11 ExtensionBuilder::ExtensionBuilder() | 11 ExtensionBuilder::ExtensionBuilder() |
| 12 : location_(Extension::LOAD), | 12 : location_(Manifest::LOAD), |
| 13 flags_(Extension::NO_FLAGS) { | 13 flags_(Extension::NO_FLAGS) { |
| 14 } | 14 } |
| 15 ExtensionBuilder::~ExtensionBuilder() {} | 15 ExtensionBuilder::~ExtensionBuilder() {} |
| 16 | 16 |
| 17 scoped_refptr<Extension> ExtensionBuilder::Build() { | 17 scoped_refptr<Extension> ExtensionBuilder::Build() { |
| 18 std::string error; | 18 std::string error; |
| 19 scoped_refptr<Extension> extension = Extension::Create( | 19 scoped_refptr<Extension> extension = Extension::Create( |
| 20 path_, | 20 path_, |
| 21 location_, | 21 location_, |
| 22 *manifest_, | 22 *manifest_, |
| 23 flags_, | 23 flags_, |
| 24 id_, | 24 id_, |
| 25 &error); | 25 &error); |
| 26 CHECK_EQ("", error); | 26 CHECK_EQ("", error); |
| 27 return extension; | 27 return extension; |
| 28 } | 28 } |
| 29 | 29 |
| 30 ExtensionBuilder& ExtensionBuilder::SetPath(const FilePath& path) { | 30 ExtensionBuilder& ExtensionBuilder::SetPath(const FilePath& path) { |
| 31 path_ = path; | 31 path_ = path; |
| 32 return *this; | 32 return *this; |
| 33 } | 33 } |
| 34 | 34 |
| 35 ExtensionBuilder& ExtensionBuilder::SetLocation(Extension::Location location) { | 35 ExtensionBuilder& ExtensionBuilder::SetLocation(Manifest::Location location) { |
| 36 location_ = location; | 36 location_ = location; |
| 37 return *this; | 37 return *this; |
| 38 } | 38 } |
| 39 | 39 |
| 40 ExtensionBuilder& ExtensionBuilder::SetManifest( | 40 ExtensionBuilder& ExtensionBuilder::SetManifest( |
| 41 scoped_ptr<DictionaryValue> manifest) { | 41 scoped_ptr<DictionaryValue> manifest) { |
| 42 manifest_ = manifest.Pass(); | 42 manifest_ = manifest.Pass(); |
| 43 return *this; | 43 return *this; |
| 44 } | 44 } |
| 45 | 45 |
| 46 ExtensionBuilder& ExtensionBuilder::AddFlags(int init_from_value_flags) { | 46 ExtensionBuilder& ExtensionBuilder::AddFlags(int init_from_value_flags) { |
| 47 flags_ |= init_from_value_flags; | 47 flags_ |= init_from_value_flags; |
| 48 return *this; | 48 return *this; |
| 49 } | 49 } |
| 50 | 50 |
| 51 ExtensionBuilder& ExtensionBuilder::SetID(const std::string& id) { | 51 ExtensionBuilder& ExtensionBuilder::SetID(const std::string& id) { |
| 52 id_ = id; | 52 id_ = id; |
| 53 return *this; | 53 return *this; |
| 54 } | 54 } |
| 55 | 55 |
| 56 } // namespace extensions | 56 } // namespace extensions |
| OLD | NEW |