 .../lib/Drupal/ckeditor/CKEditorPluginManager.php  |   52 +++++++++++++++++++-
 .../lib/Drupal/ckeditor/Plugin/Editor/CKEditor.php |   14 +++---
 .../ckeditor/Tests/CKEditorPluginManagerTest.php   |   20 ++++----
 3 files changed, 67 insertions(+), 19 deletions(-)

diff --git a/core/modules/ckeditor/lib/Drupal/ckeditor/CKEditorPluginManager.php b/core/modules/ckeditor/lib/Drupal/ckeditor/CKEditorPluginManager.php
index da2bcfd..6db6126 100644
--- a/core/modules/ckeditor/lib/Drupal/ckeditor/CKEditorPluginManager.php
+++ b/core/modules/ckeditor/lib/Drupal/ckeditor/CKEditorPluginManager.php
@@ -40,7 +40,7 @@ public function __construct(\Traversable $namespaces, CacheBackendInterface $cac
   }
 
   /**
-   * Determines which plug-ins are enabled.
+   * Retrieves enabled plugins' files, keyed by plugin ID.
    *
    * For CKEditor plugins that implement:
    *  - CKEditorPluginButtonsInterface, not CKEditorPluginContextualInterface,
@@ -63,8 +63,40 @@ public function __construct(\Traversable $namespaces, CacheBackendInterface $cac
    *   A list of the enabled CKEditor plugins, with the plugin IDs as keys and
    *   the Drupal root-relative plugin files as values.
    *   For internal plugins, the value is NULL.
+   *
+   * @deprecated as of Drupal 8.0. Use
+   *   CKEditorPluginManager::getEnabledPluginFiles() instead.
    */
   public function getEnabledPlugins(Editor $editor, $include_internal_plugins = FALSE) {
+    return $this->getEnabledPluginFiles($editor, $include_internal_plugins);
+  }
+
+  /**
+   * Retrieves enabled plugins' files, keyed by plugin ID.
+   *
+   * For CKEditor plugins that implement:
+   *  - CKEditorPluginButtonsInterface, not CKEditorPluginContextualInterface,
+   *     a plugin is enabled if at least one of its buttons is in the toolbar;
+   *  - CKEditorPluginContextualInterface, not CKEditorPluginButtonsInterface,
+   *     a plugin is enabled if its isEnabled() method returns TRUE
+   *  - both of these interfaces, a plugin is enabled if either is the case.
+   *
+   * Internal plugins (those that are part of the bundled build of CKEditor) are
+   * excluded by default, since they are loaded implicitly. If you need to know
+   * even implicitly loaded (i.e. internal) plugins, then set the optional
+   * second parameter.
+   *
+   * @param \Drupal\editor\Plugin\Core\Entity\Editor $editor
+   *   A configured text editor object.
+   * @param bool $include_internal_plugins
+   *   Defaults to FALSE. When set to TRUE, plugins whose isInternal() method
+   *   returns TRUE will also be included.
+   * @return array
+   *   A list of the enabled CKEditor plugins, with the plugin IDs as keys and
+   *   the Drupal root-relative plugin files as values.
+   *   For internal plugins, the value is NULL.
+   */
+  public function getEnabledPluginFiles(Editor $editor, $include_internal_plugins = FALSE) {
     $plugins = array_keys($this->getDefinitions());
     $toolbar_buttons = array_unique(NestedArray::mergeDeepArray($editor->settings['toolbar']['buttons']));
     $enabled_plugins = array();
@@ -108,7 +140,7 @@ public function getEnabledPlugins(Editor $editor, $include_internal_plugins = FA
   }
 
   /**
-   * Retrieves all plugins that implement CKEditorPluginButtonsInterface.
+   * Retrieves all available CKEditor buttons, keyed by plugin ID.
    *
    * @return array
    *   A list of the CKEditor plugins that implement buttons, with the plugin
@@ -116,8 +148,24 @@ public function getEnabledPlugins(Editor $editor, $include_internal_plugins = FA
    *   as values.
    *
    * @see CKEditorPluginButtonsInterface::getButtons()
+   *
+   * @deprecated as of Drupal 8.0. Use
+   *   CKEditorPluginManager::getButtons() instead.
    */
   public function getButtonsPlugins() {
+    $this->getButtons();
+  }
+
+  /**
+   * Retrieves all available CKEditor buttons, keyed by plugin ID.
+   *
+   * @return array
+   *   All availble CKEditor buttons, with plugin IDs as keys and button
+   *   metadata (as implemented by getButtons()) as values.
+   *
+   * @see CKEditorPluginButtonsInterface::getButtons()
+   */
+  public function getButtons() {
     $plugins = array_keys($this->getDefinitions());
     $buttons_plugins = array();
 
diff --git a/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/Editor/CKEditor.php b/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/Editor/CKEditor.php
index 5b79bf2..eca1381 100644
--- a/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/Editor/CKEditor.php
+++ b/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/Editor/CKEditor.php
@@ -86,7 +86,7 @@ public function settingsForm(array $form, array &$form_state, EditorEntity $edit
     $ckeditor_settings_toolbar = array(
       '#theme' => 'ckeditor_settings_toolbar',
       '#editor' => $editor,
-      '#plugins' => $this->ckeditorPluginManager->getButtonsPlugins(),
+      '#plugins' => $this->ckeditorPluginManager->getButtons(),
     );
     $form['toolbar'] = array(
       '#type' => 'container',
@@ -135,7 +135,7 @@ public function settingsForm(array $form, array &$form_state, EditorEntity $edit
       }
     }
     // Get a list of all buttons that are provided by all plugins.
-    $all_buttons = array_reduce($this->ckeditorPluginManager->getButtonsPlugins(), function($result, $item) {
+    $all_buttons = array_reduce($this->ckeditorPluginManager->getButtons(), function($result, $item) {
       return array_merge($result, array_keys($item));
     }, array());
     // Build a fake Editor object, which we'll use to generate JavaScript
@@ -196,18 +196,18 @@ public function getJSSettings(EditorEntity $editor) {
     $settings = array();
 
     // Get the settings for all enabled plugins, even the internal ones.
-    $enabled_plugins = array_keys($this->ckeditorPluginManager->getEnabledPlugins($editor, TRUE));
+    $enabled_plugins = array_keys($this->ckeditorPluginManager->getEnabledPluginFiles($editor, TRUE));
     foreach ($enabled_plugins as $plugin_id) {
       $plugin = $this->ckeditorPluginManager->createInstance($plugin_id);
       $settings += $plugin->getConfig($editor);
     }
 
     // Next, set the most fundamental CKEditor settings.
-    $external_plugins = $this->ckeditorPluginManager->getEnabledPlugins($editor);
+    $external_plugin_files = $this->ckeditorPluginManager->getEnabledPluginFiles($editor);
     $settings += array(
       'toolbar' => $this->buildToolbarJSSetting($editor),
       'contentsCss' => $this->buildContentsCssJSSetting($editor),
-      'extraPlugins' => implode(',', array_keys($external_plugins)),
+      'extraPlugins' => implode(',', array_keys($external_plugin_files)),
       // @todo: Remove image and link plugins from CKEditor build.
       'removePlugins' => 'image,link',
       'language' => $language_interface->id,
@@ -221,7 +221,7 @@ public function getJSSettings(EditorEntity $editor) {
 
     // Finally, set Drupal-specific CKEditor settings.
     $settings += array(
-      'drupalExternalPlugins' => array_map('file_create_url', $external_plugins),
+      'drupalExternalPlugins' => array_map('file_create_url', $external_plugin_files),
     );
 
     ksort($settings);
@@ -238,7 +238,7 @@ public function getLibraries(EditorEntity $editor) {
     );
 
     // Get the required libraries for any enabled plugins.
-    $enabled_plugins = array_keys($this->ckeditorPluginManager->getEnabledPlugins($editor));
+    $enabled_plugins = array_keys($this->ckeditorPluginManager->getEnabledPluginFiles($editor));
     foreach ($enabled_plugins as $plugin_id) {
       $plugin = $this->ckeditorPluginManager->createInstance($plugin_id);
       $additional_libraries = array_udiff($plugin->getLibraries($editor), $libraries, function($a, $b) {
diff --git a/core/modules/ckeditor/lib/Drupal/ckeditor/Tests/CKEditorPluginManagerTest.php b/core/modules/ckeditor/lib/Drupal/ckeditor/Tests/CKEditorPluginManagerTest.php
index 3d31c04..cee1e75 100644
--- a/core/modules/ckeditor/lib/Drupal/ckeditor/Tests/CKEditorPluginManagerTest.php
+++ b/core/modules/ckeditor/lib/Drupal/ckeditor/Tests/CKEditorPluginManagerTest.php
@@ -74,8 +74,8 @@ function testEnabledPlugins() {
       'drupalimage' => 'core/modules/ckeditor/js/plugins/drupalimage/plugin.js',
       'drupallink' => 'core/modules/ckeditor/js/plugins/drupallink/plugin.js',
     );
-    $this->assertIdentical($enabled_plugins, $this->manager->getEnabledPlugins($editor), 'Only built-in plugins are enabled.');
-    $this->assertIdentical(array('internal' => NULL) + $enabled_plugins, $this->manager->getEnabledPlugins($editor, TRUE), 'Only the "internal" plugin is enabled.');
+    $this->assertIdentical($enabled_plugins, $this->manager->getEnabledPluginFiles($editor), 'Only built-in plugins are enabled.');
+    $this->assertIdentical(array('internal' => NULL) + $enabled_plugins, $this->manager->getEnabledPluginFiles($editor, TRUE), 'Only the "internal" plugin is enabled.');
 
     // Enable the CKEditor Test module, which has the Llama plugin (plus three
     // variations of it, to cover all possible ways a plugin can be enabled) and
@@ -87,8 +87,8 @@ function testEnabledPlugins() {
     $plugin_ids = array_keys($this->manager->getDefinitions());
     sort($plugin_ids);
     $this->assertIdentical(array('drupalimage', 'drupallink', 'internal', 'llama', 'llama_button', 'llama_contextual', 'llama_contextual_and_button', 'stylescombo'), $plugin_ids, 'Additional CKEditor plugins found.');
-    $this->assertIdentical($enabled_plugins, $this->manager->getEnabledPlugins($editor), 'Only the internal plugins are enabled.');
-    $this->assertIdentical(array('internal' => NULL) + $enabled_plugins, $this->manager->getEnabledPlugins($editor, TRUE), 'Only the "internal" plugin is enabled.');
+    $this->assertIdentical($enabled_plugins, $this->manager->getEnabledPluginFiles($editor), 'Only the internal plugins are enabled.');
+    $this->assertIdentical(array('internal' => NULL) + $enabled_plugins, $this->manager->getEnabledPluginFiles($editor, TRUE), 'Only the "internal" plugin is enabled.');
 
     // Case 3: enable each of the newly available plugins, if possible:
     // a. Llama: cannot be enabled, since it does not implement
@@ -111,19 +111,19 @@ function testEnabledPlugins() {
     $file['c'] = 'core/modules/ckeditor/tests/modules/js/llama_contextual.js';
     $file['cb'] = 'core/modules/ckeditor/tests/modules/js/llama_contextual_and_button.js';
     $expected = $enabled_plugins + array('llama_button' => $file['b'], 'llama_contextual_and_button' => $file['cb']);
-    $this->assertIdentical($expected, $this->manager->getEnabledPlugins($editor), 'The LlamaButton and LlamaContextualAndButton plugins are enabled.');
-    $this->assertIdentical(array('internal' => NULL) + $expected, $this->manager->getEnabledPlugins($editor, TRUE), 'The LlamaButton and LlamaContextualAndButton plugins are enabled.');
+    $this->assertIdentical($expected, $this->manager->getEnabledPluginFiles($editor), 'The LlamaButton and LlamaContextualAndButton plugins are enabled.');
+    $this->assertIdentical(array('internal' => NULL) + $expected, $this->manager->getEnabledPluginFiles($editor, TRUE), 'The LlamaButton and LlamaContextualAndButton plugins are enabled.');
     $editor->settings['toolbar']['buttons'][0] = $original_toolbar;
     $editor->settings['toolbar']['buttons'][0][] = 'Strike';
     $editor->save();
     $expected = $enabled_plugins + array('llama_contextual' => $file['c'], 'llama_contextual_and_button' => $file['cb']);
-    $this->assertIdentical($expected, $this->manager->getEnabledPlugins($editor), 'The  LLamaContextual and LlamaContextualAndButton plugins are enabled.');
-    $this->assertIdentical(array('internal' => NULL) + $expected, $this->manager->getEnabledPlugins($editor, TRUE), 'The LlamaContextual and LlamaContextualAndButton plugins are enabled.');
+    $this->assertIdentical($expected, $this->manager->getEnabledPluginFiles($editor), 'The  LLamaContextual and LlamaContextualAndButton plugins are enabled.');
+    $this->assertIdentical(array('internal' => NULL) + $expected, $this->manager->getEnabledPluginFiles($editor, TRUE), 'The LlamaContextual and LlamaContextualAndButton plugins are enabled.');
     $editor->settings['toolbar']['buttons'][0][] = 'Llama';
     $editor->save();
     $expected = $enabled_plugins + array('llama_button' => $file['b'], 'llama_contextual' => $file['c'], 'llama_contextual_and_button' => $file['cb']);
-    $this->assertIdentical($expected, $this->manager->getEnabledPlugins($editor), 'The LlamaButton, LlamaContextual and LlamaContextualAndButton plugins are enabled.');
-    $this->assertIdentical(array('internal' => NULL) + $expected, $this->manager->getEnabledPlugins($editor, TRUE), 'The LLamaButton, LlamaContextual and LlamaContextualAndButton plugins are enabled.');
+    $this->assertIdentical($expected, $this->manager->getEnabledPluginFiles($editor), 'The LlamaButton, LlamaContextual and LlamaContextualAndButton plugins are enabled.');
+    $this->assertIdentical(array('internal' => NULL) + $expected, $this->manager->getEnabledPluginFiles($editor, TRUE), 'The LLamaButton, LlamaContextual and LlamaContextualAndButton plugins are enabled.');
   }
 
 }
