diff --git a/core/lib/Drupal/Core/Ajax/CloseDialogCommand.php b/core/lib/Drupal/Core/Ajax/CloseDialogCommand.php
new file mode 100644
index 0000000..a237239
--- /dev/null
+++ b/core/lib/Drupal/Core/Ajax/CloseDialogCommand.php
@@ -0,0 +1,24 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\Core\Ajax\CloseDialogCommand.
+ */
+
+namespace Drupal\Core\Ajax;
+
+/**
+ * Defines an AJAX command that closes the current active dialog.
+ */
+class CloseDialogCommand implements CommandInterface {
+
+  /**
+   * Implements \Drupal\Core\Ajax\CommandInterface::render().
+   */
+  public function render() {
+    return array(
+      'command' => 'closeDialog',
+    );
+  }
+
+}
diff --git a/core/lib/Drupal/Core/Ajax/OpenDialogCommand.php b/core/lib/Drupal/Core/Ajax/OpenDialogCommand.php
new file mode 100644
index 0000000..5def98e
--- /dev/null
+++ b/core/lib/Drupal/Core/Ajax/OpenDialogCommand.php
@@ -0,0 +1,54 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\Core\Ajax\OpenDialogCommand.
+ */
+
+namespace Drupal\Core\Ajax;
+
+/**
+ * Defines an AJAX command to open certain content in a dialog.
+ */
+class OpenDialogCommand extends InsertCommand {
+
+ /**
+   * Stores the title of the dialog.
+   *
+   * @var string
+   */
+  protected $title;
+
+  /**
+   * Constructs an InsertDialogCommand object.
+   *
+   * @param string $title
+   *   The title of the dialog.
+   * @param string $html
+   *   String of HTML that will replace the matched element(s).
+   * @param array $settings
+   *   An array of JavaScript settings to be passed to any attached behaviors.
+   * @internal param string $selector A CSS selector.*   A CSS selector.
+   */
+  public function __construct($title, $html, array $settings = NULL) {
+      $this->title = $title;
+      $this->html = $html;
+      $this->settings = $settings;
+    }
+
+  /**
+   * Implements Drupal\Core\Ajax\CommandInterface:render().
+   */
+  public function render() {
+    // @todo Should it be able to control the dialog settings?
+    return array(
+      'command' => 'insert',
+      'method' => NULL,
+      'title' => $this->title,
+      'selector' => '#drupal-modal',
+      'data' => $this->html,
+      'settings' => $this->settings,
+    );
+  }
+
+}
diff --git a/core/misc/dialog.ajax.js b/core/misc/dialog.ajax.js
new file mode 100644
index 0000000..d21845e
--- /dev/null
+++ b/core/misc/dialog.ajax.js
@@ -0,0 +1,21 @@
+/**
+ * @file
+ *
+ * Integrates the dialog API with the drupal AJAX commands.
+ */
+
+(function ($, Drupal, drupalSettings) {
+
+"use strict";
+
+  /**
+    * Command to close a modal dialog.
+    */
+  Drupal.ajax.prototype.commands.dialog_close = function (ajax, response, status) {
+    var $modal = $("#drupal-modal");
+    if ($modal.length) {
+      $modal.dialog.close(1);
+    }
+  };
+
+})(jQuery, Drupal, drupalSettings);
