Skip to content

Commit

Permalink
Remove unused clipboard methods.
Browse files Browse the repository at this point in the history
BUG=none
TEST=chrome, test_shell, and DumpRenderTree all still compile.

Review URL: http://codereview.chromium.org/8446011

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@108683 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
dcheng@chromium.org committed Nov 4, 2011
1 parent 0c52d8f commit 36780a1
Show file tree
Hide file tree
Showing 13 changed files with 65 additions and 243 deletions.
33 changes: 0 additions & 33 deletions content/browser/clipboard_dispatcher.cc

This file was deleted.

41 changes: 0 additions & 41 deletions content/browser/clipboard_dispatcher.h

This file was deleted.

37 changes: 11 additions & 26 deletions content/browser/renderer_host/clipboard_message_filter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#endif

#include "base/stl_util.h"
#include "content/browser/clipboard_dispatcher.h"
#include "content/common/clipboard_messages.h"
#include "content/public/browser/content_browser_client.h"
#include "googleurl/src/gurl.h"
Expand Down Expand Up @@ -65,6 +64,7 @@ bool ClipboardMessageFilter::OnMessageReceived(const IPC::Message& message,
IPC_BEGIN_MESSAGE_MAP_EX(ClipboardMessageFilter, message, *message_was_ok)
IPC_MESSAGE_HANDLER(ClipboardHostMsg_WriteObjectsAsync, OnWriteObjectsAsync)
IPC_MESSAGE_HANDLER(ClipboardHostMsg_WriteObjectsSync, OnWriteObjectsSync)
IPC_MESSAGE_HANDLER(ClipboardHostMsg_GetSequenceNumber, OnGetSequenceNumber)
IPC_MESSAGE_HANDLER(ClipboardHostMsg_IsFormatAvailable, OnIsFormatAvailable)
IPC_MESSAGE_HANDLER(ClipboardHostMsg_ReadAvailableTypes,
OnReadAvailableTypes)
Expand All @@ -76,9 +76,6 @@ bool ClipboardMessageFilter::OnMessageReceived(const IPC::Message& message,
IPC_MESSAGE_HANDLER(ClipboardHostMsg_FindPboardWriteStringAsync,
OnFindPboardWriteString)
#endif
IPC_MESSAGE_HANDLER(ClipboardHostMsg_ReadData, OnReadData)
IPC_MESSAGE_HANDLER(ClipboardHostMsg_ReadFilenames, OnReadFilenames)
IPC_MESSAGE_HANDLER(ClipboardHostMsg_GetSequenceNumber, OnGetSequenceNumber)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
return handled;
Expand Down Expand Up @@ -127,6 +124,16 @@ void ClipboardMessageFilter::OnWriteObjectsAsync(
new WriteClipboardTask(long_living_objects));
}

void ClipboardMessageFilter::OnGetSequenceNumber(uint64* seq_num) {
*seq_num = GetClipboard()->GetSequenceNumber();
}

void ClipboardMessageFilter::OnReadAvailableTypes(
ui::Clipboard::Buffer buffer, std::vector<string16>* types,
bool* contains_filenames) {
GetClipboard()->ReadAvailableTypes(buffer, types, contains_filenames);
}

void ClipboardMessageFilter::OnIsFormatAvailable(
const ui::Clipboard::FormatType& format, ui::Clipboard::Buffer buffer,
bool* result) {
Expand Down Expand Up @@ -197,28 +204,6 @@ void ClipboardMessageFilter::OnReadImageReply(
Send(reply_msg);
}

void ClipboardMessageFilter::OnReadAvailableTypes(
ui::Clipboard::Buffer buffer, std::vector<string16>* types,
bool* contains_filenames) {
GetClipboard()->ReadAvailableTypes(buffer, types, contains_filenames);
}

void ClipboardMessageFilter::OnReadData(
ui::Clipboard::Buffer buffer, const string16& type, bool* succeeded,
string16* data, string16* metadata) {
*succeeded = ClipboardDispatcher::ReadData(buffer, type, data, metadata);
}

void ClipboardMessageFilter::OnReadFilenames(
ui::Clipboard::Buffer buffer, bool* succeeded,
std::vector<string16>* filenames) {
*succeeded = ClipboardDispatcher::ReadFilenames(buffer, filenames);
}

void ClipboardMessageFilter::OnGetSequenceNumber(uint64* seq_num) {
*seq_num = GetClipboard()->GetSequenceNumber();
}

// static
ui::Clipboard* ClipboardMessageFilter::GetClipboard() {
// We have a static instance of the clipboard service for use by all message
Expand Down
6 changes: 1 addition & 5 deletions content/browser/renderer_host/clipboard_message_filter.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class ClipboardMessageFilter : public BrowserMessageFilter {
void OnWriteObjectsSync(const ui::Clipboard::ObjectMap& objects,
base::SharedMemoryHandle bitmap_handle);

void OnGetSequenceNumber(uint64* seq_num);
void OnIsFormatAvailable(const ui::Clipboard::FormatType& format,
ui::Clipboard::Buffer buffer,
bool* result);
Expand All @@ -44,11 +45,6 @@ class ClipboardMessageFilter : public BrowserMessageFilter {
#if defined(OS_MACOSX)
void OnFindPboardWriteString(const string16& text);
#endif
void OnReadData(ui::Clipboard::Buffer buffer, const string16& type,
bool* succeeded, string16* data, string16* metadata);
void OnReadFilenames(ui::Clipboard::Buffer buffer, bool* succeeded,
std::vector<string16>* filenames);
void OnGetSequenceNumber(uint64* seq_num);

// We have our own clipboard because we want to access the clipboard on the
// IO thread instead of forwarding (possibly synchronous) messages to the UI
Expand Down
14 changes: 2 additions & 12 deletions content/common/clipboard_messages.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ IPC_MESSAGE_CONTROL1(ClipboardHostMsg_WriteObjectsAsync,
IPC_SYNC_MESSAGE_CONTROL2_0(ClipboardHostMsg_WriteObjectsSync,
ui::Clipboard::ObjectMap /* objects */,
base::SharedMemoryHandle /* bitmap handle */)
IPC_SYNC_MESSAGE_CONTROL0_1(ClipboardHostMsg_GetSequenceNumber,
uint64 /* result */)
IPC_SYNC_MESSAGE_CONTROL2_1(ClipboardHostMsg_IsFormatAvailable,
std::string /* format */,
ui::Clipboard::Buffer /* buffer */,
Expand All @@ -52,20 +54,8 @@ IPC_SYNC_MESSAGE_CONTROL1_2(ClipboardHostMsg_ReadImage,
ui::Clipboard::Buffer /* buffer */,
base::SharedMemoryHandle /* PNG-encoded image */,
uint32 /* image size */)
IPC_SYNC_MESSAGE_CONTROL0_1(ClipboardHostMsg_GetSequenceNumber,
uint64 /* result */)

#if defined(OS_MACOSX)
IPC_MESSAGE_CONTROL1(ClipboardHostMsg_FindPboardWriteStringAsync,
string16 /* text */)
#endif
IPC_SYNC_MESSAGE_CONTROL2_3(ClipboardHostMsg_ReadData,
ui::Clipboard::Buffer /* buffer */,
string16 /* type */,
bool /* succeeded */,
string16 /* data */,
string16 /* metadata */)
IPC_SYNC_MESSAGE_CONTROL1_2(ClipboardHostMsg_ReadFilenames,
ui::Clipboard::Buffer /* buffer */,
bool /* result */,
std::vector<string16> /* filenames */)
2 changes: 0 additions & 2 deletions content/content_browser.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@
'browser/child_process_security_policy.h',
'browser/chrome_blob_storage_context.cc',
'browser/chrome_blob_storage_context.h',
'browser/clipboard_dispatcher.h',
'browser/clipboard_dispatcher.cc',
'browser/cross_site_request_manager.cc',
'browser/cross_site_request_manager.h',
'browser/debugger/devtools_agent_host.cc',
Expand Down
30 changes: 7 additions & 23 deletions content/renderer/renderer_glue.cc
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,13 @@ ui::Clipboard* ClipboardGetClipboard() {
return NULL;
}

uint64 ClipboardGetSequenceNumber() {
uint64 seq_num = 0;
RenderThreadImpl::current()->Send(
new ClipboardHostMsg_GetSequenceNumber(&seq_num));
return seq_num;
}

bool ClipboardIsFormatAvailable(const ui::Clipboard::FormatType& format,
ui::Clipboard::Buffer buffer) {
bool result;
Expand Down Expand Up @@ -141,29 +148,6 @@ void ClipboardReadImage(ui::Clipboard::Buffer buffer, std::string* data) {
}
}

bool ClipboardReadData(ui::Clipboard::Buffer buffer, const string16& type,
string16* data, string16* metadata) {
bool result = false;
RenderThreadImpl::current()->Send(new ClipboardHostMsg_ReadData(
buffer, type, &result, data, metadata));
return result;
}

bool ClipboardReadFilenames(ui::Clipboard::Buffer buffer,
std::vector<string16>* filenames) {
bool result;
RenderThreadImpl::current()->Send(new ClipboardHostMsg_ReadFilenames(
buffer, &result, filenames));
return result;
}

uint64 ClipboardGetSequenceNumber() {
uint64 seq_num = 0;
RenderThreadImpl::current()->Send(
new ClipboardHostMsg_GetSequenceNumber(&seq_num));
return seq_num;
}

void GetPlugins(bool refresh,
std::vector<webkit::WebPluginInfo>* plugins) {
if (!RenderThreadImpl::current()->plugin_refresh_allowed())
Expand Down
59 changes: 14 additions & 45 deletions webkit/glue/webclipboard_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ std::string WebClipboardImpl::URLToImageMarkup(const WebURL& url,
WebClipboardImpl::~WebClipboardImpl() {
}

uint64 WebClipboardImpl::getSequenceNumber() {
return ClipboardGetSequenceNumber();
}

bool WebClipboardImpl::isFormatAvailable(Format format, Buffer buffer) {
ui::Clipboard::FormatType format_type;
ui::Clipboard::Buffer buffer_type;
Expand Down Expand Up @@ -95,6 +99,16 @@ bool WebClipboardImpl::isFormatAvailable(Format format, Buffer buffer) {
return ClipboardIsFormatAvailable(format_type, buffer_type);
}

WebVector<WebString> WebClipboardImpl::readAvailableTypes(
Buffer buffer, bool* contains_filenames) {
ui::Clipboard::Buffer buffer_type;
std::vector<string16> types;
if (ConvertBufferType(buffer, &buffer_type)) {
ClipboardReadAvailableTypes(buffer_type, &types, contains_filenames);
}
return types;
}

WebString WebClipboardImpl::readPlainText(Buffer buffer) {
ui::Clipboard::Buffer buffer_type;
if (!ConvertBufferType(buffer, &buffer_type))
Expand Down Expand Up @@ -145,10 +159,6 @@ WebData WebClipboardImpl::readImage(Buffer buffer) {
return WebData(png_data);
}

uint64 WebClipboardImpl::getSequenceNumber() {
return ClipboardGetSequenceNumber();
}

void WebClipboardImpl::writeHTML(
const WebString& html_text, const WebURL& source_url,
const WebString& plain_text, bool write_smart_paste) {
Expand Down Expand Up @@ -202,47 +212,6 @@ void WebClipboardImpl::writeImage(
}
}

void WebClipboardImpl::writeData(const WebString& type,
const WebString& data,
const WebString& metadata) {
// TODO(dcheng): Implement this stub.
}

WebVector<WebString> WebClipboardImpl::readAvailableTypes(
Buffer buffer, bool* contains_filenames) {
ui::Clipboard::Buffer buffer_type;
std::vector<string16> types;
if (ConvertBufferType(buffer, &buffer_type)) {
ClipboardReadAvailableTypes(buffer_type, &types, contains_filenames);
}
return types;
}

bool WebClipboardImpl::readData(Buffer buffer, const WebString& type,
WebString* data, WebString* metadata) {
ui::Clipboard::Buffer buffer_type;
if (!ConvertBufferType(buffer, &buffer_type))
return false;

string16 data_out;
string16 metadata_out;
bool result = ClipboardReadData(buffer_type, type, &data_out, &metadata_out);
if (result) {
*data = data_out;
*metadata = metadata_out;
}
return result;
}

WebVector<WebString> WebClipboardImpl::readFilenames(Buffer buffer) {
ui::Clipboard::Buffer buffer_type;
std::vector<string16> filenames;
if (ConvertBufferType(buffer, &buffer_type)) {
ClipboardReadFilenames(buffer_type, &filenames);
}
return filenames;
}

bool WebClipboardImpl::ConvertBufferType(Buffer buffer,
ui::Clipboard::Buffer* result) {
switch (buffer) {
Expand Down
14 changes: 3 additions & 11 deletions webkit/glue/webclipboard_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,17 @@ class WebClipboardImpl : public WebKit::WebClipboard {
virtual ~WebClipboardImpl();

// WebClipboard methods:
virtual uint64 getSequenceNumber();
virtual bool isFormatAvailable(Format, Buffer);
virtual WebKit::WebVector<WebKit::WebString> readAvailableTypes(
Buffer, bool* contains_filenames);
virtual WebKit::WebString readPlainText(Buffer);
virtual WebKit::WebString readHTML(
Buffer,
WebKit::WebURL* source_url,
unsigned* fragment_start,
unsigned* fragment_end);
virtual WebKit::WebData readImage(Buffer);
virtual uint64 getSequenceNumber();
virtual void writeHTML(
const WebKit::WebString& html_text,
const WebKit::WebURL& source_url,
Expand All @@ -44,16 +46,6 @@ class WebClipboardImpl : public WebKit::WebClipboard {
const WebKit::WebImage&,
const WebKit::WebURL& source_url,
const WebKit::WebString& title);
virtual void writeData(
const WebKit::WebString& type,
const WebKit::WebString& data,
const WebKit::WebString& metadata);

virtual WebKit::WebVector<WebKit::WebString> readAvailableTypes(
Buffer, bool* contains_filenames);
virtual bool readData(Buffer, const WebKit::WebString& type,
WebKit::WebString* data, WebKit::WebString* metadata);
virtual WebKit::WebVector<WebKit::WebString> readFilenames(Buffer);

private:
bool ConvertBufferType(Buffer, ui::Clipboard::Buffer*);
Expand Down
Loading

0 comments on commit 36780a1

Please sign in to comment.