summaryrefslogtreecommitdiffstats
path: root/chrome/common
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-05 01:34:30 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-05 01:34:30 +0000
commit3ee3ffd1d79a0c1544f3bfd70c7de7606df9482f (patch)
tree0943a0925f5974478463e5d00886be29109858e6 /chrome/common
parent38733063b7e1cf0b6e67c0b590773ff4f1aaa18d (diff)
downloadchromium_src-3ee3ffd1d79a0c1544f3bfd70c7de7606df9482f.zip
chromium_src-3ee3ffd1d79a0c1544f3bfd70c7de7606df9482f.tar.gz
chromium_src-3ee3ffd1d79a0c1544f3bfd70c7de7606df9482f.tar.bz2
Rewrote the clipboard API to be more concurrent. Added a helper class to make it more foolproof. Updated all clients and unittests. Mac port by jeremy@chromium.org
Review URL: http://codereview.chromium.org/9154 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@4719 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common')
-rw-r--r--chrome/common/clipboard_service.cc20
-rw-r--r--chrome/common/clipboard_service.h14
-rw-r--r--chrome/common/common.vcproj4
-rw-r--r--chrome/common/render_messages_internal.h23
4 files changed, 13 insertions, 48 deletions
diff --git a/chrome/common/clipboard_service.cc b/chrome/common/clipboard_service.cc
deleted file mode 100644
index a666c0c..0000000
--- a/chrome/common/clipboard_service.cc
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright (c) 2006-2008 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.
-
-// Many of these functions are based on those found in
-// webkit/port/platform/PasteboardWin.cpp
-
-#include "chrome/common/clipboard_service.h"
-
-#include "SkBitmap.h"
-
-ClipboardService::ClipboardService() {
-}
-
-void ClipboardService::WriteBitmap(const SkBitmap& bitmap) {
- SkAutoLockPixels bitmap_lock(bitmap);
- Clipboard::WriteBitmap(bitmap.getPixels(),
- gfx::Size(bitmap.width(), bitmap.height()));
-}
-
diff --git a/chrome/common/clipboard_service.h b/chrome/common/clipboard_service.h
index 7da0e0a..ed34afd 100644
--- a/chrome/common/clipboard_service.h
+++ b/chrome/common/clipboard_service.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_COMMON_CLIPBOARD_SERIVCE_H__
-#define CHROME_COMMON_CLIPBOARD_SERIVCE_H__
+#ifndef CHROME_COMMON_CLIPBOARD_SERVICE_H__
+#define CHROME_COMMON_CLIPBOARD_SERVICE_H__
#include <string>
#include <vector>
@@ -14,17 +14,11 @@ class SkBitmap;
class ClipboardService : public Clipboard {
public:
- ClipboardService();
-
- // Adds a bitmap to the clipboard
- // This is the slowest way to copy a bitmap to the clipboard as we must fist
- // memcpy the bits into GDI and the blit the bitmap to the clipboard.
- void WriteBitmap(const SkBitmap& bitmap);
+ ClipboardService() {}
private:
DISALLOW_EVIL_CONSTRUCTORS(ClipboardService);
};
-#endif // CHROME_COMMON_CLIPBOARD_SERIVCE_H__
-
+#endif // CHROME_COMMON_CLIPBOARD_SERVICE_H__
diff --git a/chrome/common/common.vcproj b/chrome/common/common.vcproj
index 8bcb3ff..5359cfbd 100644
--- a/chrome/common/common.vcproj
+++ b/chrome/common/common.vcproj
@@ -390,10 +390,6 @@
>
</File>
<File
- RelativePath=".\clipboard_service.cc"
- >
- </File>
- <File
RelativePath=".\clipboard_service.h"
>
</File>
diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h
index 61da8e7..ea97bc7 100644
--- a/chrome/common/render_messages_internal.h
+++ b/chrome/common/render_messages_internal.h
@@ -9,6 +9,7 @@
#include <string>
#include <vector>
+#include "base/clipboard.h"
#include "base/gfx/rect.h"
#include "base/shared_memory.h"
#include "chrome/common/ipc_message_macros.h"
@@ -783,21 +784,15 @@ IPC_BEGIN_MESSAGES(ViewHost, 2)
std::wstring /* plugin_path */)
// Clipboard IPC messages
- IPC_MESSAGE_CONTROL0(ViewHostMsg_ClipboardClear)
- IPC_MESSAGE_CONTROL1(ViewHostMsg_ClipboardWriteText,
- std::wstring /* text */)
- IPC_MESSAGE_CONTROL2(ViewHostMsg_ClipboardWriteHTML,
- std::wstring /* html */,
- GURL /* url */)
- IPC_MESSAGE_CONTROL2(ViewHostMsg_ClipboardWriteBookmark,
- std::wstring /* title */,
- GURL /* url */)
- // This message is synchronized so that the renderer known when it is safe to
+
+ // This message is used when the object list does not contain a bitmap.
+ IPC_MESSAGE_CONTROL1(ViewHostMsg_ClipboardWriteObjectsAsync,
+ Clipboard::ObjectMap /* objects */)
+ // This message is used when the object list contains a bitmap.
+ // It is synchronized so that the renderer knows when it is safe to
// free the shared memory used to transfer the bitmap.
- IPC_SYNC_MESSAGE_CONTROL2_0(ViewHostMsg_ClipboardWriteBitmap,
- SharedMemoryHandle /* bitmap */,
- gfx::Size /* size */)
- IPC_MESSAGE_CONTROL0(ViewHostMsg_ClipboardWriteWebSmartPaste)
+ IPC_SYNC_MESSAGE_CONTROL1_0(ViewHostMsg_ClipboardWriteObjectsSync,
+ Clipboard::ObjectMap /* objects */)
IPC_SYNC_MESSAGE_CONTROL1_1(ViewHostMsg_ClipboardIsFormatAvailable,
int /* format */,
bool /* result */)