equal
deleted
inserted
replaced
|
1 // Copyright (c) 2009 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 package org.chromium.sdk; |
|
6 |
|
7 /** |
|
8 * An object that represents a variable in a browser JavaScript VM call frame. |
|
9 */ |
|
10 public interface JsVariable { |
|
11 |
|
12 /** |
|
13 * A callback to use while setting a variable value. |
|
14 */ |
|
15 interface SetValueCallback { |
|
16 void success(); |
|
17 |
|
18 void failure(String errorMessage); |
|
19 } |
|
20 |
|
21 /** |
|
22 * @return whether it is possible to read this variable |
|
23 */ |
|
24 boolean isReadable(); |
|
25 |
|
26 /** |
|
27 * Returns the value of this variable. |
|
28 * |
|
29 * @return a [probably compound] JsValue corresponding to this variable. |
|
30 * {@code null} if there was an error reading the value data |
|
31 * @see #isReadable() |
|
32 * @throws UnsupportedOperationException if this variable is not readable |
|
33 */ |
|
34 JsValue getValue() throws UnsupportedOperationException; |
|
35 |
|
36 /** |
|
37 * @return the name of this variable |
|
38 */ |
|
39 String getName(); |
|
40 |
|
41 /** |
|
42 * @return whether it is possible to modify this variable |
|
43 */ |
|
44 boolean isMutable(); |
|
45 |
|
46 /** |
|
47 * Sets a new value for this variable. |
|
48 * |
|
49 * @param newValue to set |
|
50 * @param callback to report the operation result to |
|
51 * @see #isMutable() |
|
52 * @throws UnsupportedOperationException if this variable is not mutable |
|
53 */ |
|
54 void setValue(String newValue, SetValueCallback callback) |
|
55 throws UnsupportedOperationException; |
|
56 |
|
57 /** |
|
58 * @return the fully qualified name of this variable relative to the context |
|
59 * of its call frame |
|
60 */ |
|
61 String getFullyQualifiedName(); |
|
62 |
|
63 } |