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

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

Issue 12093036: Move Extension Location and Type enums to Manifest, and move InstallWarning to its own file. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 months 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
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 #ifndef CHROME_COMMON_EXTENSIONS_EXTENSION_BUILDER_H_ 5 #ifndef CHROME_COMMON_EXTENSIONS_EXTENSION_BUILDER_H_
6 #define CHROME_COMMON_EXTENSIONS_EXTENSION_BUILDER_H_ 6 #define CHROME_COMMON_EXTENSIONS_EXTENSION_BUILDER_H_
7 7
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "chrome/common/extensions/extension.h" 10 #include "chrome/common/extensions/extension.h"
11 #include "chrome/common/extensions/manifest.h"
11 #include "chrome/common/extensions/value_builder.h" 12 #include "chrome/common/extensions/value_builder.h"
12 13
13 namespace extensions { 14 namespace extensions {
14 15
15 // An easier way to create extensions than Extension::Create. The 16 // An easier way to create extensions than Extension::Create. The
16 // constructor sets up some defaults which are customized using the 17 // constructor sets up some defaults which are customized using the
17 // methods. The only method that must be called is SetManifest(). 18 // methods. The only method that must be called is SetManifest().
18 class ExtensionBuilder { 19 class ExtensionBuilder {
19 public: 20 public:
20 ExtensionBuilder(); 21 ExtensionBuilder();
21 ~ExtensionBuilder(); 22 ~ExtensionBuilder();
22 23
23 // Can only be called once, after which it's invalid to use the builder. 24 // Can only be called once, after which it's invalid to use the builder.
24 // CHECKs that the extension was created successfully. 25 // CHECKs that the extension was created successfully.
25 scoped_refptr<Extension> Build(); 26 scoped_refptr<Extension> Build();
26 27
27 // Defaults to FilePath(). 28 // Defaults to FilePath().
28 ExtensionBuilder& SetPath(const FilePath& path); 29 ExtensionBuilder& SetPath(const FilePath& path);
29 30
30 // Defaults to Extension::LOAD. 31 // Defaults to Manifest::LOAD.
31 ExtensionBuilder& SetLocation(Extension::Location location); 32 ExtensionBuilder& SetLocation(Manifest::Location location);
32 33
33 ExtensionBuilder& SetManifest(scoped_ptr<base::DictionaryValue> manifest); 34 ExtensionBuilder& SetManifest(scoped_ptr<base::DictionaryValue> manifest);
34 ExtensionBuilder& SetManifest(DictionaryBuilder& manifest_builder) { 35 ExtensionBuilder& SetManifest(DictionaryBuilder& manifest_builder) {
35 return SetManifest(manifest_builder.Build()); 36 return SetManifest(manifest_builder.Build());
36 } 37 }
37 38
38 ExtensionBuilder& AddFlags(int init_from_value_flags); 39 ExtensionBuilder& AddFlags(int init_from_value_flags);
39 40
40 // Defaults to the default extension ID created in Extension::Create. 41 // Defaults to the default extension ID created in Extension::Create.
41 ExtensionBuilder& SetID(const std::string& id); 42 ExtensionBuilder& SetID(const std::string& id);
42 43
43 private: 44 private:
44 FilePath path_; 45 FilePath path_;
45 Extension::Location location_; 46 Manifest::Location location_;
46 scoped_ptr<base::DictionaryValue> manifest_; 47 scoped_ptr<base::DictionaryValue> manifest_;
47 int flags_; 48 int flags_;
48 std::string id_; 49 std::string id_;
49 }; 50 };
50 51
51 } // namespace extensions 52 } // namespace extensions
52 53
53 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_BUILDER_H_ 54 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_BUILDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698