diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-10 21:08:21 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-10 21:08:21 +0000 |
commit | 2dfeaf9c751b9ff269ca8bcd8f9e4902a0c9012c (patch) | |
tree | 86e7ab4c054af5723245dc0bdead5c08a308a466 | |
parent | 6f1d18ebd4dd4315b02197c4593ad905a9049f8b (diff) | |
download | chromium_src-2dfeaf9c751b9ff269ca8bcd8f9e4902a0c9012c.zip chromium_src-2dfeaf9c751b9ff269ca8bcd8f9e4902a0c9012c.tar.gz chromium_src-2dfeaf9c751b9ff269ca8bcd8f9e4902a0c9012c.tar.bz2 |
Move clipboard from app/ to ui/base
BUG=none
TEST=none
TBR=brettw
Review URL: http://codereview.chromium.org/6135006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70938 0039d316-1c4b-4281-b951-d872f2087c98
60 files changed, 374 insertions, 299 deletions
@@ -5,6 +5,7 @@ include_rules = [ "+net", "+skia", "+third_party/mozilla", + "+ui", "-chrome", "-third_party/WebKit", diff --git a/app/app.gyp b/app/app.gyp index f15b44d..a0435f8 100644 --- a/app/app.gyp +++ b/app/app.gyp @@ -36,10 +36,10 @@ '../third_party/icu/icu.gyp:icuuc', '../third_party/libpng/libpng.gyp:libpng', '../third_party/zlib/zlib.gyp:zlib', + '../ui/ui.gyp:ui_base', '<(libjpeg_gyp_path):libjpeg', ], 'sources': [ - 'clipboard/clipboard_unittest.cc', 'data_pack_unittest.cc', 'l10n_util_mac_unittest.mm', 'l10n_util_unittest.cc', diff --git a/app/app_base.gypi b/app/app_base.gypi index 3f27573..1431ce1 100644 --- a/app/app_base.gypi +++ b/app/app_base.gypi @@ -92,15 +92,6 @@ 'active_window_watcher_x.cc', 'active_window_watcher_x.h', 'bidi_line_iterator.cc', - 'clipboard/clipboard.cc', - 'clipboard/clipboard.h', - 'clipboard/clipboard_linux.cc', - 'clipboard/clipboard_mac.mm', - 'clipboard/clipboard_util_win.cc', - 'clipboard/clipboard_util_win.h', - 'clipboard/clipboard_win.cc', - 'clipboard/scoped_clipboard_writer.cc', - 'clipboard/scoped_clipboard_writer.h', 'combobox_model.h', 'data_pack.cc', 'data_pack.h', diff --git a/app/os_exchange_data_provider_win.cc b/app/os_exchange_data_provider_win.cc index d6635ea..8dbd7e3 100644 --- a/app/os_exchange_data_provider_win.cc +++ b/app/os_exchange_data_provider_win.cc @@ -4,7 +4,6 @@ #include "app/os_exchange_data_provider_win.h" -#include "app/clipboard/clipboard_util_win.h" #include "app/l10n_util.h" #include "base/file_path.h" #include "base/i18n/file_util_icu.h" @@ -17,6 +16,9 @@ #include "googleurl/src/gurl.h" #include "grit/app_strings.h" #include "net/base/net_util.h" +#include "ui/base/clipboard/clipboard_util_win.h" + +using ui::ClipboardUtil; // Creates a new STGMEDIUM object to hold the specified text. The caller // owns the resulting object. The "Bytes" version does not NULL terminate, the diff --git a/app/os_exchange_data_win_unittest.cc b/app/os_exchange_data_win_unittest.cc index e76a52b..39fe2a6 100644 --- a/app/os_exchange_data_win_unittest.cc +++ b/app/os_exchange_data_win_unittest.cc @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "app/clipboard/clipboard_util_win.h" #include "app/os_exchange_data.h" #include "app/os_exchange_data_provider_win.h" #include "base/pickle.h" @@ -13,6 +12,7 @@ #include "base/win/scoped_hglobal.h" #include "googleurl/src/gurl.h" #include "testing/gtest/include/gtest/gtest.h" +#include "ui/base/clipboard/clipboard_util_win.h" typedef testing::Test OSExchangeDataTest; @@ -347,7 +347,7 @@ TEST(OSExchangeDataTest, Html) { STGMEDIUM medium; IDataObject* data_object = OSExchangeDataProviderWin::GetIDataObject(data); EXPECT_EQ(S_OK, - data_object->GetData(ClipboardUtil::GetHtmlFormat(), &medium)); + data_object->GetData(ui::ClipboardUtil::GetHtmlFormat(), &medium)); base::win::ScopedHGlobal<char> glob(medium.hGlobal); std::string output(glob.get(), glob.Size()); EXPECT_EQ(expected_cf_html, output); diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_mac.h b/chrome/browser/autocomplete/autocomplete_edit_view_mac.h index d486cc5..fc974ad 100644 --- a/chrome/browser/autocomplete/autocomplete_edit_view_mac.h +++ b/chrome/browser/autocomplete/autocomplete_edit_view_mac.h @@ -15,10 +15,13 @@ class AutocompleteEditController; class AutocompletePopupViewMac; -class Clipboard; class Profile; class ToolbarModel; +namespace ui { +class Clipboard; +} + // Implements AutocompleteEditView on an AutocompleteTextField. class AutocompleteEditViewMac : public AutocompleteEditView, @@ -107,7 +110,7 @@ class AutocompleteEditViewMac : public AutocompleteEditView, // Helper to get appropriate contents from |clipboard|. Returns // empty string if no appropriate data is found on |clipboard|. - static std::wstring GetClipboardText(Clipboard* clipboard); + static std::wstring GetClipboardText(ui::Clipboard* clipboard); // Helper to get the font to use in the field, exposed for the // popup. diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm b/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm index ce2c0f1..c19d5727 100644 --- a/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm +++ b/chrome/browser/autocomplete/autocomplete_edit_view_mac.mm @@ -6,8 +6,6 @@ #include <Carbon/Carbon.h> // kVK_Return -#include "app/clipboard/clipboard.h" -#include "app/clipboard/scoped_clipboard_writer.h" #include "app/mac/nsimage_cache.h" #include "app/resource_bundle.h" #include "base/string_util.h" @@ -25,6 +23,7 @@ #include "grit/theme_resources.h" #include "net/base/escape.h" #import "third_party/mozilla/NSPasteboard+Utils.h" +#include "ui/base/clipboard/clipboard.h" // Focus-handling between |field_| and |model_| is a bit subtle. // Other platforms detect change of focus, which is inconvenient @@ -1042,15 +1041,16 @@ void AutocompleteEditViewMac::FocusLocation(bool select_all) { // TODO(shess): Copied from autocomplete_edit_view_win.cc. Could this // be pushed into the model? -std::wstring AutocompleteEditViewMac::GetClipboardText(Clipboard* clipboard) { +std::wstring AutocompleteEditViewMac::GetClipboardText( + ui::Clipboard* clipboard) { // autocomplete_edit_view_win.cc assumes this can never happen, we // will too. DCHECK(clipboard); - if (clipboard->IsFormatAvailable(Clipboard::GetPlainTextWFormatType(), - Clipboard::BUFFER_STANDARD)) { + if (clipboard->IsFormatAvailable(ui::Clipboard::GetPlainTextWFormatType(), + ui::Clipboard::BUFFER_STANDARD)) { string16 text16; - clipboard->ReadText(Clipboard::BUFFER_STANDARD, &text16); + clipboard->ReadText(ui::Clipboard::BUFFER_STANDARD, &text16); // Note: Unlike in the find popup and textfield view, here we completely // remove whitespace strings containing newlines. We assume users are @@ -1068,8 +1068,8 @@ std::wstring AutocompleteEditViewMac::GetClipboardText(Clipboard* clipboard) { // and pastes from the URL bar to itself, the text will get fixed up and // cannonicalized, which is not what the user expects. By pasting in this // order, we are sure to paste what the user copied. - if (clipboard->IsFormatAvailable(Clipboard::GetUrlWFormatType(), - Clipboard::BUFFER_STANDARD)) { + if (clipboard->IsFormatAvailable(ui::Clipboard::GetUrlWFormatType(), + ui::Clipboard::BUFFER_STANDARD)) { std::string url_str; clipboard->ReadBookmark(NULL, &url_str); // pass resulting url string through GURL to normalize diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_mac_unittest.mm b/chrome/browser/autocomplete/autocomplete_edit_view_mac_unittest.mm index bf61499..da52d28 100644 --- a/chrome/browser/autocomplete/autocomplete_edit_view_mac_unittest.mm +++ b/chrome/browser/autocomplete/autocomplete_edit_view_mac_unittest.mm @@ -4,23 +4,23 @@ #import "chrome/browser/autocomplete/autocomplete_edit_view_mac.h" -#include "app/clipboard/clipboard.h" -#include "app/clipboard/scoped_clipboard_writer.h" #include "base/string_util.h" #include "base/sys_string_conversions.h" #include "base/utf_string_conversions.h" #include "chrome/browser/autocomplete/autocomplete.h" #include "gfx/size.h" #include "testing/platform_test.h" +#include "ui/base/clipboard/clipboard.h" +#include "ui/base/clipboard/scoped_clipboard_writer.h" namespace { TEST(AutocompleteEditViewMacTest, GetClipboardText) { - Clipboard clipboard; + ui::Clipboard clipboard; std::wstring text; // Does an empty clipboard get empty text? - clipboard.WriteObjects(Clipboard::ObjectMap()); + clipboard.WriteObjects(ui::Clipboard::ObjectMap()); text = AutocompleteEditViewMac::GetClipboardText(&clipboard); EXPECT_EQ(std::wstring(), text); @@ -30,7 +30,7 @@ TEST(AutocompleteEditViewMacTest, GetClipboardText) { // Can we pull straight text off the clipboard? { - ScopedClipboardWriter clipboard_writer(&clipboard); + ui::ScopedClipboardWriter clipboard_writer(&clipboard); clipboard_writer.WriteText(plainText); } @@ -39,7 +39,7 @@ TEST(AutocompleteEditViewMacTest, GetClipboardText) { // Can we pull a bookmark off the clipboard? { - ScopedClipboardWriter clipboard_writer(&clipboard); + ui::ScopedClipboardWriter clipboard_writer(&clipboard); clipboard_writer.WriteBookmark(title, url); } @@ -48,7 +48,7 @@ TEST(AutocompleteEditViewMacTest, GetClipboardText) { // Do we pull text in preference to a bookmark? { - ScopedClipboardWriter clipboard_writer(&clipboard); + ui::ScopedClipboardWriter clipboard_writer(&clipboard); clipboard_writer.WriteText(plainText); clipboard_writer.WriteBookmark(title, url); } @@ -59,7 +59,7 @@ TEST(AutocompleteEditViewMacTest, GetClipboardText) { // Do we get nothing if there is neither text nor a bookmark? { const string16 markup(ASCIIToUTF16("<strong>Hi!</string>")); - ScopedClipboardWriter clipboard_writer(&clipboard); + ui::ScopedClipboardWriter clipboard_writer(&clipboard); clipboard_writer.WriteHTML(markup, url); } diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_win.cc b/chrome/browser/autocomplete/autocomplete_edit_view_win.cc index df2a8ba..fa32d13 100644 --- a/chrome/browser/autocomplete/autocomplete_edit_view_win.cc +++ b/chrome/browser/autocomplete/autocomplete_edit_view_win.cc @@ -11,8 +11,6 @@ #include <richedit.h> #include <textserv.h> -#include "app/clipboard/clipboard.h" -#include "app/clipboard/scoped_clipboard_writer.h" #include "app/keyboard_codes.h" #include "app/l10n_util.h" #include "app/l10n_util_win.h" @@ -50,6 +48,8 @@ #include "grit/generated_resources.h" #include "net/base/escape.h" #include "skia/ext/skia_utils_win.h" +#include "ui/base/clipboard/clipboard.h" +#include "ui/base/clipboard/scoped_clipboard_writer.h" #include "views/drag_utils.h" #include "views/focus/focus_util_win.h" #include "views/widget/widget.h" @@ -1252,7 +1252,7 @@ void AutocompleteEditViewWin::OnCopy() { // GetSel() doesn't preserve selection direction, so sel.cpMin will always be // the smaller value. model_->AdjustTextForCopy(sel.cpMin, IsSelectAll(), &text, &url, &write_url); - ScopedClipboardWriter scw(g_browser_process->clipboard()); + ui::ScopedClipboardWriter scw(g_browser_process->clipboard()); scw.WriteText(text); if (write_url) { scw.WriteBookmark(text, url.spec()); @@ -2360,11 +2360,11 @@ void AutocompleteEditViewWin::TextChanged() { std::wstring AutocompleteEditViewWin::GetClipboardText() const { // Try text format. - Clipboard* clipboard = g_browser_process->clipboard(); - if (clipboard->IsFormatAvailable(Clipboard::GetPlainTextWFormatType(), - Clipboard::BUFFER_STANDARD)) { + ui::Clipboard* clipboard = g_browser_process->clipboard(); + if (clipboard->IsFormatAvailable(ui::Clipboard::GetPlainTextWFormatType(), + ui::Clipboard::BUFFER_STANDARD)) { std::wstring text; - clipboard->ReadText(Clipboard::BUFFER_STANDARD, &text); + clipboard->ReadText(ui::Clipboard::BUFFER_STANDARD, &text); // Note: Unlike in the find popup and textfield view, here we completely // remove whitespace strings containing newlines. We assume users are @@ -2382,8 +2382,8 @@ std::wstring AutocompleteEditViewWin::GetClipboardText() const { // and pastes from the URL bar to itself, the text will get fixed up and // cannonicalized, which is not what the user expects. By pasting in this // order, we are sure to paste what the user copied. - if (clipboard->IsFormatAvailable(Clipboard::GetUrlWFormatType(), - Clipboard::BUFFER_STANDARD)) { + if (clipboard->IsFormatAvailable(ui::Clipboard::GetUrlWFormatType(), + ui::Clipboard::BUFFER_STANDARD)) { std::string url_str; clipboard->ReadBookmark(NULL, &url_str); // pass resulting url string through GURL to normalize diff --git a/chrome/browser/bookmarks/bookmark_node_data.cc b/chrome/browser/bookmarks/bookmark_node_data.cc index 27e8683..e51c17c 100644 --- a/chrome/browser/bookmarks/bookmark_node_data.cc +++ b/chrome/browser/bookmarks/bookmark_node_data.cc @@ -6,7 +6,6 @@ #include <string> -#include "app/clipboard/scoped_clipboard_writer.h" #include "base/basictypes.h" #include "base/pickle.h" #include "base/string_util.h" @@ -15,6 +14,7 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/common/url_constants.h" #include "net/base/escape.h" +#include "ui/base/clipboard/scoped_clipboard_writer.h" #if defined(OS_MACOSX) #include "chrome/browser/bookmarks/bookmark_pasteboard_helper_mac.h" @@ -140,7 +140,7 @@ bool BookmarkNodeData::ReadFromTuple(const GURL& url, const string16& title) { #if !defined(OS_MACOSX) void BookmarkNodeData::WriteToClipboard(Profile* profile) const { - ScopedClipboardWriter scw(g_browser_process->clipboard()); + ui::ScopedClipboardWriter scw(g_browser_process->clipboard()); // If there is only one element and it is a URL, write the URL to the // clipboard. @@ -166,7 +166,7 @@ void BookmarkNodeData::WriteToClipboard(Profile* profile) const { bool BookmarkNodeData::ReadFromClipboard() { std::string data; - Clipboard* clipboard = g_browser_process->clipboard(); + ui::Clipboard* clipboard = g_browser_process->clipboard(); clipboard->ReadData(kClipboardFormatString, &data); if (!data.empty()) { @@ -194,7 +194,7 @@ bool BookmarkNodeData::ReadFromClipboard() { bool BookmarkNodeData::ClipboardContainsBookmarks() { return g_browser_process->clipboard()->IsFormatAvailableByString( - BookmarkNodeData::kClipboardFormatString, Clipboard::BUFFER_STANDARD); + BookmarkNodeData::kClipboardFormatString, ui::Clipboard::BUFFER_STANDARD); } #else void BookmarkNodeData::WriteToClipboard(Profile* profile) const { diff --git a/chrome/browser/bookmarks/bookmark_utils_unittest.cc b/chrome/browser/bookmarks/bookmark_utils_unittest.cc index 9de3b66..b1e3577 100644 --- a/chrome/browser/bookmarks/bookmark_utils_unittest.cc +++ b/chrome/browser/bookmarks/bookmark_utils_unittest.cc @@ -4,12 +4,12 @@ #include "testing/gtest/include/gtest/gtest.h" -#include "app/clipboard/scoped_clipboard_writer.h" #include "base/message_loop.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" #include "chrome/browser/bookmarks/bookmark_model.h" #include "chrome/browser/bookmarks/bookmark_utils.h" +#include "ui/base/clipboard/scoped_clipboard_writer.h" #if !defined(OS_MACOSX) #include "chrome/browser/browser_process.h" @@ -121,7 +121,7 @@ TEST_F(BookmarkUtilsTest, CopyPaste) { // Write some text to the clipboard. { - ScopedClipboardWriter clipboard_writer(g_browser_process->clipboard()); + ui::ScopedClipboardWriter clipboard_writer(g_browser_process->clipboard()); clipboard_writer.WriteText(ASCIIToUTF16("foo")); } diff --git a/chrome/browser/browser_process.h b/chrome/browser/browser_process.h index 409771a..1f335c0 100644 --- a/chrome/browser/browser_process.h +++ b/chrome/browser/browser_process.h @@ -23,7 +23,6 @@ namespace safe_browsing { class ClientSideDetectionService; } -class Clipboard; class DevToolsManager; class DownloadRequestLimiter; class DownloadStatusUpdater; @@ -54,6 +53,10 @@ namespace policy { class ConfigurationPolicyProviderKeeper; } +namespace ui { +class Clipboard; +} + // NOT THREAD SAFE, call only from the main thread. // These functions shouldn't return NULL unless otherwise noted. class BrowserProcess { @@ -75,7 +78,7 @@ class BrowserProcess { virtual PrefService* local_state() = 0; virtual DevToolsManager* devtools_manager() = 0; virtual SidebarManager* sidebar_manager() = 0; - virtual Clipboard* clipboard() = 0; + virtual ui::Clipboard* clipboard() = 0; // Returns the manager for desktop notifications. virtual NotificationUIManager* notification_ui_manager() = 0; diff --git a/chrome/browser/browser_process_impl.cc b/chrome/browser/browser_process_impl.cc index d6228eb..7a14807 100644 --- a/chrome/browser/browser_process_impl.cc +++ b/chrome/browser/browser_process_impl.cc @@ -6,7 +6,6 @@ #include <map> -#include "app/clipboard/clipboard.h" #include "app/l10n_util.h" #include "base/command_line.h" #include "base/file_util.h" @@ -62,6 +61,7 @@ #include "chrome/common/switch_utils.h" #include "chrome/installer/util/google_update_constants.h" #include "ipc/ipc_logging.h" +#include "ui/base/clipboard/clipboard.h" #include "webkit/database/database_tracker.h" #if defined(OS_WIN) @@ -109,7 +109,7 @@ BrowserProcessImpl::BrowserProcessImpl(const CommandLine& command_line) using_new_frames_(false), have_inspector_files_(true) { g_browser_process = this; - clipboard_.reset(new Clipboard); + clipboard_.reset(new ui::Clipboard); main_notification_service_.reset(new NotificationService); notification_registrar_.Add(this, @@ -407,7 +407,7 @@ SidebarManager* BrowserProcessImpl::sidebar_manager() { return sidebar_manager_.get(); } -Clipboard* BrowserProcessImpl::clipboard() { +ui::Clipboard* BrowserProcessImpl::clipboard() { DCHECK(CalledOnValidThread()); return clipboard_.get(); } diff --git a/chrome/browser/browser_process_impl.h b/chrome/browser/browser_process_impl.h index 8ec6f81..d3c03c5 100644 --- a/chrome/browser/browser_process_impl.h +++ b/chrome/browser/browser_process_impl.h @@ -59,7 +59,7 @@ class BrowserProcessImpl : public BrowserProcess, virtual PrefService* local_state(); virtual DevToolsManager* devtools_manager(); virtual SidebarManager* sidebar_manager(); - virtual Clipboard* clipboard(); + virtual ui::Clipboard* clipboard(); virtual NotificationUIManager* notification_ui_manager(); virtual policy::ConfigurationPolicyProviderKeeper* configuration_policy_provider_keeper(); @@ -188,7 +188,7 @@ class BrowserProcessImpl : public BrowserProcess, scoped_refptr<printing::PrintPreviewTabController> print_preview_tab_controller_; - scoped_ptr<Clipboard> clipboard_; + scoped_ptr<ui::Clipboard> clipboard_; // Manager for desktop notification UI. bool created_notification_ui_manager_; diff --git a/chrome/browser/clipboard_dispatcher.h b/chrome/browser/clipboard_dispatcher.h index 8b9b4eb..3ca3281 100644 --- a/chrome/browser/clipboard_dispatcher.h +++ b/chrome/browser/clipboard_dispatcher.h @@ -8,9 +8,9 @@ #include <vector> -#include "app/clipboard/clipboard.h" #include "base/basictypes.h" #include "base/string16.h" +#include "ui/base/clipboard/clipboard.h" // This class backs IPC requests from the renderer for clipboard data. In this // context, clipboard does not only refer to the usual concept of a clipboard @@ -23,12 +23,12 @@ // selection. class ClipboardDispatcher { public: - static bool ReadAvailableTypes(Clipboard::Buffer buffer, + static bool ReadAvailableTypes(ui::Clipboard::Buffer buffer, std::vector<string16>* types, bool* contains_filenames); - static bool ReadData(Clipboard::Buffer buffer, const string16& type, + static bool ReadData(ui::Clipboard::Buffer buffer, const string16& type, string16* data, string16* metadata); - static bool ReadFilenames(Clipboard::Buffer buffer, + static bool ReadFilenames(ui::Clipboard::Buffer buffer, std::vector<string16>* filenames); private: diff --git a/chrome/browser/clipboard_dispatcher_gtk.cc b/chrome/browser/clipboard_dispatcher_gtk.cc index a448468..f5a456f 100644 --- a/chrome/browser/clipboard_dispatcher_gtk.cc +++ b/chrome/browser/clipboard_dispatcher_gtk.cc @@ -5,7 +5,7 @@ #include "chrome/browser/clipboard_dispatcher.h" #include "base/logging.h" -bool ClipboardDispatcher::ReadAvailableTypes(Clipboard::Buffer buffer, +bool ClipboardDispatcher::ReadAvailableTypes(ui::Clipboard::Buffer buffer, std::vector<string16>* types, bool* contains_filenames) { DCHECK(types); @@ -15,7 +15,7 @@ bool ClipboardDispatcher::ReadAvailableTypes(Clipboard::Buffer buffer, return false; } -bool ClipboardDispatcher::ReadData(Clipboard::Buffer buffer, +bool ClipboardDispatcher::ReadData(ui::Clipboard::Buffer buffer, const string16& type, string16* data, string16* metadata) { @@ -24,7 +24,7 @@ bool ClipboardDispatcher::ReadData(Clipboard::Buffer buffer, return false; } -bool ClipboardDispatcher::ReadFilenames(Clipboard::Buffer buffer, +bool ClipboardDispatcher::ReadFilenames(ui::Clipboard::Buffer buffer, std::vector<string16>* filenames) { DCHECK(filenames); filenames->clear(); diff --git a/chrome/browser/clipboard_dispatcher_mac.mm b/chrome/browser/clipboard_dispatcher_mac.mm index ce7e39b..e91f452 100644 --- a/chrome/browser/clipboard_dispatcher_mac.mm +++ b/chrome/browser/clipboard_dispatcher_mac.mm @@ -5,7 +5,7 @@ #include "chrome/browser/clipboard_dispatcher.h" #include "base/logging.h" -bool ClipboardDispatcher::ReadAvailableTypes(Clipboard::Buffer buffer, +bool ClipboardDispatcher::ReadAvailableTypes(ui::Clipboard::Buffer buffer, std::vector<string16>* types, bool* contains_filenames) { DCHECK(types); @@ -15,7 +15,7 @@ bool ClipboardDispatcher::ReadAvailableTypes(Clipboard::Buffer buffer, return false; } -bool ClipboardDispatcher::ReadData(Clipboard::Buffer buffer, +bool ClipboardDispatcher::ReadData(ui::Clipboard::Buffer buffer, const string16& type, string16* data, string16* metadata) { @@ -24,7 +24,7 @@ bool ClipboardDispatcher::ReadData(Clipboard::Buffer buffer, return false; } -bool ClipboardDispatcher::ReadFilenames(Clipboard::Buffer buffer, +bool ClipboardDispatcher::ReadFilenames(ui::Clipboard::Buffer buffer, std::vector<string16>* filenames) { DCHECK(filenames); filenames->clear(); diff --git a/chrome/browser/clipboard_dispatcher_win.cc b/chrome/browser/clipboard_dispatcher_win.cc index a448468..f5a456f 100644 --- a/chrome/browser/clipboard_dispatcher_win.cc +++ b/chrome/browser/clipboard_dispatcher_win.cc @@ -5,7 +5,7 @@ #include "chrome/browser/clipboard_dispatcher.h" #include "base/logging.h" -bool ClipboardDispatcher::ReadAvailableTypes(Clipboard::Buffer buffer, +bool ClipboardDispatcher::ReadAvailableTypes(ui::Clipboard::Buffer buffer, std::vector<string16>* types, bool* contains_filenames) { DCHECK(types); @@ -15,7 +15,7 @@ bool ClipboardDispatcher::ReadAvailableTypes(Clipboard::Buffer buffer, return false; } -bool ClipboardDispatcher::ReadData(Clipboard::Buffer buffer, +bool ClipboardDispatcher::ReadData(ui::Clipboard::Buffer buffer, const string16& type, string16* data, string16* metadata) { @@ -24,7 +24,7 @@ bool ClipboardDispatcher::ReadData(Clipboard::Buffer buffer, return false; } -bool ClipboardDispatcher::ReadFilenames(Clipboard::Buffer buffer, +bool ClipboardDispatcher::ReadFilenames(ui::Clipboard::Buffer buffer, std::vector<string16>* filenames) { DCHECK(filenames); filenames->clear(); diff --git a/chrome/browser/net/browser_url_util.cc b/chrome/browser/net/browser_url_util.cc index 786ab7d..8471140 100644 --- a/chrome/browser/net/browser_url_util.cc +++ b/chrome/browser/net/browser_url_util.cc @@ -4,18 +4,18 @@ #include "chrome/browser/net/browser_url_util.h" -#include "app/clipboard/scoped_clipboard_writer.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" #include "chrome/common/url_constants.h" #include "googleurl/src/gurl.h" #include "net/base/net_util.h" +#include "ui/base/clipboard/scoped_clipboard_writer.h" namespace chrome_browser_net { void WriteURLToClipboard(const GURL& url, const std::string& languages, - Clipboard *clipboard) { + ui::Clipboard *clipboard) { if (url.is_empty() || !url.is_valid() || !clipboard) return; @@ -26,7 +26,7 @@ void WriteURLToClipboard(const GURL& url, net::FormatUrl(url, languages, net::kFormatUrlOmitNothing, UnescapeRule::NONE, NULL, NULL, NULL); - ScopedClipboardWriter scw(clipboard); + ui::ScopedClipboardWriter scw(clipboard); scw.WriteURL(text); } diff --git a/chrome/browser/net/browser_url_util.h b/chrome/browser/net/browser_url_util.h index 043725f7..2199d36 100644 --- a/chrome/browser/net/browser_url_util.h +++ b/chrome/browser/net/browser_url_util.h @@ -8,15 +8,18 @@ #include <string> -class Clipboard; class GURL; +namespace ui { +class Clipboard; +} + namespace chrome_browser_net { // Writes a string representation of |url| to the system clipboard. void WriteURLToClipboard(const GURL& url, const std::string& languages, - Clipboard *clipboard); + ui::Clipboard *clipboard); } // namespace chrome_browser_net diff --git a/chrome/browser/renderer_host/render_message_filter.cc b/chrome/browser/renderer_host/render_message_filter.cc index 1f86ca8..73af165 100644 --- a/chrome/browser/renderer_host/render_message_filter.cc +++ b/chrome/browser/renderer_host/render_message_filter.cc @@ -131,7 +131,7 @@ class ContextMenuMessageDispatcher : public Task { // contents. class WriteClipboardTask : public Task { public: - explicit WriteClipboardTask(Clipboard::ObjectMap* objects) + explicit WriteClipboardTask(ui::Clipboard::ObjectMap* objects) : objects_(objects) {} ~WriteClipboardTask() {} @@ -140,7 +140,7 @@ class WriteClipboardTask : public Task { } private: - scoped_ptr<Clipboard::ObjectMap> objects_; + scoped_ptr<ui::Clipboard::ObjectMap> objects_; }; void RenderParamsFromPrintSettings(const printing::PrintSettings& settings, @@ -741,7 +741,7 @@ void RenderMessageFilter::OnDownloadUrl(const IPC::Message& message, } void RenderMessageFilter::OnClipboardWriteObjectsSync( - const Clipboard::ObjectMap& objects, + const ui::Clipboard::ObjectMap& objects, base::SharedMemoryHandle bitmap_handle) { DCHECK(base::SharedMemory::IsHandleValid(bitmap_handle)) << "Bad bitmap handle"; @@ -749,11 +749,12 @@ void RenderMessageFilter::OnClipboardWriteObjectsSync( // on the UI thread. We'll copy the relevant data and get a handle to any // shared memory so it doesn't go away when we resume the renderer, and post // a task to perform the write on the UI thread. - Clipboard::ObjectMap* long_living_objects = new Clipboard::ObjectMap(objects); + ui::Clipboard::ObjectMap* long_living_objects = + new ui::Clipboard::ObjectMap(objects); // Splice the shared memory handle into the clipboard data. - Clipboard::ReplaceSharedMemHandle(long_living_objects, bitmap_handle, - peer_handle()); + ui::Clipboard::ReplaceSharedMemHandle(long_living_objects, bitmap_handle, + peer_handle()); BrowserThread::PostTask( BrowserThread::UI, @@ -762,15 +763,16 @@ void RenderMessageFilter::OnClipboardWriteObjectsSync( } void RenderMessageFilter::OnClipboardWriteObjectsAsync( - const Clipboard::ObjectMap& objects) { + const ui::Clipboard::ObjectMap& objects) { // We cannot write directly from the IO thread, and cannot service the IPC // on the UI thread. We'll copy the relevant data and post a task to preform // the write on the UI thread. - Clipboard::ObjectMap* long_living_objects = new Clipboard::ObjectMap(objects); + ui::Clipboard::ObjectMap* long_living_objects = + new ui::Clipboard::ObjectMap(objects); // This async message doesn't support shared-memory based bitmaps; they must // be removed otherwise we might dereference a rubbish pointer. - long_living_objects->erase(Clipboard::CBF_SMBITMAP); + long_living_objects->erase(ui::Clipboard::CBF_SMBITMAP); BrowserThread::PostTask( BrowserThread::UI, @@ -791,14 +793,14 @@ void RenderMessageFilter::OnClipboardWriteObjectsAsync( // functions. void RenderMessageFilter::OnClipboardIsFormatAvailable( - Clipboard::FormatType format, Clipboard::Buffer buffer, + ui::Clipboard::FormatType format, ui::Clipboard::Buffer buffer, IPC::Message* reply) { const bool result = GetClipboard()->IsFormatAvailable(format, buffer); ViewHostMsg_ClipboardIsFormatAvailable::WriteReplyParams(reply, result); Send(reply); } -void RenderMessageFilter::OnClipboardReadText(Clipboard::Buffer buffer, +void RenderMessageFilter::OnClipboardReadText(ui::Clipboard::Buffer buffer, IPC::Message* reply) { string16 result; GetClipboard()->ReadText(buffer, &result); @@ -806,7 +808,7 @@ void RenderMessageFilter::OnClipboardReadText(Clipboard::Buffer buffer, Send(reply); } -void RenderMessageFilter::OnClipboardReadAsciiText(Clipboard::Buffer buffer, +void RenderMessageFilter::OnClipboardReadAsciiText(ui::Clipboard::Buffer buffer, IPC::Message* reply) { std::string result; GetClipboard()->ReadAsciiText(buffer, &result); @@ -814,7 +816,7 @@ void RenderMessageFilter::OnClipboardReadAsciiText(Clipboard::Buffer buffer, Send(reply); } -void RenderMessageFilter::OnClipboardReadHTML(Clipboard::Buffer buffer, +void RenderMessageFilter::OnClipboardReadHTML(ui::Clipboard::Buffer buffer, IPC::Message* reply) { std::string src_url_str; string16 markup; @@ -826,7 +828,7 @@ void RenderMessageFilter::OnClipboardReadHTML(Clipboard::Buffer buffer, } void RenderMessageFilter::OnClipboardReadAvailableTypes( - Clipboard::Buffer buffer, IPC::Message* reply) { + ui::Clipboard::Buffer buffer, IPC::Message* reply) { std::vector<string16> types; bool contains_filenames = false; bool result = ClipboardDispatcher::ReadAvailableTypes( @@ -837,7 +839,7 @@ void RenderMessageFilter::OnClipboardReadAvailableTypes( } void RenderMessageFilter::OnClipboardReadData( - Clipboard::Buffer buffer, const string16& type, IPC::Message* reply) { + ui::Clipboard::Buffer buffer, const string16& type, IPC::Message* reply) { string16 data; string16 metadata; bool result = ClipboardDispatcher::ReadData(buffer, type, &data, &metadata); @@ -847,7 +849,7 @@ void RenderMessageFilter::OnClipboardReadData( } void RenderMessageFilter::OnClipboardReadFilenames( - Clipboard::Buffer buffer, IPC::Message* reply) { + ui::Clipboard::Buffer buffer, IPC::Message* reply) { std::vector<string16> filenames; bool result = ClipboardDispatcher::ReadFilenames(buffer, &filenames); ViewHostMsg_ClipboardReadFilenames::WriteReplyParams( @@ -1109,10 +1111,10 @@ void RenderMessageFilter::OnScriptedPrintReply( } // static -Clipboard* RenderMessageFilter::GetClipboard() { +ui::Clipboard* RenderMessageFilter::GetClipboard() { // We have a static instance of the clipboard service for use by all message // filters. This instance lives for the life of the browser processes. - static Clipboard* clipboard = new Clipboard; + static ui::Clipboard* clipboard = new ui::Clipboard; return clipboard; } diff --git a/chrome/browser/renderer_host/render_message_filter.h b/chrome/browser/renderer_host/render_message_filter.h index 98e8402..a777b3a 100644 --- a/chrome/browser/renderer_host/render_message_filter.h +++ b/chrome/browser/renderer_host/render_message_filter.h @@ -13,7 +13,6 @@ #include <string> #include <vector> -#include "app/clipboard/clipboard.h" #include "app/surface/transport_dib.h" #include "base/file_path.h" #include "base/linked_ptr.h" @@ -28,6 +27,7 @@ #include "gfx/native_widget_types.h" #include "third_party/WebKit/WebKit/chromium/public/WebCache.h" #include "third_party/WebKit/WebKit/chromium/public/WebPopupType.h" +#include "ui/base/clipboard/clipboard.h" class ChromeURLRequestContext; struct FontDescriptor; @@ -182,24 +182,26 @@ class RenderMessageFilter : public BrowserMessageFilter, #endif void OnReceiveContextMenuMsg(const IPC::Message& msg); // Clipboard messages - void OnClipboardWriteObjectsAsync(const Clipboard::ObjectMap& objects); - void OnClipboardWriteObjectsSync(const Clipboard::ObjectMap& objects, + void OnClipboardWriteObjectsAsync(const ui::Clipboard::ObjectMap& objects); + void OnClipboardWriteObjectsSync(const ui::Clipboard::ObjectMap& objects, base::SharedMemoryHandle bitmap_handle); - void OnClipboardIsFormatAvailable(Clipboard::FormatType format, - Clipboard::Buffer buffer, + void OnClipboardIsFormatAvailable(ui::Clipboard::FormatType format, + ui::Clipboard::Buffer buffer, IPC::Message* reply); - void OnClipboardReadText(Clipboard::Buffer buffer, IPC::Message* reply); - void OnClipboardReadAsciiText(Clipboard::Buffer buffer, IPC::Message* reply); - void OnClipboardReadHTML(Clipboard::Buffer buffer, IPC::Message* reply); + void OnClipboardReadText(ui::Clipboard::Buffer buffer, IPC::Message* reply); + void OnClipboardReadAsciiText(ui::Clipboard::Buffer buffer, + IPC::Message* reply); + void OnClipboardReadHTML(ui::Clipboard::Buffer buffer, IPC::Message* reply); #if defined(OS_MACOSX) void OnClipboardFindPboardWriteString(const string16& text); #endif - void OnClipboardReadAvailableTypes(Clipboard::Buffer buffer, + void OnClipboardReadAvailableTypes(ui::Clipboard::Buffer buffer, IPC::Message* reply); - void OnClipboardReadData(Clipboard::Buffer buffer, const string16& type, + void OnClipboardReadData(ui::Clipboard::Buffer buffer, const string16& type, IPC::Message* reply); - void OnClipboardReadFilenames(Clipboard::Buffer buffer, IPC::Message* reply); + void OnClipboardReadFilenames(ui::Clipboard::Buffer buffer, + IPC::Message* reply); void OnCheckNotificationPermission(const GURL& source_url, int* permission_level); @@ -340,18 +342,20 @@ class RenderMessageFilter : public BrowserMessageFilter, void DoOnGetScreenInfo(gfx::NativeViewId view, IPC::Message* reply_msg); void DoOnGetWindowRect(gfx::NativeViewId view, IPC::Message* reply_msg); void DoOnGetRootWindowRect(gfx::NativeViewId view, IPC::Message* reply_msg); - void DoOnClipboardIsFormatAvailable(Clipboard::FormatType format, - Clipboard::Buffer buffer, + void DoOnClipboardIsFormatAvailable(ui::Clipboard::FormatType format, + ui::Clipboard::Buffer buffer, IPC::Message* reply_msg); - void DoOnClipboardReadText(Clipboard::Buffer buffer, IPC::Message* reply_msg); - void DoOnClipboardReadAsciiText(Clipboard::Buffer buffer, + void DoOnClipboardReadText(ui::Clipboard::Buffer buffer, + IPC::Message* reply_msg); + void DoOnClipboardReadAsciiText(ui::Clipboard::Buffer buffer, IPC::Message* reply_msg); - void DoOnClipboardReadHTML(Clipboard::Buffer buffer, IPC::Message* reply_msg); - void DoOnClipboardReadAvailableTypes(Clipboard::Buffer buffer, + void DoOnClipboardReadHTML(ui::Clipboard::Buffer buffer, + IPC::Message* reply_msg); + void DoOnClipboardReadAvailableTypes(ui::Clipboard::Buffer buffer, IPC::Message* reply_msg); - void DoOnClipboardReadData(Clipboard::Buffer buffer, const string16& type, + void DoOnClipboardReadData(ui::Clipboard::Buffer buffer, const string16& type, IPC::Message* reply_msg); - void DoOnClipboardReadFilenames(Clipboard::Buffer buffer, + void DoOnClipboardReadFilenames(ui::Clipboard::Buffer buffer, IPC::Message* reply_msg); void DoOnAllocateTempFileForPrinting(IPC::Message* reply_msg); #endif @@ -363,7 +367,7 @@ class RenderMessageFilter : public BrowserMessageFilter, // IO thread instead of forwarding (possibly synchronous) messages to the UI // thread. This instance of the clipboard should be accessed only on the IO // thread. - static Clipboard* GetClipboard(); + static ui::Clipboard* GetClipboard(); // Cached resource request dispatcher host and plugin service, guaranteed to // be non-null if Init succeeds. We do not own the objects, they are managed diff --git a/chrome/browser/renderer_host/render_message_filter_gtk.cc b/chrome/browser/renderer_host/render_message_filter_gtk.cc index 4088c8a..bcc6b6c 100644 --- a/chrome/browser/renderer_host/render_message_filter_gtk.cc +++ b/chrome/browser/renderer_host/render_message_filter_gtk.cc @@ -7,7 +7,6 @@ #include <fcntl.h> #include <map> -#include "app/clipboard/clipboard.h" #include "app/x11_util.h" #include "base/file_util.h" #include "base/lazy_instance.h" @@ -22,9 +21,9 @@ #include "chrome/common/render_messages.h" #include "gfx/gtk_native_view_id_manager.h" #include "grit/generated_resources.h" - #include "third_party/WebKit/WebKit/chromium/public/WebScreenInfo.h" #include "third_party/WebKit/WebKit/chromium/public/x11/WebScreenInfoFactory.h" +#include "ui/base/clipboard/clipboard.h" using WebKit::WebScreenInfo; using WebKit::WebScreenInfoFactory; @@ -118,7 +117,7 @@ void RenderMessageFilter::DoOnGetRootWindowRect(gfx::NativeViewId view, // Called on the UI thread. void RenderMessageFilter::DoOnClipboardIsFormatAvailable( - Clipboard::FormatType format, Clipboard::Buffer buffer, + ui::Clipboard::FormatType format, ui::Clipboard::Buffer buffer, IPC::Message* reply_msg) { const bool result = GetClipboard()->IsFormatAvailable(format, buffer); @@ -127,7 +126,7 @@ void RenderMessageFilter::DoOnClipboardIsFormatAvailable( } // Called on the UI thread. -void RenderMessageFilter::DoOnClipboardReadText(Clipboard::Buffer buffer, +void RenderMessageFilter::DoOnClipboardReadText(ui::Clipboard::Buffer buffer, IPC::Message* reply_msg) { string16 result; GetClipboard()->ReadText(buffer, &result); @@ -138,7 +137,7 @@ void RenderMessageFilter::DoOnClipboardReadText(Clipboard::Buffer buffer, // Called on the UI thread. void RenderMessageFilter::DoOnClipboardReadAsciiText( - Clipboard::Buffer buffer, IPC::Message* reply_msg) { + ui::Clipboard::Buffer buffer, IPC::Message* reply_msg) { std::string result; GetClipboard()->ReadAsciiText(buffer, &result); @@ -147,7 +146,7 @@ void RenderMessageFilter::DoOnClipboardReadAsciiText( } // Called on the UI thread. -void RenderMessageFilter::DoOnClipboardReadHTML(Clipboard::Buffer buffer, +void RenderMessageFilter::DoOnClipboardReadHTML(ui::Clipboard::Buffer buffer, IPC::Message* reply_msg) { std::string src_url_str; string16 markup; @@ -160,19 +159,19 @@ void RenderMessageFilter::DoOnClipboardReadHTML(Clipboard::Buffer buffer, // Called on the UI thread. void RenderMessageFilter::DoOnClipboardReadAvailableTypes( - Clipboard::Buffer buffer, IPC::Message* reply_msg) { + ui::Clipboard::Buffer buffer, IPC::Message* reply_msg) { Send(reply_msg); } // Called on the UI thread. -void RenderMessageFilter::DoOnClipboardReadData(Clipboard::Buffer buffer, +void RenderMessageFilter::DoOnClipboardReadData(ui::Clipboard::Buffer buffer, const string16& type, IPC::Message* reply_msg) { Send(reply_msg); } // Called on the UI thread. void RenderMessageFilter::DoOnClipboardReadFilenames( - Clipboard::Buffer buffer, IPC::Message* reply_msg) { + ui::Clipboard::Buffer buffer, IPC::Message* reply_msg) { Send(reply_msg); } @@ -241,7 +240,7 @@ void RenderMessageFilter::OnGetRootWindowRect(gfx::NativeViewId view, // Called on the IO thread. void RenderMessageFilter::OnClipboardIsFormatAvailable( - Clipboard::FormatType format, Clipboard::Buffer buffer, + ui::Clipboard::FormatType format, ui::Clipboard::Buffer buffer, IPC::Message* reply_msg) { BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, @@ -251,7 +250,7 @@ void RenderMessageFilter::OnClipboardIsFormatAvailable( } // Called on the IO thread. -void RenderMessageFilter::OnClipboardReadText(Clipboard::Buffer buffer, +void RenderMessageFilter::OnClipboardReadText(ui::Clipboard::Buffer buffer, IPC::Message* reply_msg) { BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, @@ -261,7 +260,7 @@ void RenderMessageFilter::OnClipboardReadText(Clipboard::Buffer buffer, } // Called on the IO thread. -void RenderMessageFilter::OnClipboardReadAsciiText(Clipboard::Buffer buffer, +void RenderMessageFilter::OnClipboardReadAsciiText(ui::Clipboard::Buffer buffer, IPC::Message* reply_msg) { BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, @@ -271,7 +270,7 @@ void RenderMessageFilter::OnClipboardReadAsciiText(Clipboard::Buffer buffer, } // Called on the IO thread. -void RenderMessageFilter::OnClipboardReadHTML(Clipboard::Buffer buffer, +void RenderMessageFilter::OnClipboardReadHTML(ui::Clipboard::Buffer buffer, IPC::Message* reply_msg) { BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, @@ -282,7 +281,7 @@ void RenderMessageFilter::OnClipboardReadHTML(Clipboard::Buffer buffer, // Called on the IO thread. void RenderMessageFilter::OnClipboardReadAvailableTypes( - Clipboard::Buffer buffer, IPC::Message* reply_msg) { + ui::Clipboard::Buffer buffer, IPC::Message* reply_msg) { BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, NewRunnableMethod( @@ -291,8 +290,9 @@ void RenderMessageFilter::OnClipboardReadAvailableTypes( } // Called on the IO thread. -void RenderMessageFilter::OnClipboardReadData( - Clipboard::Buffer buffer, const string16& type, IPC::Message* reply_msg) { +void RenderMessageFilter::OnClipboardReadData(ui::Clipboard::Buffer buffer, + const string16& type, + IPC::Message* reply_msg) { BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, NewRunnableMethod( @@ -302,7 +302,7 @@ void RenderMessageFilter::OnClipboardReadData( // Called on the IO thread. void RenderMessageFilter::OnClipboardReadFilenames( - Clipboard::Buffer buffer, IPC::Message* reply_msg) { + ui::Clipboard::Buffer buffer, IPC::Message* reply_msg) { BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, NewRunnableMethod( diff --git a/chrome/browser/tab_contents/web_drop_target_win.cc b/chrome/browser/tab_contents/web_drop_target_win.cc index d70b851..d358fe3 100644 --- a/chrome/browser/tab_contents/web_drop_target_win.cc +++ b/chrome/browser/tab_contents/web_drop_target_win.cc @@ -7,7 +7,6 @@ #include <windows.h> #include <shlobj.h> -#include "app/clipboard/clipboard_util_win.h" #include "app/os_exchange_data.h" #include "app/os_exchange_data_provider_win.h" #include "chrome/browser/bookmarks/bookmark_node_data.h" @@ -17,6 +16,7 @@ #include "gfx/point.h" #include "googleurl/src/gurl.h" #include "net/base/net_util.h" +#include "ui/base/clipboard/clipboard_util_win.h" #include "webkit/glue/webdropdata.h" #include "webkit/glue/window_open_disposition.h" @@ -51,23 +51,23 @@ class InterstitialDropTarget { : tab_contents_(tab_contents) {} DWORD OnDragEnter(IDataObject* data_object, DWORD effect) { - return ClipboardUtil::HasUrl(data_object) ? GetPreferredDropEffect(effect) - : DROPEFFECT_NONE; + return ui::ClipboardUtil::HasUrl(data_object) ? + GetPreferredDropEffect(effect) : DROPEFFECT_NONE; } DWORD OnDragOver(IDataObject* data_object, DWORD effect) { - return ClipboardUtil::HasUrl(data_object) ? GetPreferredDropEffect(effect) - : DROPEFFECT_NONE; + return ui::ClipboardUtil::HasUrl(data_object) ? + GetPreferredDropEffect(effect) : DROPEFFECT_NONE; } void OnDragLeave(IDataObject* data_object) { } DWORD OnDrop(IDataObject* data_object, DWORD effect) { - if (ClipboardUtil::HasUrl(data_object)) { + if (ui::ClipboardUtil::HasUrl(data_object)) { std::wstring url; std::wstring title; - ClipboardUtil::GetUrl(data_object, &url, &title, true); + ui::ClipboardUtil::GetUrl(data_object, &url, &title, true); tab_contents_->OpenURL(GURL(url), GURL(), CURRENT_TAB, PageTransition::AUTO_BOOKMARK); return GetPreferredDropEffect(effect); diff --git a/chrome/browser/ui/views/accessibility_event_router_views_unittest.cc b/chrome/browser/ui/views/accessibility_event_router_views_unittest.cc index 7e51ab2..df8af57 100644 --- a/chrome/browser/ui/views/accessibility_event_router_views_unittest.cc +++ b/chrome/browser/ui/views/accessibility_event_router_views_unittest.cc @@ -34,7 +34,7 @@ class AccessibilityViewsDelegate : public views::ViewsDelegate { virtual ~AccessibilityViewsDelegate() {} // Overridden from views::ViewsDelegate: - virtual Clipboard* GetClipboard() const { return NULL; } + virtual ui::Clipboard* GetClipboard() const { return NULL; } virtual void SaveWindowPlacement(const std::wstring& window_name, const gfx::Rect& bounds, bool maximized) { diff --git a/chrome/browser/ui/views/bookmark_bar_view_test.cc b/chrome/browser/ui/views/bookmark_bar_view_test.cc index d98c20f..67d2436 100644 --- a/chrome/browser/ui/views/bookmark_bar_view_test.cc +++ b/chrome/browser/ui/views/bookmark_bar_view_test.cc @@ -19,6 +19,7 @@ #include "chrome/test/interactive_ui/view_event_test_base.h" #include "chrome/test/ui_test_utils.h" #include "grit/generated_resources.h" +#include "ui/base/clipboard/clipboard.h" #include "views/controls/button/menu_button.h" #include "views/controls/button/text_button.h" #include "views/controls/menu/menu_controller.h" @@ -66,7 +67,7 @@ namespace { class ViewsDelegateImpl : public views::ViewsDelegate { public: ViewsDelegateImpl() {} - virtual Clipboard* GetClipboard() const { return NULL; } + virtual ui::Clipboard* GetClipboard() const { return NULL; } virtual void SaveWindowPlacement(const std::wstring& window_name, const gfx::Rect& bounds, bool maximized) {} diff --git a/chrome/browser/ui/views/chrome_views_delegate.cc b/chrome/browser/ui/views/chrome_views_delegate.cc index 7ed8ef7..b52e103 100644 --- a/chrome/browser/ui/views/chrome_views_delegate.cc +++ b/chrome/browser/ui/views/chrome_views_delegate.cc @@ -4,7 +4,6 @@ #include "chrome/browser/views/chrome_views_delegate.h" -#include "app/clipboard/clipboard.h" #include "base/scoped_ptr.h" #include "base/utf_string_conversions.h" #include "chrome/browser/browser_process.h" @@ -12,6 +11,7 @@ #include "chrome/browser/ui/views/accessibility_event_router_views.h" #include "chrome/browser/ui/window_sizer.h" #include "gfx/rect.h" +#include "ui/base/clipboard/clipboard.h" #if defined(OS_WIN) #include "chrome/browser/app_icon_win.h" @@ -20,7 +20,7 @@ /////////////////////////////////////////////////////////////////////////////// // ChromeViewsDelegate, views::ViewsDelegate implementation: -Clipboard* ChromeViewsDelegate::GetClipboard() const { +ui::Clipboard* ChromeViewsDelegate::GetClipboard() const { return g_browser_process->clipboard(); } diff --git a/chrome/browser/ui/views/chrome_views_delegate.h b/chrome/browser/ui/views/chrome_views_delegate.h index 8b3a6a2..dd2e8a8 100644 --- a/chrome/browser/ui/views/chrome_views_delegate.h +++ b/chrome/browser/ui/views/chrome_views_delegate.h @@ -16,7 +16,7 @@ class ChromeViewsDelegate : public views::ViewsDelegate { virtual ~ChromeViewsDelegate() {} // Overridden from views::ViewsDelegate: - virtual Clipboard* GetClipboard() const; + virtual ui::Clipboard* GetClipboard() const; virtual void SaveWindowPlacement(const std::wstring& window_name, const gfx::Rect& bounds, bool maximized); diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h index 8f6a5f7..2902124 100644 --- a/chrome/common/render_messages.h +++ b/chrome/common/render_messages.h @@ -11,7 +11,6 @@ // TODO(erg): This list has been temporarily annotated by erg while doing work // on which headers to pull out. -#include "app/clipboard/clipboard.h" // enum #include "base/basictypes.h" #include "base/ref_counted.h" #include "base/string16.h" @@ -23,6 +22,7 @@ #include "chrome/common/webkit_param_traits.h" #include "ipc/ipc_message_utils.h" #include "ipc/ipc_platform_file.h" // ifdefed typedef. +#include "ui/base/clipboard/clipboard.h" // enum #include "webkit/appcache/appcache_interfaces.h" // enum appcache::Status #include "webkit/fileapi/file_system_types.h" // enum fileapi::FileSystemType @@ -443,30 +443,30 @@ struct ParamTraits<URLPattern> { }; template <> -struct ParamTraits<Clipboard::Buffer> { - typedef Clipboard::Buffer param_type; +struct ParamTraits<ui::Clipboard::Buffer> { + typedef ui::Clipboard::Buffer param_type; static void Write(Message* m, const param_type& p) { m->WriteInt(p); } static bool Read(const Message* m, void** iter, param_type* p) { int buffer; - if (!m->ReadInt(iter, &buffer) || !Clipboard::IsValidBuffer(buffer)) + if (!m->ReadInt(iter, &buffer) || !ui::Clipboard::IsValidBuffer(buffer)) return false; - *p = Clipboard::FromInt(buffer); + *p = ui::Clipboard::FromInt(buffer); return true; } static void Log(const param_type& p, std::string* l) { std::string type; switch (p) { - case Clipboard::BUFFER_STANDARD: + case ui::Clipboard::BUFFER_STANDARD: type = "BUFFER_STANDARD"; break; #if defined(USE_X11) - case Clipboard::BUFFER_SELECTION: + case ui::Clipboard::BUFFER_SELECTION: type = "BUFFER_SELECTION"; break; #endif - case Clipboard::BUFFER_DRAG: + case ui::Clipboard::BUFFER_DRAG: type = "BUFFER_DRAG"; break; default: diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h index 48280a6..5cc366e 100644 --- a/chrome/common/render_messages_internal.h +++ b/chrome/common/render_messages_internal.h @@ -1590,41 +1590,41 @@ IPC_SYNC_MESSAGE_ROUTED1_0(ViewHostMsg_DestroyPluginContainer, // This message is used when the object list does not contain a bitmap. IPC_MESSAGE_CONTROL1(ViewHostMsg_ClipboardWriteObjectsAsync, - Clipboard::ObjectMap /* objects */) + ui::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_ClipboardWriteObjectsSync, - Clipboard::ObjectMap /* objects */, + ui::Clipboard::ObjectMap /* objects */, base::SharedMemoryHandle /* bitmap handle */) IPC_SYNC_MESSAGE_CONTROL2_1(ViewHostMsg_ClipboardIsFormatAvailable, std::string /* format */, - Clipboard::Buffer /* buffer */, + ui::Clipboard::Buffer /* buffer */, bool /* result */) IPC_SYNC_MESSAGE_CONTROL1_1(ViewHostMsg_ClipboardReadText, - Clipboard::Buffer /* buffer */, + ui::Clipboard::Buffer /* buffer */, string16 /* result */) IPC_SYNC_MESSAGE_CONTROL1_1(ViewHostMsg_ClipboardReadAsciiText, - Clipboard::Buffer /* buffer */, + ui::Clipboard::Buffer /* buffer */, std::string /* result */) IPC_SYNC_MESSAGE_CONTROL1_2(ViewHostMsg_ClipboardReadHTML, - Clipboard::Buffer /* buffer */, + ui::Clipboard::Buffer /* buffer */, string16 /* markup */, GURL /* url */) IPC_SYNC_MESSAGE_CONTROL1_3(ViewHostMsg_ClipboardReadAvailableTypes, - Clipboard::Buffer /* buffer */, + ui::Clipboard::Buffer /* buffer */, bool /* result */, std::vector<string16> /* types */, bool /* contains filenames */) IPC_SYNC_MESSAGE_CONTROL2_3(ViewHostMsg_ClipboardReadData, - Clipboard::Buffer /* buffer */, + ui::Clipboard::Buffer /* buffer */, string16 /* type */, bool /* succeeded */, string16 /* data */, string16 /* metadata */) IPC_SYNC_MESSAGE_CONTROL1_2(ViewHostMsg_ClipboardReadFilenames, - Clipboard::Buffer /* buffer */, + ui::Clipboard::Buffer /* buffer */, bool /* result */, std::vector<string16> /* filenames */) diff --git a/chrome/renderer/renderer_glue.cc b/chrome/renderer/renderer_glue.cc index ae5984b..92b80e3 100644 --- a/chrome/renderer/renderer_glue.cc +++ b/chrome/renderer/renderer_glue.cc @@ -12,7 +12,6 @@ #include <vector> -#include "app/clipboard/clipboard.h" #include "app/resource_bundle.h" #include "base/command_line.h" #include "base/ref_counted.h" @@ -32,6 +31,7 @@ #include "third_party/WebKit/WebKit/chromium/public/WebKitClient.h" #include "third_party/WebKit/WebKit/chromium/public/WebString.h" #include "third_party/skia/include/core/SkBitmap.h" +#include "ui/base/clipboard/clipboard.h" #include "webkit/glue/scoped_clipboard_writer_glue.h" #include "webkit/glue/webkit_glue.h" #include "webkit/glue/websocketstreamhandle_bridge.h" @@ -92,19 +92,19 @@ void ScopedClipboardWriterGlue::WriteBitmapFromPixels(const void* pixels, memcpy(shared_buf_->memory(), pixels, buf_size); shared_buf_->Unmap(); - Clipboard::ObjectMapParam size_param; + ui::Clipboard::ObjectMapParam size_param; const char* size_data = reinterpret_cast<const char*>(&size); for (size_t i = 0; i < sizeof(gfx::Size); ++i) size_param.push_back(size_data[i]); - Clipboard::ObjectMapParams params; + ui::Clipboard::ObjectMapParams params; // The first parameter is replaced on the receiving end with a pointer to // a shared memory object containing the bitmap. We reserve space for it here. - Clipboard::ObjectMapParam place_holder_param; + ui::Clipboard::ObjectMapParam place_holder_param; params.push_back(place_holder_param); params.push_back(size_param); - objects_[Clipboard::CBF_SMBITMAP] = params; + objects_[ui::Clipboard::CBF_SMBITMAP] = params; } // Define a destructor that makes IPCs to flush the contents to the @@ -153,34 +153,35 @@ HCURSOR LoadCursor(int cursor_id) { // Clipboard glue -Clipboard* ClipboardGetClipboard() { +ui::Clipboard* ClipboardGetClipboard() { return NULL; } -bool ClipboardIsFormatAvailable(const Clipboard::FormatType& format, - Clipboard::Buffer buffer) { +bool ClipboardIsFormatAvailable(const ui::Clipboard::FormatType& format, + ui::Clipboard::Buffer buffer) { bool result; RenderThread::current()->Send( new ViewHostMsg_ClipboardIsFormatAvailable(format, buffer, &result)); return result; } -void ClipboardReadText(Clipboard::Buffer buffer, string16* result) { +void ClipboardReadText(ui::Clipboard::Buffer buffer, string16* result) { RenderThread::current()->Send(new ViewHostMsg_ClipboardReadText(buffer, result)); } -void ClipboardReadAsciiText(Clipboard::Buffer buffer, std::string* result) { +void ClipboardReadAsciiText(ui::Clipboard::Buffer buffer, std::string* result) { RenderThread::current()->Send(new ViewHostMsg_ClipboardReadAsciiText(buffer, result)); } -void ClipboardReadHTML(Clipboard::Buffer buffer, string16* markup, GURL* url) { +void ClipboardReadHTML(ui::Clipboard::Buffer buffer, string16* markup, + GURL* url) { RenderThread::current()->Send(new ViewHostMsg_ClipboardReadHTML(buffer, markup, url)); } -bool ClipboardReadAvailableTypes(Clipboard::Buffer buffer, +bool ClipboardReadAvailableTypes(ui::Clipboard::Buffer buffer, std::vector<string16>* types, bool* contains_filenames) { bool result = false; @@ -189,7 +190,7 @@ bool ClipboardReadAvailableTypes(Clipboard::Buffer buffer, return result; } -bool ClipboardReadData(Clipboard::Buffer buffer, const string16& type, +bool ClipboardReadData(ui::Clipboard::Buffer buffer, const string16& type, string16* data, string16* metadata) { bool result = false; RenderThread::current()->Send(new ViewHostMsg_ClipboardReadData( @@ -197,7 +198,7 @@ bool ClipboardReadData(Clipboard::Buffer buffer, const string16& type, return result; } -bool ClipboardReadFilenames(Clipboard::Buffer buffer, +bool ClipboardReadFilenames(ui::Clipboard::Buffer buffer, std::vector<string16>* filenames) { bool result; RenderThread::current()->Send(new ViewHostMsg_ClipboardReadFilenames( diff --git a/chrome/test/plugin/pdf_browsertest.cc b/chrome/test/plugin/pdf_browsertest.cc index 52b4bee..769df46 100644 --- a/chrome/test/plugin/pdf_browsertest.cc +++ b/chrome/test/plugin/pdf_browsertest.cc @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "app/clipboard/clipboard.h" #include "base/command_line.h" #include "base/file_util.h" #include "base/path_service.h" @@ -22,6 +21,7 @@ #include "chrome/test/ui_test_utils.h" #include "gfx/codec/png_codec.h" #include "net/test/test_server.h" +#include "ui/base/clipboard/clipboard.h" extern base::hash_map<std::string, int> g_test_timeout_overrides; @@ -266,10 +266,10 @@ IN_PROC_BROWSER_TEST_F(PDFBrowserTest, MAYBE_FindAndCopy) { false, NULL)); // Verify that copying selected text works. - Clipboard clipboard; + ui::Clipboard clipboard; // Reset the clipboard first. - Clipboard::ObjectMap objects; - Clipboard::ObjectMapParams params; + ui::Clipboard::ObjectMap objects; + ui::Clipboard::ObjectMapParams params; params.push_back(std::vector<char>()); objects[Clipboard::CBF_TEXT] = params; clipboard.WriteObjects(objects); @@ -278,7 +278,7 @@ IN_PROC_BROWSER_TEST_F(PDFBrowserTest, MAYBE_FindAndCopy) { ASSERT_NO_FATAL_FAILURE(WaitForResponse()); std::string text; - clipboard.ReadAsciiText(Clipboard::BUFFER_STANDARD, &text); + clipboard.ReadAsciiText(ui::Clipboard::BUFFER_STANDARD, &text); ASSERT_EQ("adipiscing", text); } diff --git a/chrome/test/testing_browser_process.h b/chrome/test/testing_browser_process.h index 64a11a2..5feada8 100644 --- a/chrome/test/testing_browser_process.h +++ b/chrome/test/testing_browser_process.h @@ -15,7 +15,6 @@ #include <string> -#include "app/clipboard/clipboard.h" #include "base/string_util.h" #include "base/synchronization/waitable_event.h" #include "chrome/browser/browser_process.h" @@ -26,6 +25,7 @@ #include "chrome/browser/policy/dummy_configuration_policy_provider.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/common/notification_service.h" +#include "ui/base/clipboard/clipboard.h" class IOThread; @@ -125,10 +125,10 @@ class TestingBrowserProcess : public BrowserProcess { return NULL; } - virtual Clipboard* clipboard() { + virtual ui::Clipboard* clipboard() { if (!clipboard_.get()) { // Note that we need a MessageLoop for the next call to work. - clipboard_.reset(new Clipboard); + clipboard_.reset(new ui::Clipboard); } return clipboard_.get(); } @@ -210,7 +210,7 @@ class TestingBrowserProcess : public BrowserProcess { NotificationService notification_service_; scoped_ptr<base::WaitableEvent> shutdown_event_; unsigned int module_ref_count_; - scoped_ptr<Clipboard> clipboard_; + scoped_ptr<ui::Clipboard> clipboard_; std::string app_locale_; PrefService* pref_service_; diff --git a/chrome_frame/test/chrome_frame_test_utils.cc b/chrome_frame/test/chrome_frame_test_utils.cc index 51a9025..dec04d6 100644 --- a/chrome_frame/test/chrome_frame_test_utils.cc +++ b/chrome_frame/test/chrome_frame_test_utils.cc @@ -9,8 +9,6 @@ #include <iepmapi.h> #include <sddl.h> -#include "app/clipboard/clipboard.h" -#include "app/clipboard/scoped_clipboard_writer.h" #include "base/command_line.h" #include "base/file_path.h" #include "base/file_version_info.h" @@ -29,6 +27,8 @@ #include "chrome/common/chrome_paths_internal.h" #include "chrome_frame/utils.h" #include "testing/gtest/include/gtest/gtest.h" +#include "ui/base/clipboard/clipboard.h" +#include "ui/base/clipboard/scoped_clipboard_writer.h" namespace chrome_frame_test { @@ -489,16 +489,16 @@ std::wstring GetPathAndQueryFromUrl(const std::wstring& url) { } std::wstring GetClipboardText() { - Clipboard clipboard; + ui::Clipboard clipboard; string16 text16; - clipboard.ReadText(Clipboard::BUFFER_STANDARD, &text16); + clipboard.ReadText(ui::Clipboard::BUFFER_STANDARD, &text16); return UTF16ToWide(text16); } void SetClipboardText(const std::wstring& text) { - Clipboard clipboard; + ui::Clipboard clipboard; { - ScopedClipboardWriter clipboard_writer(&clipboard); + ui::ScopedClipboardWriter clipboard_writer(&clipboard); clipboard_writer.WriteText(WideToUTF16(text)); } } @@ -1,3 +1,4 @@ include_rules = [ "+gfx", + "+third_party/mozilla", ] diff --git a/app/clipboard/clipboard.cc b/ui/base/clipboard/clipboard.cc index fa4f5a5..4b9bf603 100644 --- a/app/clipboard/clipboard.cc +++ b/ui/base/clipboard/clipboard.cc @@ -1,13 +1,15 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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 "app/clipboard/clipboard.h" +#include "ui/base/clipboard/clipboard.h" #include "base/logging.h" #include "base/scoped_ptr.h" #include "gfx/size.h" +namespace ui { + namespace { // A compromised renderer could send us bad data, so validate it. @@ -178,3 +180,4 @@ void Clipboard::ReplaceSharedMemHandle(ObjectMap* objects, } } +} // namespace ui diff --git a/app/clipboard/clipboard.h b/ui/base/clipboard/clipboard.h index 47a68f2..715e6ea 100644 --- a/app/clipboard/clipboard.h +++ b/ui/base/clipboard/clipboard.h @@ -1,9 +1,9 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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 APP_CLIPBOARD_CLIPBOARD_H_ -#define APP_CLIPBOARD_CLIPBOARD_H_ +#ifndef UI_BASE_CLIPBOARD_CLIPBOARD_H_ +#define UI_BASE_CLIPBOARD_CLIPBOARD_H_ #pragma once #include <map> @@ -21,6 +21,12 @@ class Size; class FilePath; +#if defined(TOOLKIT_USES_GTK) +typedef struct _GtkClipboard GtkClipboard; +#endif + +namespace ui { + class Clipboard { public: typedef std::string FormatType; @@ -249,8 +255,6 @@ class Clipboard { typedef std::map<FormatType, std::pair<char*, size_t> > TargetMap; private: - typedef struct _GtkClipboard GtkClipboard; - // Write changes to gtk clipboard. void SetGtkClipboard(); // Insert a mapping into clipboard_data_. @@ -267,4 +271,6 @@ class Clipboard { DISALLOW_COPY_AND_ASSIGN(Clipboard); }; -#endif // APP_CLIPBOARD_CLIPBOARD_H_ +} // namespace ui + +#endif // UI_BASE_CLIPBOARD_CLIPBOARD_H_ diff --git a/app/clipboard/clipboard_linux.cc b/ui/base/clipboard/clipboard_linux.cc index 8408614e..da24c4f 100644 --- a/app/clipboard/clipboard_linux.cc +++ b/ui/base/clipboard/clipboard_linux.cc @@ -1,8 +1,8 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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 "app/clipboard/clipboard.h" +#include "ui/base/clipboard/clipboard.h" #include <gtk/gtk.h> #include <map> @@ -17,6 +17,8 @@ #include "gfx/gtk_util.h" #include "gfx/size.h" +namespace ui { + namespace { const char kMimeBmp[] = "image/bmp"; @@ -415,3 +417,5 @@ GtkClipboard* Clipboard::LookupBackingClipboard(Buffer clipboard) const { return NULL; } } + +} // namespace ui diff --git a/app/clipboard/clipboard_mac.mm b/ui/base/clipboard/clipboard_mac.mm index d789c58..fb62346 100644 --- a/app/clipboard/clipboard_mac.mm +++ b/ui/base/clipboard/clipboard_mac.mm @@ -1,8 +1,8 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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 "app/clipboard/clipboard.h" +#include "ui/base/clipboard/clipboard.h" #import <Cocoa/Cocoa.h> @@ -16,6 +16,8 @@ #include "gfx/size.h" #import "third_party/mozilla/NSPasteboard+Utils.h" +namespace ui { + namespace { // Would be nice if this were in UTCoreTypes.h, but it isn't @@ -327,3 +329,5 @@ Clipboard::FormatType Clipboard::GetWebKitSmartPasteFormatType() { base::SysNSStringToUTF8(kWebSmartPastePboardType); return type; } + +} // namespace ui diff --git a/app/clipboard/clipboard_unittest.cc b/ui/base/clipboard/clipboard_unittest.cc index 28056d4..866db6c 100644 --- a/app/clipboard/clipboard_unittest.cc +++ b/ui/base/clipboard/clipboard_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. @@ -6,8 +6,6 @@ #include <string> -#include "app/clipboard/clipboard.h" -#include "app/clipboard/scoped_clipboard_writer.h" #include "base/basictypes.h" #include "base/scoped_ptr.h" #include "base/string_util.h" @@ -15,16 +13,20 @@ #include "gfx/size.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/platform_test.h" +#include "ui/base/clipboard/clipboard.h" +#include "ui/base/clipboard/scoped_clipboard_writer.h" #if defined(OS_WIN) -#include "app/clipboard/clipboard_util_win.h" #include "base/message_loop.h" +#include "ui/base/clipboard/clipboard_util_win.h" #endif #if defined(OS_WIN) || (defined(OS_POSIX) && !defined(OS_MACOSX)) #include "base/pickle.h" #endif +namespace ui { + #if defined(OS_WIN) class ClipboardTest : public PlatformTest { protected: @@ -426,3 +428,5 @@ TEST_F(ClipboardTest, WriteEverything) { // Passes if we don't crash. } + +} // namespace ui diff --git a/app/clipboard/clipboard_util_win.cc b/ui/base/clipboard/clipboard_util_win.cc index 3554002..c6dd6a3 100644 --- a/app/clipboard/clipboard_util_win.cc +++ b/ui/base/clipboard/clipboard_util_win.cc @@ -1,8 +1,8 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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 "app/clipboard/clipboard_util_win.h" +#include "ui/base/clipboard/clipboard_util_win.h" #include <shellapi.h> #include <shlwapi.h> @@ -15,6 +15,8 @@ #include "base/utf_string_conversions.h" #include "base/win/scoped_hglobal.h" +namespace ui { + namespace { bool GetUrlFromHDrop(IDataObject* data_object, std::wstring* url, @@ -538,3 +540,5 @@ void ClipboardUtil::CFHtmlToHtml(const std::string& cf_html, } } } + +} // namespace ui diff --git a/app/clipboard/clipboard_util_win.h b/ui/base/clipboard/clipboard_util_win.h index 7283e33..6c322ee 100644 --- a/app/clipboard/clipboard_util_win.h +++ b/ui/base/clipboard/clipboard_util_win.h @@ -1,17 +1,19 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. // // Some helper functions for working with the clipboard and IDataObjects. -#ifndef APP_CLIPBOARD_CLIPBOARD_UTIL_WIN_H_ -#define APP_CLIPBOARD_CLIPBOARD_UTIL_WIN_H_ +#ifndef UI_BASE_CLIPBOARD_CLIPBOARD_UTIL_WIN_H_ +#define UI_BASE_CLIPBOARD_CLIPBOARD_UTIL_WIN_H_ #pragma once #include <shlobj.h> #include <string> #include <vector> +namespace ui { + class ClipboardUtil { public: ///////////////////////////////////////////////////////////////////////////// @@ -63,4 +65,6 @@ class ClipboardUtil { std::string* base_url); }; -#endif // APP_CLIPBOARD_CLIPBOARD_UTIL_WIN_H_ +} + +#endif // UI_BASE_CLIPBOARD_CLIPBOARD_UTIL_WIN_H_ diff --git a/app/clipboard/clipboard_win.cc b/ui/base/clipboard/clipboard_win.cc index 44dbb31..7c21dcf 100644 --- a/app/clipboard/clipboard_win.cc +++ b/ui/base/clipboard/clipboard_win.cc @@ -1,16 +1,15 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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 "app/clipboard/clipboard.h" +#include "ui/base/clipboard/clipboard.h" #include <shlobj.h> #include <shellapi.h> -#include "app/clipboard/clipboard_util_win.h" #include "base/file_path.h" #include "base/logging.h" #include "base/message_loop.h" @@ -19,6 +18,9 @@ #include "base/string_number_conversions.h" #include "base/utf_string_conversions.h" #include "gfx/size.h" +#include "ui/base/clipboard/clipboard_util_win.h" + +namespace ui { namespace { @@ -600,3 +602,5 @@ HWND Clipboard::GetClipboardWindow() const { } return clipboard_owner_; } + +} // namespace ui diff --git a/app/clipboard/scoped_clipboard_writer.cc b/ui/base/clipboard/scoped_clipboard_writer.cc index e2cb6ec..43ffaad 100644 --- a/app/clipboard/scoped_clipboard_writer.cc +++ b/ui/base/clipboard/scoped_clipboard_writer.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. @@ -6,12 +6,14 @@ // purpose can be found in our header. Documentation on the format of the // parameters for each clipboard target can be found in clipboard.h. -#include "app/clipboard/scoped_clipboard_writer.h" +#include "ui/base/clipboard/scoped_clipboard_writer.h" #include "base/pickle.h" #include "base/utf_string_conversions.h" #include "gfx/size.h" +namespace ui { + ScopedClipboardWriter::ScopedClipboardWriter(Clipboard* clipboard) : clipboard_(clipboard) { } @@ -134,3 +136,5 @@ void ScopedClipboardWriter::WriteTextOrURL(const string16& text, bool is_url) { url_text_.clear(); } } + +} // namespace ui diff --git a/app/clipboard/scoped_clipboard_writer.h b/ui/base/clipboard/scoped_clipboard_writer.h index 61ef5b5..4bd2da7 100644 --- a/app/clipboard/scoped_clipboard_writer.h +++ b/ui/base/clipboard/scoped_clipboard_writer.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. @@ -8,17 +8,19 @@ // avoiding any potential race condition with other processes that are also // writing to the system clipboard. -#ifndef APP_CLIPBOARD_SCOPED_CLIPBOARD_WRITER_H_ -#define APP_CLIPBOARD_SCOPED_CLIPBOARD_WRITER_H_ +#ifndef UI_BASE_CLIPBOARD_SCOPED_CLIPBOARD_WRITER_H_ +#define UI_BASE_CLIPBOARD_SCOPED_CLIPBOARD_WRITER_H_ #pragma once #include <string> -#include "app/clipboard/clipboard.h" #include "base/string16.h" +#include "ui/base/clipboard/clipboard.h" class Pickle; +namespace ui { + // This class is a wrapper for |Clipboard| that handles packing data // into a Clipboard::ObjectMap. // NB: You should probably NOT be using this class if you include @@ -77,4 +79,7 @@ class ScopedClipboardWriter { DISALLOW_COPY_AND_ASSIGN(ScopedClipboardWriter); }; -#endif // APP_CLIPBOARD_SCOPED_CLIPBOARD_WRITER_H_ +} // namespace ui + +#endif // UI_BASE_CLIPBOARD_SCOPED_CLIPBOARD_WRITER_H_ + diff --git a/ui/base/ui_base.gypi b/ui/base/ui_base.gypi index f441c6f..4844945 100644 --- a/ui/base/ui_base.gypi +++ b/ui/base/ui_base.gypi @@ -69,6 +69,15 @@ 'animation/throb_animation.h', 'animation/tween.cc', 'animation/tween.h', + 'clipboard/clipboard.cc', + 'clipboard/clipboard.h', + 'clipboard/clipboard_linux.cc', + 'clipboard/clipboard_mac.mm', + 'clipboard/clipboard_util_win.cc', + 'clipboard/clipboard_util_win.h', + 'clipboard/clipboard_win.cc', + 'clipboard/scoped_clipboard_writer.cc', + 'clipboard/scoped_clipboard_writer.h', ], }, { @@ -86,6 +95,7 @@ 'animation/animation_unittest.cc', 'animation/multi_animation_unittest.cc', 'animation/slide_animation_unittest.cc', + 'clipboard/clipboard_unittest.cc', 'run_all_unittests.cc', 'test_suite.h', ], diff --git a/views/controls/message_box_view.cc b/views/controls/message_box_view.cc index 7529236..245b861 100644 --- a/views/controls/message_box_view.cc +++ b/views/controls/message_box_view.cc @@ -4,12 +4,12 @@ #include "views/controls/message_box_view.h" -#include "app/clipboard/clipboard.h" -#include "app/clipboard/scoped_clipboard_writer.h" #include "app/message_box_flags.h" #include "base/i18n/rtl.h" #include "base/message_loop.h" #include "base/utf_string_conversions.h" +#include "ui/base/clipboard/clipboard.h" +#include "ui/base/clipboard/scoped_clipboard_writer.h" #include "views/controls/button/checkbox.h" #include "views/standard_layout.h" #include "views/views_delegate.h" @@ -101,11 +101,12 @@ bool MessageBoxView::AcceleratorPressed( if (!views::ViewsDelegate::views_delegate) return false; - Clipboard* clipboard = views::ViewsDelegate::views_delegate->GetClipboard(); + ui::Clipboard* clipboard = + views::ViewsDelegate::views_delegate->GetClipboard(); if (!clipboard) return false; - ScopedClipboardWriter scw(clipboard); + ui::ScopedClipboardWriter scw(clipboard); scw.WriteText(WideToUTF16Hack(message_label_->GetText())); return true; } diff --git a/views/controls/textfield/native_textfield_win.cc b/views/controls/textfield/native_textfield_win.cc index d74ff2c..404459d 100644 --- a/views/controls/textfield/native_textfield_win.cc +++ b/views/controls/textfield/native_textfield_win.cc @@ -6,8 +6,6 @@ #include <algorithm> -#include "app/clipboard/clipboard.h" -#include "app/clipboard/scoped_clipboard_writer.h" #include "app/keyboard_codes.h" #include "app/keyboard_code_conversion_win.h" #include "app/l10n_util.h" @@ -20,6 +18,8 @@ #include "gfx/native_theme_win.h" #include "grit/app_strings.h" #include "skia/ext/skia_utils_win.h" +#include "ui/base/clipboard/clipboard.h" +#include "ui/base/clipboard/scoped_clipboard_writer.h" #include "views/controls/label.h" #include "views/controls/menu/menu_win.h" #include "views/controls/menu/menu_2.h" @@ -464,7 +464,8 @@ void NativeTextfieldWin::OnCopy() { const std::wstring text(GetSelectedText()); if (!text.empty() && ViewsDelegate::views_delegate) { - ScopedClipboardWriter scw(ViewsDelegate::views_delegate->GetClipboard()); + ui::ScopedClipboardWriter scw( + ViewsDelegate::views_delegate->GetClipboard()); scw.WriteText(text); } } @@ -845,13 +846,13 @@ void NativeTextfieldWin::OnPaste() { if (textfield_->read_only() || !ViewsDelegate::views_delegate) return; - Clipboard* clipboard = ViewsDelegate::views_delegate->GetClipboard(); - if (!clipboard->IsFormatAvailable(Clipboard::GetPlainTextWFormatType(), - Clipboard::BUFFER_STANDARD)) + ui::Clipboard* clipboard = ViewsDelegate::views_delegate->GetClipboard(); + if (!clipboard->IsFormatAvailable(ui::Clipboard::GetPlainTextWFormatType(), + ui::Clipboard::BUFFER_STANDARD)) return; std::wstring clipboard_str; - clipboard->ReadText(Clipboard::BUFFER_STANDARD, &clipboard_str); + clipboard->ReadText(ui::Clipboard::BUFFER_STANDARD, &clipboard_str); if (!clipboard_str.empty()) { std::wstring collapsed(CollapseWhitespace(clipboard_str, false)); if (textfield_->style() & Textfield::STYLE_LOWERCASE) diff --git a/views/view_unittest.cc b/views/view_unittest.cc index fe5effe..721bab7 100644 --- a/views/view_unittest.cc +++ b/views/view_unittest.cc @@ -4,7 +4,6 @@ #include <map> -#include "app/clipboard/clipboard.h" #include "app/keyboard_codes.h" #include "base/message_loop.h" #include "base/string_util.h" @@ -12,6 +11,7 @@ #include "gfx/canvas_skia.h" #include "gfx/path.h" #include "testing/gtest/include/gtest/gtest.h" +#include "ui/base/clipboard/clipboard.h" #include "views/background.h" #include "views/controls/button/checkbox.h" #include "views/controls/native/native_view_host.h" @@ -783,7 +783,7 @@ TEST_F(ViewTest, Textfield) { const string16 kExtraText = ASCIIToUTF16("Pretty deep, Philip!"); const string16 kEmptyString; - Clipboard clipboard; + ui::Clipboard clipboard; Widget* window = CreateWidget(); window->Init(NULL, gfx::Rect(0, 0, 100, 100)); @@ -816,10 +816,10 @@ class TestViewsDelegate : public views::ViewsDelegate { virtual ~TestViewsDelegate() {} // Overridden from views::ViewsDelegate: - virtual Clipboard* GetClipboard() const { + virtual ui::Clipboard* GetClipboard() const { if (!clipboard_.get()) { // Note that we need a MessageLoop for the next call to work. - clipboard_.reset(new Clipboard); + clipboard_.reset(new ui::Clipboard); } return clipboard_.get(); } @@ -844,7 +844,7 @@ class TestViewsDelegate : public views::ViewsDelegate { virtual void ReleaseRef() {} private: - mutable scoped_ptr<Clipboard> clipboard_; + mutable scoped_ptr<ui::Clipboard> clipboard_; DISALLOW_COPY_AND_ASSIGN(TestViewsDelegate); }; @@ -857,7 +857,7 @@ TEST_F(ViewTest, TextfieldCutCopyPaste) { const std::wstring kReadOnlyText = L"Read only"; const std::wstring kPasswordText = L"Password! ** Secret stuff **"; - Clipboard clipboard; + ui::Clipboard clipboard; Widget* window = CreateWidget(); #if defined(OS_WIN) @@ -886,7 +886,7 @@ TEST_F(ViewTest, TextfieldCutCopyPaste) { ::SendMessage(normal->GetTestingHandle(), WM_CUT, 0, 0); string16 result; - clipboard.ReadText(Clipboard::BUFFER_STANDARD, &result); + clipboard.ReadText(ui::Clipboard::BUFFER_STANDARD, &result); EXPECT_EQ(kNormalText, result); normal->SetText(kNormalText); // Let's revert to the original content. @@ -894,7 +894,7 @@ TEST_F(ViewTest, TextfieldCutCopyPaste) { read_only->SelectAll(); ::SendMessage(read_only->GetTestingHandle(), WM_CUT, 0, 0); result.clear(); - clipboard.ReadText(Clipboard::BUFFER_STANDARD, &result); + clipboard.ReadText(ui::Clipboard::BUFFER_STANDARD, &result); // Cut should have failed, so the clipboard content should not have changed. EXPECT_EQ(kNormalText, result); @@ -902,7 +902,7 @@ TEST_F(ViewTest, TextfieldCutCopyPaste) { password->SelectAll(); ::SendMessage(password->GetTestingHandle(), WM_CUT, 0, 0); result.clear(); - clipboard.ReadText(Clipboard::BUFFER_STANDARD, &result); + clipboard.ReadText(ui::Clipboard::BUFFER_STANDARD, &result); // Cut should have failed, so the clipboard content should not have changed. EXPECT_EQ(kNormalText, result); @@ -915,19 +915,19 @@ TEST_F(ViewTest, TextfieldCutCopyPaste) { read_only->SelectAll(); ::SendMessage(read_only->GetTestingHandle(), WM_COPY, 0, 0); result.clear(); - clipboard.ReadText(Clipboard::BUFFER_STANDARD, &result); + clipboard.ReadText(ui::Clipboard::BUFFER_STANDARD, &result); EXPECT_EQ(kReadOnlyText, result); normal->SelectAll(); ::SendMessage(normal->GetTestingHandle(), WM_COPY, 0, 0); result.clear(); - clipboard.ReadText(Clipboard::BUFFER_STANDARD, &result); + clipboard.ReadText(ui::Clipboard::BUFFER_STANDARD, &result); EXPECT_EQ(kNormalText, result); password->SelectAll(); ::SendMessage(password->GetTestingHandle(), WM_COPY, 0, 0); result.clear(); - clipboard.ReadText(Clipboard::BUFFER_STANDARD, &result); + clipboard.ReadText(ui::Clipboard::BUFFER_STANDARD, &result); // We don't let you copy from a password field, clipboard should not have // changed. EXPECT_EQ(kNormalText, result); diff --git a/views/views_delegate.h b/views/views_delegate.h index 27e4498..66d91a7 100644 --- a/views/views_delegate.h +++ b/views/views_delegate.h @@ -13,12 +13,14 @@ #include "views/accessibility/accessibility_types.h" -class Clipboard; - namespace gfx { class Rect; } +namespace ui { +class Clipboard; +} + namespace views { class View; @@ -34,7 +36,7 @@ class ViewsDelegate { virtual ~ViewsDelegate() {} // Gets the clipboard. - virtual Clipboard* GetClipboard() const = 0; + virtual ui::Clipboard* GetClipboard() const = 0; // Saves the position, size and maximized state for the window with the // specified name. diff --git a/webkit/glue/DEPS b/webkit/glue/DEPS index 0a36ef7..e4479d5 100644 --- a/webkit/glue/DEPS +++ b/webkit/glue/DEPS @@ -4,6 +4,7 @@ include_rules = [ "+media", "+skia/ext", "+skia/include", + "+ui", "+webkit/tools/test_shell", # Needed for test shell tests. # This is not actually a directory, but npruntime_util.cc includes a file diff --git a/webkit/glue/scoped_clipboard_writer_glue.h b/webkit/glue/scoped_clipboard_writer_glue.h index 7460ddf..13b96a3 100644 --- a/webkit/glue/scoped_clipboard_writer_glue.h +++ b/webkit/glue/scoped_clipboard_writer_glue.h @@ -5,7 +5,7 @@ #ifndef SCOPED_CLIPBOARD_WRITER_GLUE_H_ #define SCOPED_CLIPBOARD_WRITER_GLUE_H_ -#include "app/clipboard/scoped_clipboard_writer.h" +#include "ui/base/clipboard/scoped_clipboard_writer.h" class SkBitmap; @@ -13,10 +13,10 @@ namespace base { class SharedMemory; } -class ScopedClipboardWriterGlue : public ScopedClipboardWriter { +class ScopedClipboardWriterGlue : public ui::ScopedClipboardWriter { public: - ScopedClipboardWriterGlue(Clipboard* clipboard) - : ScopedClipboardWriter(clipboard), + ScopedClipboardWriterGlue(ui::Clipboard* clipboard) + : ui::ScopedClipboardWriter(clipboard), shared_buf_(NULL) { } diff --git a/webkit/glue/webclipboard_impl.cc b/webkit/glue/webclipboard_impl.cc index 8e3f87b..eabcf92 100644 --- a/webkit/glue/webclipboard_impl.cc +++ b/webkit/glue/webclipboard_impl.cc @@ -1,10 +1,9 @@ -// Copyright (c) 2009 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. +// Copyright (c) 2011 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 "app/clipboard/clipboard.h" #include "base/logging.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" @@ -16,6 +15,7 @@ #include "third_party/WebKit/WebKit/chromium/public/WebString.h" #include "third_party/WebKit/WebKit/chromium/public/WebURL.h" #include "third_party/WebKit/WebKit/chromium/public/WebVector.h" +#include "ui/base/clipboard/clipboard.h" #include "webkit/glue/scoped_clipboard_writer_glue.h" #include "webkit/glue/webkit_glue.h" @@ -62,19 +62,19 @@ WebClipboardImpl::~WebClipboardImpl() { } bool WebClipboardImpl::isFormatAvailable(Format format, Buffer buffer) { - Clipboard::FormatType format_type; - Clipboard::Buffer buffer_type; + ui::Clipboard::FormatType format_type; + ui::Clipboard::Buffer buffer_type; switch (format) { case FormatHTML: - format_type = Clipboard::GetHtmlFormatType(); + format_type = ui::Clipboard::GetHtmlFormatType(); break; case FormatSmartPaste: - format_type = Clipboard::GetWebKitSmartPasteFormatType(); + format_type = ui::Clipboard::GetWebKitSmartPasteFormatType(); break; case FormatBookmark: #if defined(OS_WIN) || defined(OS_MACOSX) - format_type = Clipboard::GetUrlWFormatType(); + format_type = ui::Clipboard::GetUrlWFormatType(); break; #endif default: @@ -89,11 +89,11 @@ bool WebClipboardImpl::isFormatAvailable(Format format, Buffer buffer) { } WebString WebClipboardImpl::readPlainText(Buffer buffer) { - Clipboard::Buffer buffer_type; + ui::Clipboard::Buffer buffer_type; if (!ConvertBufferType(buffer, &buffer_type)) return WebString(); - if (ClipboardIsFormatAvailable(Clipboard::GetPlainTextWFormatType(), + if (ClipboardIsFormatAvailable(ui::Clipboard::GetPlainTextWFormatType(), buffer_type)) { string16 text; ClipboardReadText(buffer_type, &text); @@ -101,7 +101,7 @@ WebString WebClipboardImpl::readPlainText(Buffer buffer) { return text; } - if (ClipboardIsFormatAvailable(Clipboard::GetPlainTextFormatType(), + if (ClipboardIsFormatAvailable(ui::Clipboard::GetPlainTextFormatType(), buffer_type)) { std::string text; ClipboardReadAsciiText(buffer_type, &text); @@ -113,7 +113,7 @@ WebString WebClipboardImpl::readPlainText(Buffer buffer) { } WebString WebClipboardImpl::readHTML(Buffer buffer, WebURL* source_url) { - Clipboard::Buffer buffer_type; + ui::Clipboard::Buffer buffer_type; if (!ConvertBufferType(buffer, &buffer_type)) return WebString(); @@ -178,7 +178,7 @@ void WebClipboardImpl::writeData(const WebKit::WebDragData& data) { WebVector<WebString> WebClipboardImpl::readAvailableTypes( Buffer buffer, bool* contains_filenames) { - Clipboard::Buffer buffer_type; + ui::Clipboard::Buffer buffer_type; std::vector<string16> types; if (ConvertBufferType(buffer, &buffer_type)) { ClipboardReadAvailableTypes(buffer_type, &types, contains_filenames); @@ -188,7 +188,7 @@ WebVector<WebString> WebClipboardImpl::readAvailableTypes( bool WebClipboardImpl::readData(Buffer buffer, const WebString& type, WebString* data, WebString* metadata) { - Clipboard::Buffer buffer_type; + ui::Clipboard::Buffer buffer_type; if (!ConvertBufferType(buffer, &buffer_type)) return false; @@ -203,7 +203,7 @@ bool WebClipboardImpl::readData(Buffer buffer, const WebString& type, } WebVector<WebString> WebClipboardImpl::readFilenames(Buffer buffer) { - Clipboard::Buffer buffer_type; + ui::Clipboard::Buffer buffer_type; std::vector<string16> filenames; if (ConvertBufferType(buffer, &buffer_type)) { ClipboardReadFilenames(buffer_type, &filenames); @@ -212,16 +212,16 @@ WebVector<WebString> WebClipboardImpl::readFilenames(Buffer buffer) { } bool WebClipboardImpl::ConvertBufferType(Buffer buffer, - Clipboard::Buffer* result) { + ui::Clipboard::Buffer* result) { switch (buffer) { case BufferStandard: - *result = Clipboard::BUFFER_STANDARD; + *result = ui::Clipboard::BUFFER_STANDARD; break; case BufferDrag: - *result = Clipboard::BUFFER_DRAG; + *result = ui::Clipboard::BUFFER_DRAG; case BufferSelection: #if defined(USE_X11) - *result = Clipboard::BUFFER_SELECTION; + *result = ui::Clipboard::BUFFER_SELECTION; break; #endif default: diff --git a/webkit/glue/webclipboard_impl.h b/webkit/glue/webclipboard_impl.h index 6a83a6d..49eb138 100644 --- a/webkit/glue/webclipboard_impl.h +++ b/webkit/glue/webclipboard_impl.h @@ -1,12 +1,12 @@ -// Copyright (c) 2009 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. +// Copyright (c) 2011 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_ -#include "app/clipboard/clipboard.h" #include "third_party/WebKit/WebKit/chromium/public/WebClipboard.h" +#include "ui/base/clipboard/clipboard.h" #include <string> @@ -47,7 +47,7 @@ class WebClipboardImpl : public WebKit::WebClipboard { virtual WebKit::WebVector<WebKit::WebString> readFilenames(Buffer); private: - bool ConvertBufferType(Buffer, Clipboard::Buffer*); + bool ConvertBufferType(Buffer, ui::Clipboard::Buffer*); }; } // namespace webkit_glue diff --git a/webkit/glue/webdropdata_win.cc b/webkit/glue/webdropdata_win.cc index bd76090..b550eb9 100644 --- a/webkit/glue/webdropdata_win.cc +++ b/webkit/glue/webdropdata_win.cc @@ -8,26 +8,26 @@ #include <shellapi.h> #include <shlobj.h> -#include "app/clipboard/clipboard_util_win.h" #include "googleurl/src/gurl.h" +#include "ui/base/clipboard/clipboard_util_win.h" // static void WebDropData::PopulateWebDropData(IDataObject* data_object, WebDropData* drop_data) { std::wstring url_str; - if (ClipboardUtil::GetUrl(data_object, &url_str, &drop_data->url_title, - false)) { + if (ui::ClipboardUtil::GetUrl(data_object, &url_str, &drop_data->url_title, + false)) { GURL test_url(url_str); if (test_url.is_valid()) drop_data->url = test_url; } - ClipboardUtil::GetFilenames(data_object, &drop_data->filenames); - ClipboardUtil::GetPlainText(data_object, &drop_data->plain_text); + ui::ClipboardUtil::GetFilenames(data_object, &drop_data->filenames); + ui::ClipboardUtil::GetPlainText(data_object, &drop_data->plain_text); std::string base_url; - ClipboardUtil::GetHtml(data_object, &drop_data->text_html, &base_url); + ui::ClipboardUtil::GetHtml(data_object, &drop_data->text_html, &base_url); if (!base_url.empty()) { drop_data->html_base_url = GURL(base_url); } - ClipboardUtil::GetFileContents(data_object, + ui::ClipboardUtil::GetFileContents(data_object, &drop_data->file_description_filename, &drop_data->file_contents); } diff --git a/webkit/glue/webkit_glue.gypi b/webkit/glue/webkit_glue.gypi index e64f667..b469b4e 100644 --- a/webkit/glue/webkit_glue.gypi +++ b/webkit/glue/webkit_glue.gypi @@ -115,6 +115,7 @@ 'dependencies': [ '<(DEPTH)/app/app.gyp:app_base', '<(DEPTH)/base/base.gyp:base_i18n', + '<(DEPTH)/ui/ui.gyp:ui_base', ], 'actions': [ { @@ -157,6 +158,7 @@ '<(DEPTH)/third_party/icu/icu.gyp:icui18n', '<(DEPTH)/third_party/icu/icu.gyp:icuuc', '<(DEPTH)/third_party/npapi/npapi.gyp:npapi', + '<(DEPTH)/ui/ui.gyp:ui_base', '<(DEPTH)/ppapi/ppapi.gyp:ppapi_c', 'webkit_resources', 'webkit_strings', diff --git a/webkit/glue/webkit_glue.h b/webkit/glue/webkit_glue.h index 38ea659..7e3f863 100644 --- a/webkit/glue/webkit_glue.h +++ b/webkit/glue/webkit_glue.h @@ -14,12 +14,12 @@ #include <string> #include <vector> -#include "app/clipboard/clipboard.h" #include "base/file_path.h" #include "base/platform_file.h" #include "base/string16.h" #include "third_party/WebKit/WebKit/chromium/public/WebCanvas.h" #include "third_party/WebKit/WebKit/chromium/public/WebFileError.h" +#include "ui/base/clipboard/clipboard.h" class GURL; class SkBitmap; @@ -189,32 +189,33 @@ HCURSOR LoadCursor(int cursor_id); // Glue to access the clipboard. // Get a clipboard that can be used to construct a ScopedClipboardWriterGlue. -Clipboard* ClipboardGetClipboard(); +ui::Clipboard* ClipboardGetClipboard(); // Tests whether the clipboard contains a certain format -bool ClipboardIsFormatAvailable(const Clipboard::FormatType& format, - Clipboard::Buffer buffer); +bool ClipboardIsFormatAvailable(const ui::Clipboard::FormatType& format, + ui::Clipboard::Buffer buffer); // Reads UNICODE text from the clipboard, if available. -void ClipboardReadText(Clipboard::Buffer buffer, string16* result); +void ClipboardReadText(ui::Clipboard::Buffer buffer, string16* result); // Reads ASCII text from the clipboard, if available. -void ClipboardReadAsciiText(Clipboard::Buffer buffer, std::string* result); +void ClipboardReadAsciiText(ui::Clipboard::Buffer buffer, std::string* result); // Reads HTML from the clipboard, if available. -void ClipboardReadHTML(Clipboard::Buffer buffer, string16* markup, GURL* url); +void ClipboardReadHTML(ui::Clipboard::Buffer buffer, string16* markup, + GURL* url); // Reads the available types from the clipboard, if available. -bool ClipboardReadAvailableTypes(Clipboard::Buffer buffer, +bool ClipboardReadAvailableTypes(ui::Clipboard::Buffer buffer, std::vector<string16>* types, bool* contains_filenames); // Reads one type of data from the clipboard, if available. -bool ClipboardReadData(Clipboard::Buffer buffer, const string16& type, +bool ClipboardReadData(ui::Clipboard::Buffer buffer, const string16& type, string16* data, string16* metadata); // Reads filenames from the clipboard, if available. -bool ClipboardReadFilenames(Clipboard::Buffer buffer, +bool ClipboardReadFilenames(ui::Clipboard::Buffer buffer, std::vector<string16>* filenames); // Gets the directory where the application data and libraries exist. This diff --git a/webkit/tools/test_shell/DEPS b/webkit/tools/test_shell/DEPS index 82fe6ef..cdb5eeb 100644 --- a/webkit/tools/test_shell/DEPS +++ b/webkit/tools/test_shell/DEPS @@ -1,4 +1,5 @@ include_rules = [ "+mac", "+app", + "+ui", ] diff --git a/webkit/tools/test_shell/simple_clipboard_impl.cc b/webkit/tools/test_shell/simple_clipboard_impl.cc index 95a33eb..ef290c7 100644 --- a/webkit/tools/test_shell/simple_clipboard_impl.cc +++ b/webkit/tools/test_shell/simple_clipboard_impl.cc @@ -6,11 +6,11 @@ #include <string> -#include "app/clipboard/clipboard.h" #include "base/lazy_instance.h" #include "base/string16.h" #include "googleurl/src/gurl.h" #include "third_party/skia/include/core/SkBitmap.h" +#include "ui/base/clipboard/clipboard.h" #include "webkit/glue/scoped_clipboard_writer_glue.h" // Clipboard glue @@ -25,26 +25,27 @@ ScopedClipboardWriterGlue::~ScopedClipboardWriterGlue() { namespace webkit_glue { -base::LazyInstance<Clipboard> clipboard(base::LINKER_INITIALIZED); +base::LazyInstance<ui::Clipboard> clipboard(base::LINKER_INITIALIZED); -Clipboard* ClipboardGetClipboard() { +ui::Clipboard* ClipboardGetClipboard() { return clipboard.Pointer(); } -bool ClipboardIsFormatAvailable(const Clipboard::FormatType& format, - Clipboard::Buffer buffer) { +bool ClipboardIsFormatAvailable(const ui::Clipboard::FormatType& format, + ui::Clipboard::Buffer buffer) { return ClipboardGetClipboard()->IsFormatAvailable(format, buffer); } -void ClipboardReadText(Clipboard::Buffer buffer, string16* result) { +void ClipboardReadText(ui::Clipboard::Buffer buffer, string16* result) { ClipboardGetClipboard()->ReadText(buffer, result); } -void ClipboardReadAsciiText(Clipboard::Buffer buffer, std::string* result) { +void ClipboardReadAsciiText(ui::Clipboard::Buffer buffer, std::string* result) { ClipboardGetClipboard()->ReadAsciiText(buffer, result); } -void ClipboardReadHTML(Clipboard::Buffer buffer, string16* markup, GURL* url) { +void ClipboardReadHTML(ui::Clipboard::Buffer buffer, string16* markup, + GURL* url) { std::string url_str; ClipboardGetClipboard()->ReadHTML(buffer, markup, url ? &url_str : NULL); if (url) @@ -52,18 +53,18 @@ void ClipboardReadHTML(Clipboard::Buffer buffer, string16* markup, GURL* url) { } // TODO(dcheng): Implement. -bool ClipboardReadAvailableTypes(Clipboard::Buffer buffer, +bool ClipboardReadAvailableTypes(ui::Clipboard::Buffer buffer, std::vector<string16>* types, bool* contains_filenames) { return false; } -bool ClipboardReadData(Clipboard::Buffer buffer, const string16& type, +bool ClipboardReadData(ui::Clipboard::Buffer buffer, const string16& type, string16* data, string16* metadata) { return false; } -bool ClipboardReadFilenames(Clipboard::Buffer buffer, +bool ClipboardReadFilenames(ui::Clipboard::Buffer buffer, std::vector<string16>* filenames) { return false; } diff --git a/webkit/tools/test_shell/test_shell.gypi b/webkit/tools/test_shell/test_shell.gypi index b29181b..bf53fd4 100644 --- a/webkit/tools/test_shell/test_shell.gypi +++ b/webkit/tools/test_shell/test_shell.gypi @@ -39,6 +39,7 @@ '<(DEPTH)/testing/gtest.gyp:gtest', '<(DEPTH)/third_party/WebKit/WebKit/chromium/WebKit.gyp:inspector_resources', '<(DEPTH)/third_party/WebKit/WebKit/chromium/WebKit.gyp:webkit', + '<(DEPTH)/ui/ui.gyp:ui_base', '<(DEPTH)/webkit/support/webkit_support.gyp:appcache', '<(DEPTH)/webkit/support/webkit_support.gyp:blob', '<(DEPTH)/webkit/support/webkit_support.gyp:database', |