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

Unified Diff: dart/site/try/src/user_option.dart

Issue 197923002: Mock up code completion. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Merged with r34309. Created 6 years, 9 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 | « dart/site/try/src/ui.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/site/try/src/user_option.dart
diff --git a/dart/site/try/src/user_option.dart b/dart/site/try/src/user_option.dart
new file mode 100644
index 0000000000000000000000000000000000000000..ce802a46cbb3f96d1b4c814018b38176fa928038
--- /dev/null
+++ b/dart/site/try/src/user_option.dart
@@ -0,0 +1,43 @@
+// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library trydart.userOption;
+
+class UserOption {
+ final String name;
+
+ final bool isHidden;
+
+ static var storage;
+
+ const UserOption(this.name, {this.isHidden: false});
+
+ get value => storage[name];
+
+ void set value(newValue) {
+ storage[name] = newValue;
+ }
+}
+
+class BooleanUserOption extends UserOption {
+ const BooleanUserOption(String name, {bool isHidden: false})
+ : super(name, isHidden: isHidden);
+
+ bool get value => super.value == 'true';
+
+ void set value(bool newValue) {
+ super.value = '$newValue';
+ }
+}
+
+class StringUserOption extends UserOption {
+ const StringUserOption(String name, {bool isHidden: false})
+ : super(name, isHidden: isHidden);
+
+ String get value => super.value == null ? '' : super.value;
+
+ void set value(String newValue) {
+ super.value = newValue;
+ }
+}
« no previous file with comments | « dart/site/try/src/ui.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698