Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(340)

Side by Side Diff: chrome/common/extensions/extension_builder.cc

Issue 48643003: Moved extension and value builder code to extensions component. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase again Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/common/extensions/extension_builder.h"
6
7 #include "chrome/common/extensions/extension.h"
8
9 namespace extensions {
10
11 ExtensionBuilder::ExtensionBuilder()
12 : location_(Manifest::UNPACKED),
13 flags_(Extension::NO_FLAGS) {
14 }
15 ExtensionBuilder::~ExtensionBuilder() {}
16
17 scoped_refptr<Extension> ExtensionBuilder::Build() {
18 std::string error;
19 scoped_refptr<Extension> extension = Extension::Create(
20 path_,
21 location_,
22 *manifest_,
23 flags_,
24 id_,
25 &error);
26 CHECK_EQ("", error);
27 return extension;
28 }
29
30 ExtensionBuilder& ExtensionBuilder::SetPath(const base::FilePath& path) {
31 path_ = path;
32 return *this;
33 }
34
35 ExtensionBuilder& ExtensionBuilder::SetLocation(Manifest::Location location) {
36 location_ = location;
37 return *this;
38 }
39
40 ExtensionBuilder& ExtensionBuilder::SetManifest(
41 scoped_ptr<base::DictionaryValue> manifest) {
42 manifest_ = manifest.Pass();
43 return *this;
44 }
45
46 ExtensionBuilder& ExtensionBuilder::MergeManifest(DictionaryBuilder& builder) {
47 manifest_->MergeDictionary(builder.Build().get());
48 return *this;
49 }
50
51 ExtensionBuilder& ExtensionBuilder::AddFlags(int init_from_value_flags) {
52 flags_ |= init_from_value_flags;
53 return *this;
54 }
55
56 ExtensionBuilder& ExtensionBuilder::SetID(const std::string& id) {
57 id_ = id;
58 return *this;
59 }
60
61 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/common/extensions/extension_builder.h ('k') | chrome/common/extensions/extension_test_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698