diff options
author | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-21 00:40:28 +0000 |
---|---|---|
committer | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-21 00:40:28 +0000 |
commit | bb7538fede8db4268fcb2fc5fd6d283ad70fb54f (patch) | |
tree | eb3f3db88d3036a099a50a51859addc215f79235 | |
parent | 43f249f91fedfe6f29df23c299fe776848589313 (diff) | |
download | chromium_src-bb7538fede8db4268fcb2fc5fd6d283ad70fb54f.zip chromium_src-bb7538fede8db4268fcb2fc5fd6d283ad70fb54f.tar.gz chromium_src-bb7538fede8db4268fcb2fc5fd6d283ad70fb54f.tar.bz2 |
Move the following clipboard files from webkit\glue to content\renderer. These files now live in the content_renderer target.
1. scoped_clipboard_writer_glue.h
2. scoped_clipboard_writer_glue.cc
3. webclipboard_impl.cc
4. webclipboard_impl.h
5. clipboard_client.h
I moved the static functions URLToMarkup and URLToImageMarkup out of the WebClipboardImpl class to the
newly added webkit\renderer\clipboard_utils.cc/.h files as these functions are used by the MockWebClipboardImpl class
which lives in webkit\support. This class is eventually used by the webkit_unit_tests target. Moving these functions out
avoids the dependency on content in webkit_unit_tests.
This is continuation of the ongoing work for bug https://code.google.com/p/chromium/issues/detail?can=2&q=237249
which is splitting chrome.dll into a browser and renderer component due to build issues on Windows.
BUG=237249
R=jamesr@chromium.org
Review URL: https://codereview.chromium.org/17420005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@207657 0039d316-1c4b-4281-b951-d872f2087c98
20 files changed, 148 insertions, 281 deletions
diff --git a/content/content_renderer.gypi b/content/content_renderer.gypi index bddc0f6..25735f7 100644 --- a/content/content_renderer.gypi +++ b/content/content_renderer.gypi @@ -318,6 +318,8 @@ 'renderer/rendering_benchmark.h', 'renderer/savable_resources.cc', 'renderer/savable_resources.h', + 'renderer/scoped_clipboard_writer_glue.cc', + 'renderer/scoped_clipboard_writer_glue.h', 'renderer/skia_benchmarking_extension.cc', 'renderer/skia_benchmarking_extension.h', 'renderer/speech_recognition_dispatcher.cc', @@ -330,6 +332,8 @@ 'renderer/text_input_client_observer.h', 'renderer/v8_value_converter_impl.cc', 'renderer/v8_value_converter_impl.h', + 'renderer/webclipboard_impl.cc', + 'renderer/webclipboard_impl.h', 'renderer/web_ui_extension.cc', 'renderer/web_ui_extension.h', 'renderer/web_ui_extension_data.cc', diff --git a/webkit/glue/clipboard_client.h b/content/renderer/clipboard_client.h index b612b7c..1e00af6 100644 --- a/webkit/glue/clipboard_client.h +++ b/content/renderer/clipboard_client.h @@ -1,17 +1,17 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2013 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. -#ifndef WEBKIT_GLUE_CLIPBOARD_CLIENT_H_ -#define WEBKIT_GLUE_CLIPBOARD_CLIENT_H_ +#ifndef CONTENT_RENDERER_CLIPBOARD_CLIENT_H_ +#define CONTENT_RENDERER_CLIPBOARD_CLIENT_H_ #include "ui/base/clipboard/clipboard.h" class GURL; -namespace webkit_glue { +namespace content { -// Interface for the webkit glue embedder to implement to support clipboard. +// Interface for the content embedder to implement to support clipboard. class ClipboardClient { public: class WriteContext { @@ -79,6 +79,7 @@ class ClipboardClient { virtual WriteContext* CreateWriteContext() = 0; }; -} // namespace webkit_glue +} // namespace content + +#endif // CONTENT_RENDERER_CLIPBOARD_CLIENT_H_ -#endif // WEBKIT_GLUE_CLIPBOARD_CLIENT_H_ diff --git a/content/renderer/renderer_clipboard_client.cc b/content/renderer/renderer_clipboard_client.cc index e971498..c844fbe 100644 --- a/content/renderer/renderer_clipboard_client.cc +++ b/content/renderer/renderer_clipboard_client.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// This file provides the embedder's side of random webkit glue functions. +// This file provides the embedder's side of the Clipboard interface. #include "content/renderer/renderer_clipboard_client.h" @@ -11,16 +11,15 @@ #include "content/common/clipboard_messages.h" #include "content/public/renderer/content_renderer_client.h" #include "content/renderer/render_thread_impl.h" +#include "content/renderer/scoped_clipboard_writer_glue.h" #include "ui/base/clipboard/clipboard.h" #include "ui/gfx/size.h" -#include "webkit/glue/scoped_clipboard_writer_glue.h" namespace content { namespace { -class RendererClipboardWriteContext : - public webkit_glue::ClipboardClient::WriteContext { +class RendererClipboardWriteContext : public ClipboardClient::WriteContext { public: RendererClipboardWriteContext(); virtual ~RendererClipboardWriteContext(); @@ -184,8 +183,7 @@ void RendererClipboardClient::ReadData(const ui::Clipboard::FormatType& format, new ClipboardHostMsg_ReadData(format, data)); } -webkit_glue::ClipboardClient::WriteContext* -RendererClipboardClient::CreateWriteContext() { +ClipboardClient::WriteContext* RendererClipboardClient::CreateWriteContext() { return new RendererClipboardWriteContext; } diff --git a/content/renderer/renderer_clipboard_client.h b/content/renderer/renderer_clipboard_client.h index e2d9051..888f116 100644 --- a/content/renderer/renderer_clipboard_client.h +++ b/content/renderer/renderer_clipboard_client.h @@ -6,12 +6,12 @@ #define CONTENT_RENDERER_RENDERER_CLIPBOARD_CLIENT_H_ #include "base/compiler_specific.h" -#include "webkit/glue/clipboard_client.h" +#include "content/renderer/clipboard_client.h" namespace content { // An implementation of ClipboardClient that gets and sends data over IPC. -class RendererClipboardClient : public webkit_glue::ClipboardClient { +class RendererClipboardClient : public ClipboardClient { public: RendererClipboardClient(); virtual ~RendererClipboardClient(); diff --git a/content/renderer/renderer_webkitplatformsupport_impl.cc b/content/renderer/renderer_webkitplatformsupport_impl.cc index 3565af5..5e74dc4 100644 --- a/content/renderer/renderer_webkitplatformsupport_impl.cc +++ b/content/renderer/renderer_webkitplatformsupport_impl.cc @@ -34,6 +34,7 @@ #include "content/renderer/media/webcontentdecryptionmodule_impl.h" #include "content/renderer/render_thread_impl.h" #include "content/renderer/renderer_clipboard_client.h" +#include "content/renderer/webclipboard_impl.h" #include "content/renderer/websharedworkerrepository_impl.h" #include "googleurl/src/gurl.h" #include "gpu/config/gpu_info.h" @@ -54,7 +55,6 @@ #include "webkit/base/file_path_string_conversions.h" #include "webkit/common/gpu/webgraphicscontext3d_provider_impl.h" #include "webkit/glue/simple_webmimeregistry_impl.h" -#include "webkit/glue/webclipboard_impl.h" #include "webkit/glue/webfileutilities_impl.h" #include "webkit/glue/webkit_glue.h" #include "webkit/renderer/media/audio_decoder.h" @@ -191,7 +191,7 @@ class RendererWebKitPlatformSupportImpl::SandboxSupport RendererWebKitPlatformSupportImpl::RendererWebKitPlatformSupportImpl() : clipboard_client_(new RendererClipboardClient), - clipboard_(new webkit_glue::WebClipboardImpl(clipboard_client_.get())), + clipboard_(new WebClipboardImpl(clipboard_client_.get())), mime_registry_(new RendererWebKitPlatformSupportImpl::MimeRegistry), hyphenator_(new RendererWebKitPlatformSupportImpl::Hyphenator), sudden_termination_disables_(0), diff --git a/content/renderer/renderer_webkitplatformsupport_impl.h b/content/renderer/renderer_webkitplatformsupport_impl.h index c11ac14..104cd24 100644 --- a/content/renderer/renderer_webkitplatformsupport_impl.h +++ b/content/renderer/renderer_webkitplatformsupport_impl.h @@ -19,10 +19,6 @@ namespace cc { class ContextProvider; } -namespace webkit_glue { -class WebClipboardImpl; -} - namespace WebKit { class WebGraphicsContext3DProvider; } @@ -31,6 +27,7 @@ namespace content { class GamepadSharedMemoryReader; class RendererClipboardClient; class ThreadSafeSender; +class WebClipboardImpl; class WebFileSystemImpl; class WebSharedWorkerRepositoryImpl; @@ -146,7 +143,7 @@ class CONTENT_EXPORT RendererWebKitPlatformSupportImpl bool CheckPreparsedJsCachingEnabled() const; scoped_ptr<RendererClipboardClient> clipboard_client_; - scoped_ptr<webkit_glue::WebClipboardImpl> clipboard_; + scoped_ptr<WebClipboardImpl> clipboard_; class FileUtilities; scoped_ptr<FileUtilities> file_utilities_; diff --git a/webkit/glue/scoped_clipboard_writer_glue.cc b/content/renderer/scoped_clipboard_writer_glue.cc index 0aa53a4..4403952 100644 --- a/webkit/glue/scoped_clipboard_writer_glue.cc +++ b/content/renderer/scoped_clipboard_writer_glue.cc @@ -1,14 +1,13 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2013 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. -#include "webkit/glue/scoped_clipboard_writer_glue.h" +#include "content/renderer/scoped_clipboard_writer_glue.h" #include "base/logging.h" -namespace webkit_glue { +namespace content { -ScopedClipboardWriterGlue::ScopedClipboardWriterGlue( - webkit_glue::ClipboardClient* client) +ScopedClipboardWriterGlue::ScopedClipboardWriterGlue(ClipboardClient* client) : ui::ScopedClipboardWriter(client->GetClipboard(), ui::Clipboard::BUFFER_STANDARD), context_(client->CreateWriteContext()) { @@ -32,4 +31,5 @@ void ScopedClipboardWriterGlue::WriteBitmapFromPixels(const void* pixels, } } -} // namespace webkit_glue +} // namespace content + diff --git a/content/renderer/scoped_clipboard_writer_glue.h b/content/renderer/scoped_clipboard_writer_glue.h new file mode 100644 index 0000000..05f0c73 --- /dev/null +++ b/content/renderer/scoped_clipboard_writer_glue.h @@ -0,0 +1,29 @@ +// Copyright (c) 2013 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. + +#ifndef CONTENT_RENDERER_SCOPED_CLIPBOARD_WRITER_GLUE_H_ +#define CONTENT_RENDERER_SCOPED_CLIPBOARD_WRITER_GLUE_H_ + +#include "ui/base/clipboard/scoped_clipboard_writer.h" +#include "base/memory/scoped_ptr.h" +#include "content/renderer/clipboard_client.h" + +namespace content { + +class ScopedClipboardWriterGlue + : public ui::ScopedClipboardWriter { + public: + explicit ScopedClipboardWriterGlue(ClipboardClient* client); + + virtual ~ScopedClipboardWriterGlue(); + + void WriteBitmapFromPixels(const void* pixels, const gfx::Size& size); + + private: + scoped_ptr<ClipboardClient::WriteContext> context_; + DISALLOW_COPY_AND_ASSIGN(ScopedClipboardWriterGlue); +}; + +} // namespace content +#endif // WEBKIT_GLUE_SCOPED_CLIPBOARD_WRITER_GLUE_H_ diff --git a/webkit/glue/webclipboard_impl.cc b/content/renderer/webclipboard_impl.cc index 55ba3a5..7ba388d 100644 --- a/webkit/glue/webclipboard_impl.cc +++ b/content/renderer/webclipboard_impl.cc @@ -1,15 +1,15 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2013 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. -#include "webkit/glue/webclipboard_impl.h" +#include "content/renderer/webclipboard_impl.h" #include "base/logging.h" #include "base/pickle.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" +#include "content/renderer/scoped_clipboard_writer_glue.h" #include "googleurl/src/gurl.h" -#include "net/base/escape.h" #include "third_party/WebKit/public/platform/WebData.h" #include "third_party/WebKit/public/platform/WebDragData.h" #include "third_party/WebKit/public/platform/WebImage.h" @@ -21,8 +21,8 @@ #include "ui/base/clipboard/clipboard.h" #include "ui/base/clipboard/custom_data_helper.h" #include "webkit/common/webdropdata.h" -#include "webkit/glue/scoped_clipboard_writer_glue.h" #include "webkit/glue/webkit_glue.h" +#include "webkit/renderer/clipboard_utils.h" using WebKit::WebClipboard; using WebKit::WebData; @@ -32,34 +32,7 @@ using WebKit::WebString; using WebKit::WebURL; using WebKit::WebVector; -namespace webkit_glue { - -// Static -std::string WebClipboardImpl::URLToMarkup(const WebURL& url, - const WebString& title) { - std::string markup("<a href=\""); - markup.append(url.spec()); - markup.append("\">"); - // TODO(darin): HTML escape this - markup.append(net::EscapeForHTML(UTF16ToUTF8(title))); - markup.append("</a>"); - return markup; -} - -// Static -std::string WebClipboardImpl::URLToImageMarkup(const WebURL& url, - const WebString& title) { - std::string markup("<img src=\""); - markup.append(url.spec()); - markup.append("\""); - if (!title.isEmpty()) { - markup.append(" alt=\""); - markup.append(net::EscapeForHTML(UTF16ToUTF8(title))); - markup.append("\""); - } - markup.append("/>"); - return markup; -} +namespace content { WebClipboardImpl::WebClipboardImpl(ClipboardClient* client) : client_(client) { @@ -201,7 +174,8 @@ void WebClipboardImpl::writeURL(const WebURL& url, const WebString& title) { ScopedClipboardWriterGlue scw(client_); scw.WriteBookmark(title, url.spec()); - scw.WriteHTML(UTF8ToUTF16(URLToMarkup(url, title)), std::string()); + scw.WriteHTML(UTF8ToUTF16(webkit_clipboard::URLToMarkup(url, title)), + std::string()); scw.WriteText(UTF8ToUTF16(std::string(url.spec()))); } @@ -225,7 +199,8 @@ void WebClipboardImpl::writeImage( // We also don't want to write HTML on a Mac, since Mail.app prefers to use // the image markup over attaching the actual image. See // http://crbug.com/33016 for details. - scw.WriteHTML(UTF8ToUTF16(URLToImageMarkup(url, title)), std::string()); + scw.WriteHTML(UTF8ToUTF16(webkit_clipboard::URLToImageMarkup(url, title)), + std::string()); #endif } } @@ -275,4 +250,5 @@ bool WebClipboardImpl::ConvertBufferType(Buffer buffer, return true; } -} // namespace webkit_glue +} // namespace content + diff --git a/webkit/glue/webclipboard_impl.h b/content/renderer/webclipboard_impl.h index 3943d20..e5a12aa 100644 --- a/webkit/glue/webclipboard_impl.h +++ b/content/renderer/webclipboard_impl.h @@ -1,28 +1,22 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2013 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. -#ifndef WEBCLIPBOARD_IMPL_H_ -#define WEBCLIPBOARD_IMPL_H_ +#ifndef CONTENT_RENDERER_WEBCLIPBOARD_IMPL_H_ +#define CONTENT_RENDERER_WEBCLIPBOARD_IMPL_H_ #include "base/compiler_specific.h" + #include "third_party/WebKit/public/platform/WebClipboard.h" #include "ui/base/clipboard/clipboard.h" -#include "webkit/glue/webkit_glue_export.h" #include <string> -namespace webkit_glue { +namespace content { class ClipboardClient; -class WEBKIT_GLUE_EXPORT WebClipboardImpl : - NON_EXPORTED_BASE(public WebKit::WebClipboard) { +class WebClipboardImpl : public WebKit::WebClipboard { public: - static std::string URLToMarkup(const WebKit::WebURL& url, - const WebKit::WebString& title); - static std::string URLToImageMarkup(const WebKit::WebURL& url, - const WebKit::WebString& title); - explicit WebClipboardImpl(ClipboardClient* client); virtual ~WebClipboardImpl(); @@ -62,6 +56,7 @@ class WEBKIT_GLUE_EXPORT WebClipboardImpl : ClipboardClient* client_; }; -} // namespace webkit_glue +} // namespace content + +#endif // CONTENT_RENDERER_WEBCLIPBOARD_IMPL_H_ -#endif // WEBCLIPBOARD_IMPL_H_ diff --git a/webkit/glue/scoped_clipboard_writer_glue.h b/webkit/glue/scoped_clipboard_writer_glue.h deleted file mode 100644 index 915b427..0000000 --- a/webkit/glue/scoped_clipboard_writer_glue.h +++ /dev/null @@ -1,31 +0,0 @@ -// 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. - -#ifndef WEBKIT_GLUE_SCOPED_CLIPBOARD_WRITER_GLUE_H_ -#define WEBKIT_GLUE_SCOPED_CLIPBOARD_WRITER_GLUE_H_ - -#include "ui/base/clipboard/scoped_clipboard_writer.h" -#include "base/memory/scoped_ptr.h" -#include "webkit/glue/clipboard_client.h" -#include "webkit/glue/webkit_glue_export.h" - -namespace webkit_glue { - -class WEBKIT_GLUE_EXPORT ScopedClipboardWriterGlue - : public ui::ScopedClipboardWriter { - public: - explicit ScopedClipboardWriterGlue(webkit_glue::ClipboardClient* client); - - virtual ~ScopedClipboardWriterGlue(); - - void WriteBitmapFromPixels(const void* pixels, const gfx::Size& size); - - private: - scoped_ptr<webkit_glue::ClipboardClient::WriteContext> context_; - DISALLOW_COPY_AND_ASSIGN(ScopedClipboardWriterGlue); -}; - -} // namespace webkit_glue - -#endif // WEBKIT_GLUE_SCOPED_CLIPBOARD_WRITER_GLUE_H_ diff --git a/webkit/glue/webkit_glue.gypi b/webkit/glue/webkit_glue.gypi index bcfc8cd..32fc388 100644 --- a/webkit/glue/webkit_glue.gypi +++ b/webkit/glue/webkit_glue.gypi @@ -204,6 +204,7 @@ '<(DEPTH)/base/base.gyp:base', '<(DEPTH)/base/base.gyp:base_i18n', '<(DEPTH)/build/temp_gyp/googleurl.gyp:googleurl', + '<(DEPTH)/net/net.gyp:net', '<(DEPTH)/skia/skia.gyp:skia', '<(DEPTH)/third_party/WebKit/public/blink.gyp:blink', '<(DEPTH)/third_party/icu/icu.gyp:icuuc', @@ -217,6 +218,8 @@ '../renderer/cpp_bound_class.h', '../renderer/cpp_variant.cc', '../renderer/cpp_variant.h', + '../renderer/clipboard_utils.cc', + '../renderer/clipboard_utils.h', '../renderer/cursor_utils.cc', '../renderer/cursor_utils.h', '../renderer/webkit_renderer_export.h', @@ -285,12 +288,8 @@ 'resource_request_body.h', 'resource_type.cc', 'resource_type.h', - 'scoped_clipboard_writer_glue.cc', - 'scoped_clipboard_writer_glue.h', 'simple_webmimeregistry_impl.cc', 'simple_webmimeregistry_impl.h', - 'webclipboard_impl.cc', - 'webclipboard_impl.h', 'webfileutilities_impl.cc', 'webfileutilities_impl.h', 'webkit_glue.cc', diff --git a/webkit/plugins/ppapi/plugin_delegate.h b/webkit/plugins/ppapi/plugin_delegate.h index 1e1dfb5..056660b 100644 --- a/webkit/plugins/ppapi/plugin_delegate.h +++ b/webkit/plugins/ppapi/plugin_delegate.h @@ -36,7 +36,6 @@ #include "ui/gfx/size.h" #include "webkit/common/fileapi/file_system_types.h" #include "webkit/common/quota/quota_types.h" -#include "webkit/glue/clipboard_client.h" #include "webkit/plugins/webkit_plugins_export.h" class GURL; @@ -93,7 +92,6 @@ class WebURLResponse; } namespace webkit_glue { -class ClipboardClient; class P2PTransport; class NetworkListObserver; } // namespace webkit_glue diff --git a/webkit/renderer/clipboard_utils.cc b/webkit/renderer/clipboard_utils.cc new file mode 100644 index 0000000..2cee028 --- /dev/null +++ b/webkit/renderer/clipboard_utils.cc @@ -0,0 +1,38 @@ +// Copyright (c) 2013 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. +// + +#include "webkit/renderer/clipboard_utils.h" + +#include "base/strings/utf_string_conversions.h" +#include "net/base/escape.h" + +namespace webkit_clipboard { + +// Static +std::string URLToMarkup(const WebURL& url, const WebString& title) { + std::string markup("<a href=\""); + markup.append(url.spec()); + markup.append("\">"); + // TODO(darin): HTML escape this + markup.append(net::EscapeForHTML(UTF16ToUTF8(title))); + markup.append("</a>"); + return markup; +} + +std::string URLToImageMarkup(const WebURL& url, const WebString& title) { + std::string markup("<img src=\""); + markup.append(url.spec()); + markup.append("\""); + if (!title.isEmpty()) { + markup.append(" alt=\""); + markup.append(net::EscapeForHTML(UTF16ToUTF8(title))); + markup.append("\""); + } + markup.append("/>"); + return markup; +} + +} // webkit_clipboard + diff --git a/webkit/renderer/clipboard_utils.h b/webkit/renderer/clipboard_utils.h new file mode 100644 index 0000000..ca7101a --- /dev/null +++ b/webkit/renderer/clipboard_utils.h @@ -0,0 +1,25 @@ +// Copyright (c) 2013 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. +// + +#ifndef WEBKIT_RENDERER_CLIPBOARD_UTILS_H_ +#define WEBKIT_RENDERER_CLIPBOARD_UTILS_H_ + +#include <string> +#include "third_party/WebKit/public/platform/WebClipboard.h" +#include "third_party/WebKit/public/platform/WebURL.h" +#include "webkit/renderer/webkit_renderer_export.h" + +using WebKit::WebString; +using WebKit::WebURL; + +namespace webkit_clipboard { + +WEBKIT_RENDERER_EXPORT std::string URLToMarkup(const WebURL& url, + const WebString& title); +WEBKIT_RENDERER_EXPORT std::string URLToImageMarkup(const WebURL& url, + const WebString& title); +} // webkit_clipboard + +#endif // WEBKIT_RENDERER_CLIPBOARD_UTILS_H_ diff --git a/webkit/support/mock_webclipboard_impl.cc b/webkit/support/mock_webclipboard_impl.cc index 2ff08fc..746bb3c 100644 --- a/webkit/support/mock_webclipboard_impl.cc +++ b/webkit/support/mock_webclipboard_impl.cc @@ -15,8 +15,8 @@ #include "third_party/WebKit/public/platform/WebImage.h" #include "third_party/WebKit/public/platform/WebURL.h" #include "ui/base/clipboard/clipboard.h" -#include "webkit/glue/webclipboard_impl.h" #include "webkit/glue/webkit_glue.h" +#include "webkit/renderer/clipboard_utils.h" #include "webkit/support/webkit_support_gfx.h" using WebKit::WebDragData; @@ -155,8 +155,7 @@ void MockWebClipboardImpl::writeURL( const WebKit::WebURL& url, const WebKit::WebString& title) { clear(); - m_htmlText = WebString::fromUTF8( - webkit_glue::WebClipboardImpl::URLToMarkup(url, title)); + m_htmlText = WebString::fromUTF8(webkit_clipboard::URLToMarkup(url, title)); m_plainText = url.spec().utf16(); } @@ -167,7 +166,7 @@ void MockWebClipboardImpl::writeImage(const WebKit::WebImage& image, m_plainText = m_htmlText; m_htmlText = WebString::fromUTF8( - webkit_glue::WebClipboardImpl::URLToImageMarkup(url, title)); + webkit_clipboard::URLToImageMarkup(url, title)); m_image = image; } } diff --git a/webkit/support/simple_clipboard_impl.cc b/webkit/support/simple_clipboard_impl.cc deleted file mode 100644 index 437ff48..0000000 --- a/webkit/support/simple_clipboard_impl.cc +++ /dev/null @@ -1,118 +0,0 @@ -// 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. - -#include "webkit/support/simple_clipboard_impl.h" - -#include <string> - -#include "base/lazy_instance.h" -#include "base/stl_util.h" -#include "base/strings/string16.h" -#include "googleurl/src/gurl.h" -#include "third_party/skia/include/core/SkBitmap.h" -#include "third_party/zlib/zlib.h" -#include "ui/base/clipboard/clipboard.h" -#include "ui/gfx/codec/png_codec.h" -#include "ui/gfx/size.h" -#include "webkit/glue/webkit_glue.h" - -namespace { - -} // anonymous namespace - -SimpleClipboardClient::SimpleClipboardClient() { -} - -SimpleClipboardClient::~SimpleClipboardClient() { -} - - -ui::Clipboard* SimpleClipboardClient::GetClipboard() { - return ui::Clipboard::GetForCurrentThread(); -} - -uint64 SimpleClipboardClient::GetSequenceNumber(ui::Clipboard::Buffer buffer) { - return GetClipboard()->GetSequenceNumber(buffer); -} - -bool SimpleClipboardClient::IsFormatAvailable( - const ui::Clipboard::FormatType& format, - ui::Clipboard::Buffer buffer) { - return GetClipboard()->IsFormatAvailable(format, buffer); -} - -void SimpleClipboardClient::Clear(ui::Clipboard::Buffer buffer) { - GetClipboard()->Clear(buffer); -} - -void SimpleClipboardClient::ReadAvailableTypes( - ui::Clipboard::Buffer buffer, - std::vector<base::string16>* types, - bool* contains_filenames) { - return GetClipboard()->ReadAvailableTypes(buffer, types, contains_filenames); -} - -void SimpleClipboardClient::ReadText(ui::Clipboard::Buffer buffer, - base::string16* result) { - GetClipboard()->ReadText(buffer, result); -} - -void SimpleClipboardClient::ReadAsciiText(ui::Clipboard::Buffer buffer, - std::string* result) { - GetClipboard()->ReadAsciiText(buffer, result); -} - -void SimpleClipboardClient::ReadHTML(ui::Clipboard::Buffer buffer, - base::string16* markup, - GURL* url, uint32* fragment_start, - uint32* fragment_end) { - std::string url_str; - GetClipboard()->ReadHTML(buffer, markup, url ? &url_str : NULL, - fragment_start, fragment_end); - if (url) - *url = GURL(url_str); -} - -void SimpleClipboardClient::ReadRTF(ui::Clipboard::Buffer buffer, - std::string* result) { - GetClipboard()->ReadRTF(buffer, result); -} - -void SimpleClipboardClient::ReadImage(ui::Clipboard::Buffer buffer, - std::string* data) { - SkBitmap bitmap = GetClipboard()->ReadImage(buffer); - if (bitmap.isNull()) - return; - - std::vector<unsigned char> png_data; - SkAutoLockPixels lock(bitmap); - if (gfx::PNGCodec::EncodeWithCompressionLevel( - static_cast<const unsigned char*>(bitmap.getPixels()), - gfx::PNGCodec::FORMAT_BGRA, - gfx::Size(bitmap.width(), bitmap.height()), - bitmap.rowBytes(), - false, - std::vector<gfx::PNGCodec::Comment>(), - Z_BEST_SPEED, - &png_data)) { - data->assign(reinterpret_cast<char*>(vector_as_array(&png_data)), - png_data.size()); - } -} - -void SimpleClipboardClient::ReadCustomData(ui::Clipboard::Buffer buffer, - const base::string16& type, - base::string16* data) { - GetClipboard()->ReadCustomData(buffer, type, data); -} - -void SimpleClipboardClient::ReadData(const ui::Clipboard::FormatType& format, - std::string* data) { - GetClipboard()->ReadData(format, data); -} - -webkit_glue::ClipboardClient::WriteContext* -SimpleClipboardClient::CreateWriteContext() { - return NULL; -} diff --git a/webkit/support/simple_clipboard_impl.h b/webkit/support/simple_clipboard_impl.h deleted file mode 100644 index 0d3d146..0000000 --- a/webkit/support/simple_clipboard_impl.h +++ /dev/null @@ -1,43 +0,0 @@ -// 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. - -#ifndef WEBKIT_SUPPORT_SIMPLE_CLIPBOARD_IMPL_H_ -#define WEBKIT_SUPPORT_SIMPLE_CLIPBOARD_IMPL_H_ - -#include "base/compiler_specific.h" -#include "webkit/glue/clipboard_client.h" - -class SimpleClipboardClient : public webkit_glue::ClipboardClient { - public: - SimpleClipboardClient(); - virtual ~SimpleClipboardClient(); - - virtual ui::Clipboard* GetClipboard() OVERRIDE; - virtual uint64 GetSequenceNumber(ui::Clipboard::Buffer buffer) OVERRIDE; - virtual bool IsFormatAvailable(const ui::Clipboard::FormatType& format, - ui::Clipboard::Buffer buffer) OVERRIDE; - virtual void Clear(ui::Clipboard::Buffer buffer) OVERRIDE; - virtual void ReadAvailableTypes(ui::Clipboard::Buffer buffer, - std::vector<base::string16>* types, - bool* contains_filenames) OVERRIDE; - virtual void ReadText(ui::Clipboard::Buffer buffer, - base::string16* result) OVERRIDE; - virtual void ReadAsciiText(ui::Clipboard::Buffer buffer, - std::string* result) OVERRIDE; - virtual void ReadHTML(ui::Clipboard::Buffer buffer, base::string16* markup, - GURL* url, uint32* fragment_start, - uint32* fragment_end) OVERRIDE; - virtual void ReadRTF(ui::Clipboard::Buffer buffer, - std::string* result) OVERRIDE; - virtual void ReadImage(ui::Clipboard::Buffer buffer, - std::string* data) OVERRIDE; - virtual void ReadCustomData(ui::Clipboard::Buffer buffer, - const base::string16& type, - base::string16* data) OVERRIDE; - virtual void ReadData(const ui::Clipboard::FormatType& format, - std::string* data) OVERRIDE; - virtual WriteContext* CreateWriteContext() OVERRIDE; -}; - -#endif // WEBKIT_SUPPORT_SIMPLE_CLIPBOARD_IMPL_H_ diff --git a/webkit/support/test_webkit_platform_support.cc b/webkit/support/test_webkit_platform_support.cc index 4f33d15..e55e911 100644 --- a/webkit/support/test_webkit_platform_support.cc +++ b/webkit/support/test_webkit_platform_support.cc @@ -35,7 +35,6 @@ #include "webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h" #include "webkit/common/gpu/webgraphicscontext3d_provider_impl.h" #include "webkit/glue/simple_webmimeregistry_impl.h" -#include "webkit/glue/webclipboard_impl.h" #include "webkit/glue/webkit_glue.h" #include "webkit/glue/webkitplatformsupport_impl.h" #include "webkit/plugins/npapi/plugin_list.h" diff --git a/webkit/support/webkit_support.gypi b/webkit/support/webkit_support.gypi index 77a9418..9644594 100644 --- a/webkit/support/webkit_support.gypi +++ b/webkit/support/webkit_support.gypi @@ -35,6 +35,7 @@ 'glue', 'glue_child', 'glue_common', + 'glue_renderer', 'plugins', 'webkit_common', 'webkit_media', @@ -115,6 +116,7 @@ '<(DEPTH)/ui/ui.gyp:ui', '<(DEPTH)/webkit/common/user_agent/webkit_user_agent.gyp:user_agent', 'glue', + 'glue_renderer', 'webkit_support_gfx', ], 'export_dependent_settings': [ @@ -133,7 +135,6 @@ '<(DEPTH)/webkit/support/mock_webclipboard_impl.h', '<(DEPTH)/webkit/support/simple_appcache_system.cc', '<(DEPTH)/webkit/support/simple_appcache_system.h', - '<(DEPTH)/webkit/support/simple_clipboard_impl.cc', '<(DEPTH)/webkit/support/simple_dom_storage_system.cc', '<(DEPTH)/webkit/support/simple_dom_storage_system.h', '<(DEPTH)/webkit/support/simple_file_system.cc', |