summaryrefslogtreecommitdiffstats
path: root/ui/base/dragdrop
diff options
context:
space:
mode:
authorvarunjain@chromium.org <varunjain@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-04 00:31:02 +0000
committervarunjain@chromium.org <varunjain@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-04 00:31:02 +0000
commit5eae7160b229cfd54b1f1d5463f4edacb79033d5 (patch)
treeea0f69cfd3cd4229c21ae4f8203e308db61c8fc8 /ui/base/dragdrop
parent15c16be96c04ab9fa99ee36bddb83616ec923390 (diff)
downloadchromium_src-5eae7160b229cfd54b1f1d5463f4edacb79033d5.zip
chromium_src-5eae7160b229cfd54b1f1d5463f4edacb79033d5.tar.gz
chromium_src-5eae7160b229cfd54b1f1d5463f4edacb79033d5.tar.bz2
Beginning of drag/drop should copy the drag data to clipboard.
BUG=97845 TEST=added new test Review URL: http://codereview.chromium.org/8994012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@116236 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/base/dragdrop')
-rw-r--r--ui/base/dragdrop/os_exchange_data_provider_aura.cc18
-rw-r--r--ui/base/dragdrop/os_exchange_data_provider_aura.h7
2 files changed, 23 insertions, 2 deletions
diff --git a/ui/base/dragdrop/os_exchange_data_provider_aura.cc b/ui/base/dragdrop/os_exchange_data_provider_aura.cc
index c020012..a3396bd 100644
--- a/ui/base/dragdrop/os_exchange_data_provider_aura.cc
+++ b/ui/base/dragdrop/os_exchange_data_provider_aura.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -7,6 +7,7 @@
#include "base/logging.h"
#include "base/utf_string_conversions.h"
#include "net/base/net_util.h"
+#include "ui/base/clipboard/scoped_clipboard_writer.h"
namespace ui {
@@ -14,6 +15,21 @@ OSExchangeDataProviderAura::OSExchangeDataProviderAura() : formats_(0) {}
OSExchangeDataProviderAura::~OSExchangeDataProviderAura() {}
+void OSExchangeDataProviderAura::WriteDataToClipboard(
+ Clipboard* clipboard) const {
+ ScopedClipboardWriter scw(clipboard);
+ if (HasString())
+ scw.WriteText(string_);
+ if (HasURL())
+ scw.WriteHyperlink(title_, url_.spec());
+ if (HasFile()) {
+ Pickle filename_pickle;
+ filename_pickle.WriteString(net::FilePathToFileURL(filename_).spec());
+ scw.WritePickledData(filename_pickle, Clipboard::GetFilenameFormatType());
+ }
+ // TODO(varunjain): support pickle format.
+}
+
void OSExchangeDataProviderAura::SetString(const string16& data) {
string_ = data;
formats_ |= OSExchangeData::STRING;
diff --git a/ui/base/dragdrop/os_exchange_data_provider_aura.h b/ui/base/dragdrop/os_exchange_data_provider_aura.h
index 526cc0a..0e0dfe4 100644
--- a/ui/base/dragdrop/os_exchange_data_provider_aura.h
+++ b/ui/base/dragdrop/os_exchange_data_provider_aura.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -16,12 +16,17 @@
namespace ui {
+class Clipboard;
+
// OSExchangeData::Provider implementation for aura on linux.
class UI_EXPORT OSExchangeDataProviderAura : public OSExchangeData::Provider {
public:
OSExchangeDataProviderAura();
virtual ~OSExchangeDataProviderAura();
+ // Writes interchange data on to the |clipboard|.
+ void WriteDataToClipboard(Clipboard* clipboard) const;
+
// Overridden from OSExchangeData::Provider:
virtual void SetString(const string16& data) OVERRIDE;
virtual void SetURL(const GURL& url, const string16& title) OVERRIDE;