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

Unified Diff: lib/html/dartium/html_dartium.dart

Issue 10378040: Generate and use cross frame wrappers for types in other frames/windows. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Factored out template Created 8 years, 7 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:
Download patch
Index: lib/html/dartium/html_dartium.dart
diff --git a/lib/html/dartium/html_dartium.dart b/lib/html/dartium/html_dartium.dart
index 1b8c4e42c662de3faa405572a80817205e77c1e7..57b36823eb84d684593dde6ff46871f79ad32459 100644
--- a/lib/html/dartium/html_dartium.dart
+++ b/lib/html/dartium/html_dartium.dart
@@ -596,6 +596,144 @@ spawnDomIsolate(Window targetWindow, String entryPoint) =>
dom.LayoutTestController get layoutTestController() =>
dom.layoutTestController;
+class _HistoryCrossFrameImpl implements History {
+
+ void back() {
+ _ptr.back();
+ return;
+ }
+
+ void forward() {
+ _ptr.forward();
+ return;
+ }
+
+ void go(int distance) {
+ _ptr.go(distance);
+ return;
+ }
+
+ // Implementation.
+ _HistoryImpl _ptr;
+
+ _HistoryCrossFrameImpl._(this._ptr);
+
+ static _createSafe(ptr) {
+ if (ptr === window.history) {
+ return window.history;
+ } else {
+ // TODO(vsm): Should we cache to try to get reference equality?
+ return new _HistoryCrossFrameImpl._(ptr);
+ }
+ }
+
+ operator ==(other) {
+ return (other is _HistoryCrossFrameImpl) &&
+ (this._ptr === other._ptr);
+ }
+}
+
+class _LocationCrossFrameImpl implements Location {
+
+ void set href(String value) { _ptr.href = value; }
+
+ // Implementation.
+ _LocationImpl _ptr;
+
+ _LocationCrossFrameImpl._(this._ptr);
+
+ static _createSafe(ptr) {
+ if (ptr === window.location) {
+ return window.location;
+ } else {
+ // TODO(vsm): Should we cache to try to get reference equality?
+ return new _LocationCrossFrameImpl._(ptr);
+ }
+ }
+
+ operator ==(other) {
+ return (other is _LocationCrossFrameImpl) &&
+ (this._ptr === other._ptr);
+ }
+}
+
+class _WindowCrossFrameImpl implements Window {
+
+ bool get closed() => _ptr.closed;
+
+ Window get frames() => _ptr.frames;
+
+ History get history() => _ptr.history;
+
+ int get length() => _ptr.length;
+
+ Location get location() => _ptr.location;
+
+ void set location(Location value) { _ptr.location = value; }
+
+ Window get opener() => _ptr.opener;
+
+ Window get parent() => _ptr.parent;
+
+ Window get self() => _ptr.self;
+
+ Window get top() => _ptr.top;
+
+ void blur() {
+ _ptr.blur();
+ return;
+ }
+
+ void close() {
+ _ptr.close();
+ return;
+ }
+
+ void focus() {
+ _ptr.focus();
+ return;
+ }
+
+ void postMessage(/*SerializedScriptValue*/ message, String targetOrigin, [List messagePorts = null]) {
+ if (messagePorts === null) {
+ _ptr.postMessage(message, targetOrigin, messagePorts);
+ return;
+ } else {
+ _ptr.postMessage(message, targetOrigin, messagePorts);
+ return;
+ }
+ }
+
+ void webkitPostMessage(/*SerializedScriptValue*/ message, String targetOrigin, [List transferList = null]) {
+ if (transferList === null) {
+ _ptr.webkitPostMessage(message, targetOrigin, transferList);
+ return;
+ } else {
+ _ptr.webkitPostMessage(message, targetOrigin, transferList);
+ return;
+ }
+ }
+
+ // Implementation.
+ _WindowImpl _ptr;
+
+ _WindowCrossFrameImpl._(this._ptr);
+
+ static _createSafe(ptr) {
+ if (ptr === window) {
+ return window;
+ } else {
+ // TODO(vsm): Should we cache to try to get reference equality?
+ return new _WindowCrossFrameImpl._(ptr);
+ }
+ }
+
+ operator ==(other) {
+ return (other is _WindowCrossFrameImpl) &&
+ (this._ptr === other._ptr);
+ }
+}
+
class _AbstractWorkerImpl extends _EventTargetImpl implements AbstractWorker {
_AbstractWorkerImpl._wrap(ptr) : super._wrap(ptr);
@@ -9852,8 +9990,6 @@ class _FormElementImpl extends _ElementImpl implements FormElement {
class _FrameElementImpl extends _ElementImpl implements FrameElement {
_FrameElementImpl._wrap(ptr) : super._wrap(ptr);
- Document get contentDocument() => _wrap(_ptr.contentDocument);
-
Window get contentWindow() => _wrap(_ptr.contentWindow);
String get frameBorder() => _wrap(_ptr.frameBorder);
@@ -10739,8 +10875,6 @@ class _IFrameElementImpl extends _ElementImpl implements IFrameElement {
void set align(String value) { _ptr.align = _unwrap(value); }
- Document get contentDocument() => _wrap(_ptr.contentDocument);
-
Window get contentWindow() => _wrap(_ptr.contentWindow);
String get frameBorder() => _wrap(_ptr.frameBorder);
@@ -13336,8 +13470,6 @@ class _ObjectElementImpl extends _ElementImpl implements ObjectElement {
void set codeType(String value) { _ptr.codeType = _unwrap(value); }
- Document get contentDocument() => _wrap(_ptr.contentDocument);
-
String get data() => _wrap(_ptr.data);
void set data(String value) { _ptr.data = _unwrap(value); }
@@ -21522,8 +21654,6 @@ class _WindowImpl extends _EventTargetImpl implements Window {
Event get event() => _wrap(_ptr.event);
- Element get frameElement() => _wrap(_ptr.frameElement);
-
Window get frames() => _wrap(_ptr.frames);
History get history() => _wrap(_ptr.history);
@@ -21606,8 +21736,6 @@ class _WindowImpl extends _EventTargetImpl implements Window {
StorageInfo get webkitStorageInfo() => _wrap(_ptr.webkitStorageInfo);
- Window get window() => _wrap(_ptr.window);
-
void $dom_addEventListener(String type, EventListener listener, [bool useCapture = null]) {
if (useCapture === null) {
_ptr.addEventListener(_unwrap(type), _unwrap(listener));
@@ -29414,9 +29542,6 @@ interface FormElement extends Element {
/// @domName HTMLFrameElement
interface FrameElement extends Element {
- /** @domName HTMLFrameElement.contentDocument */
- final Document contentDocument;
-
/** @domName HTMLFrameElement.contentWindow */
final Window contentWindow;
@@ -30170,9 +30295,6 @@ interface IFrameElement extends Element {
/** @domName HTMLIFrameElement.align */
String align;
- /** @domName HTMLIFrameElement.contentDocument */
- final Document contentDocument;
-
/** @domName HTMLIFrameElement.contentWindow */
final Window contentWindow;
@@ -32330,9 +32452,6 @@ interface ObjectElement extends Element {
/** @domName HTMLObjectElement.codeType */
String codeType;
- /** @domName HTMLObjectElement.contentDocument */
- final Document contentDocument;
-
/** @domName HTMLObjectElement.data */
String data;
@@ -40016,9 +40135,6 @@ interface Window extends EventTarget {
/** @domName DOMWindow.event */
final Event event;
- /** @domName DOMWindow.frameElement */
- final Element frameElement;
-
/** @domName DOMWindow.frames */
final Window frames;
@@ -40133,9 +40249,6 @@ interface Window extends EventTarget {
/** @domName DOMWindow.webkitStorageInfo */
final StorageInfo webkitStorageInfo;
- /** @domName DOMWindow.window */
- final Window window;
-
/** @domName DOMWindow.addEventListener */
void $dom_addEventListener(String type, EventListener listener, [bool useCapture]);

Powered by Google App Engine
This is Rietveld 408576698