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

Unified Diff: plugins/org.chromium.sdk/src/org/chromium/sdk/JsDeclarativeVariable.java

Issue 12300043: Move setValue operation into a separate JsDeclarativeVariable interface (Closed) Base URL: https://chromedevtools.googlecode.com/svn/trunk
Patch Set: fcr 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 side-by-side diff with in-line comments
Download patch
Index: plugins/org.chromium.sdk/src/org/chromium/sdk/JsDeclarativeVariable.java
diff --git a/plugins/org.chromium.sdk/src/org/chromium/sdk/JsDeclarativeVariable.java b/plugins/org.chromium.sdk/src/org/chromium/sdk/JsDeclarativeVariable.java
new file mode 100644
index 0000000000000000000000000000000000000000..a4dc4552b44c8855924a87cf18f944d95dc9fbfe
--- /dev/null
+++ b/plugins/org.chromium.sdk/src/org/chromium/sdk/JsDeclarativeVariable.java
@@ -0,0 +1,46 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.sdk;
+
+/**
+ * A variable from JavaScript declarative scope. This variable is backed by a property
+ * of any object, instead it is a variable that has been explicitly declared in program,
+ * for example with 'var' keyword.
+ * <p>This variable explicitly supports mutation operation.
+ * @see {@link JsScope.Declarative}
+ */
+public interface JsDeclarativeVariable extends JsVariable {
+ /**
+ * @return whether it is possible to modify this variable
+ */
+ boolean isMutable();
+
+ /**
+ * Sets a new value for this variable.
+ *
+ * @param newValue to set
+ * @param callback to report the operation result to
+ * @param syncCallback to report the end of any processing
+ * @see #isMutable()
+ * @throws UnsupportedOperationException if this variable is not mutable
+ */
+ RelayOk setValue(JsValue newValue, SetValueCallback callback, SyncCallback syncCallback)
+ throws UnsupportedOperationException;
+
+ /**
+ * A callback to use while setting a variable value.
+ */
+ interface SetValueCallback {
+ /**
+ * Variable is successfully updated. New value is available in {@link JsVariable#getValue()}.
+ */
+ void success();
+
+ /**
+ * Variable hasn't been updated for unknown reason.
+ */
+ void failure(Exception cause);
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698