Revert "Don't attempt to clone NSPasteboards."

This reverts commit e11a5a297736acdbc93609906facd5da04e7b6c0.

Reason for revert: https://crbug.com/928684

Original change's description:
> Don't attempt to clone NSPasteboards.
> 
> It doesn't work, as any file promises will be called in, and the
> loop over all the flavors will not be equipped to handle it.
> 
> The MacViews code wants to provide an OSExchangeDataProvider for
> drags that it didn't initiate, so wrap a provider around the
> pasteboard rather than clone it.
> 
> BUG=908349
> TEST=as in bug
> 
> Change-Id: Iae6281a46e6559439f62d5c2097dc10a0cd2006a
> Reviewed-on: https://chromium-review.googlesource.com/c/1447332
> Commit-Queue: Sidney San Martín <[email protected]>
> Auto-Submit: Avi Drissman <[email protected]>
> Reviewed-by: Sidney San Martín <[email protected]>
> Cr-Commit-Position: refs/heads/master@{#628945}

[email protected],[email protected]

Change-Id: I7058a327b8113b044e43516377b839bea68b279d
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 908349
Reviewed-on: https://chromium-review.googlesource.com/c/1455309
Reviewed-by: Leonard Grey <[email protected]>
Commit-Queue: Leonard Grey <[email protected]>
Cr-Commit-Position: refs/heads/master@{#629304}
diff --git a/ui/base/dragdrop/os_exchange_data_provider_mac.h b/ui/base/dragdrop/os_exchange_data_provider_mac.h
index 11dff74..5ba2a69 100644
--- a/ui/base/dragdrop/os_exchange_data_provider_mac.h
+++ b/ui/base/dragdrop/os_exchange_data_provider_mac.h
@@ -5,9 +5,6 @@
 #ifndef UI_BASE_DRAGDROP_OS_EXCHANGE_DATA_PROVIDER_MAC_H_
 #define UI_BASE_DRAGDROP_OS_EXCHANGE_DATA_PROVIDER_MAC_H_
 
-#include <memory>
-
-#include "base/mac/scoped_nsobject.h"
 #include "base/macros.h"
 #include "base/memory/ref_counted.h"
 #import "ui/base/clipboard/clipboard_util_mac.h"
@@ -21,22 +18,17 @@
 @class NSString;
 
 namespace ui {
+class UniquePasteboard;
 
 // OSExchangeData::Provider implementation for Mac.
 class UI_BASE_EXPORT OSExchangeDataProviderMac
     : public OSExchangeData::Provider {
  public:
+  OSExchangeDataProviderMac();
   ~OSExchangeDataProviderMac() override;
 
-  // Creates a stand-alone OSExchangeDataProviderMac.
-  static std::unique_ptr<OSExchangeDataProviderMac> CreateProvider();
-
-  // Creates an OSExchangeDataProviderMac object wrapping the given NSPasteboard
-  // object.
-  static std::unique_ptr<OSExchangeDataProviderMac>
-  CreateProviderWrappingPasteboard(NSPasteboard* pasteboard);
-
   // Overridden from OSExchangeData::Provider:
+  std::unique_ptr<Provider> Clone() const override;
   void MarkOriginatedFromRenderer() override;
   bool DidOriginateFromRenderer() const override;
   void SetString(const base::string16& data) override;
@@ -66,25 +58,29 @@
   NSData* GetNSDataForType(NSString* type) const;
 
   // Gets the underlying pasteboard.
-  virtual NSPasteboard* GetPasteboard() const = 0;
+  NSPasteboard* GetPasteboard() const;
 
   // Returns the union of SupportedPasteboardTypes() and the types in the
   // current pasteboard.
   NSArray* GetAvailableTypes() const;
 
+  // Creates an OSExchangeData object from the given NSPasteboard object.
+  static std::unique_ptr<OSExchangeData> CreateDataFromPasteboard(
+      NSPasteboard* pasteboard);
+
   // Returns an array of pasteboard types that can be supported by
   // OSExchangeData.
   static NSArray* SupportedPasteboardTypes();
 
- protected:
-  OSExchangeDataProviderMac();
-  OSExchangeDataProviderMac(const OSExchangeDataProviderMac&);
-  OSExchangeDataProviderMac& operator=(const OSExchangeDataProviderMac&);
-
  private:
+  explicit OSExchangeDataProviderMac(scoped_refptr<ui::UniquePasteboard>);
+  scoped_refptr<ui::UniquePasteboard> pasteboard_;
+
   // Drag image and offset data.
   gfx::ImageSkia drag_image_;
   gfx::Vector2d cursor_offset_;
+
+  DISALLOW_COPY_AND_ASSIGN(OSExchangeDataProviderMac);
 };
 
 }  // namespace ui