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

Unified Diff: packages/plugin/notes.txt

Issue 2990843002: Removed fixed dependencies (Closed)
Patch Set: Created 3 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « packages/plugin/lib/src/plugin_impl.dart ('k') | packages/plugin/pubspec.yaml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: packages/plugin/notes.txt
diff --git a/packages/plugin/notes.txt b/packages/plugin/notes.txt
new file mode 100644
index 0000000000000000000000000000000000000000..fd9ab65c90b8a60590856203e0164dfa433a93fb
--- /dev/null
+++ b/packages/plugin/notes.txt
@@ -0,0 +1,63 @@
+--------------------------------------------------------------------------------
+
+To provide a psuedo backward compatible layer.
+
+In plugin.dart:
+
+/**
+ * A function used to register an extension point with the given simple
+ * [identifier]. If given, the [validator] will be used to validate extensions
+ * to the extension point.
+ *
+ * An [ExtensionError] will be thrown if the extension point cannot be
+ * registered, such as when a plugin attempts to define two extension points
+ * with the same simple identifier.
+ */
+typedef ExtensionPoint RegisterExtensionPoint(String identifier,
+ [ValidateExtension validateExtension]);
+
+class Plugin {
+ /**
+ * Use the [register] function to register all of the extension points
+ * contributed by this plugin.
+ *
+ * Clients should not invoke the [register] function after this method has
+ * returned.
+ *
+ * This method is deprecated and will be removed in the next breaking release.
+ * Plugins should migrate to using [registerExtensionPoints2].
+ */
+ void registerExtensionPoints(RegisterExtensionPoint register);
+}
+
+In plugin_impl.dart:
+
+class ExtensionManager {
+
+ In processPlugins:
+
+ for (Plugin plugin in plugins) {
+ plugin.registerExtensionPoints((String identifier,
+ [ValidateExtension validateExtension]) =>
+ registerExtensionPoint(plugin, identifier, validateExtension));
+ }
+
+ /**
+ * Register an extension point being defined by the given [plugin] with the
+ * given simple [identifier] and [validateExtension].
+ */
+ ExtensionPoint registerExtensionPoint(
+ Plugin plugin, String identifier, ValidateExtension validateExtension) {
+ String uniqueIdentifier = Plugin.buildUniqueIdentifier(plugin, identifier);
+ if (extensionPoints.containsKey(uniqueIdentifier)) {
+ throw new ExtensionError(
+ 'There is already an extension point with the id "$identifier"');
+ }
+ ExtensionPointImpl extensionPoint =
+ new ExtensionPointImpl(plugin, identifier, validateExtension);
+ extensionPoints[uniqueIdentifier] = extensionPoint;
+ return extensionPoint;
+ }
+}
+
+--------------------------------------------------------------------------------
« no previous file with comments | « packages/plugin/lib/src/plugin_impl.dart ('k') | packages/plugin/pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698