Advertisement
Guest User

Untitled

a guest
Nov 12th, 2018
233
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 2.38 KB | None | 0 0
  1. diff --git a/chrome/browser/resources/omnibox/omnibox_output.js b/chrome/browser/resources/omnibox/omnibox_output.js
  2. index 55038963464a..8f8d4596b40b 100644
  3. --- a/chrome/browser/resources/omnibox/omnibox_output.js
  4. +++ b/chrome/browser/resources/omnibox/omnibox_output.js
  5. @@ -522,37 +522,6 @@ cr.define('omnibox_output', function() {
  6.      }
  7.    }
  8.  
  9. -  /** Responsible for setting clipboard contents. */
  10. -  class Copier {
  11. -    /**
  12. -     * @param {omnibox_output.OmniboxController} omniboxController
  13. -     * @param {omnibox_output.OmniboxOutput} omniboxOutput
  14. -     */
  15. -    constructor(omniboxController, omniboxOutput) {
  16. -      /** @type {omnibox_output.OmniboxController} */
  17. -      this.omniboxController = omniboxController;
  18. -      /** @type {omnibox_output.OmniboxOutput} */
  19. -      this.omniboxOutput = omniboxOutput;
  20. -    }
  21. -
  22. -    copyTextOutput() {
  23. -      this.copy_(this.omniboxOutput.visibletableText);
  24. -    }
  25. -
  26. -    copyJsonOutput() {
  27. -      this.copy_(JSON.stringify(this.omniboxController.responses, null, 2));
  28. -    }
  29. -
  30. -    /**
  31. -     * @private
  32. -     * @param {string} value
  33. -     */
  34. -    copy_(value) {
  35. -      navigator.clipboard.writeText(value).catch(
  36. -          error => console.log('unable to copy to clipboard:', error));
  37. -    }
  38. -  }
  39. -
  40.    /**
  41.     * Provides a single public interface to control the output. Currently, this
  42.     * means providing a public interface for OmniboxOutput and Copier. In the
  43. @@ -576,8 +545,6 @@ cr.define('omnibox_output', function() {
  44.      constructor(omniboxOutput) {
  45.        /** @type {omnibox_output.OmniboxOutput} */
  46.        this.omniboxOutput = omniboxOutput;
  47. -      /** @type {Copier} */
  48. -      this.copier = new Copier(this, omniboxOutput);
  49.  
  50.        /** @type {!Array<!mojom.OmniboxResult>} */
  51.        this.responses = [];
  52. @@ -620,12 +587,16 @@ cr.define('omnibox_output', function() {
  53.  
  54.      // Methods for controlling copier
  55.  
  56. +
  57.      copyTextOutput() {
  58. -      this.copier.copyTextOutput();
  59. +      navigator.clipboard.writeText(this.omniboxOutput.visibletableText).catch(
  60. +          error => console.error('unable to copy to clipboard:', error));
  61.      }
  62.  
  63.      copyJsonOutput() {
  64. -      this.copier.copyJsonOutput();
  65. +      const text = JSON.stringify(this.responses, null, 2);
  66. +      navigator.clipboard.writeText(text).catch(
  67. +          error => console.error('unable to copy to clipboard:', error));
  68.      }
  69.    }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement