diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-13 23:21:45 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-13 23:21:45 +0000 |
commit | 321792ef1baac764227d55fc944f32cf29e50c6a (patch) | |
tree | 58acd23f1f5d4fc2e33e07e188210d2836fc84f2 | |
parent | 4343dfbb634893311ae654e412d704831c8ba5ac (diff) | |
download | chromium_src-321792ef1baac764227d55fc944f32cf29e50c6a.zip chromium_src-321792ef1baac764227d55fc944f32cf29e50c6a.tar.gz chromium_src-321792ef1baac764227d55fc944f32cf29e50c6a.tar.bz2 |
Stubs out OSExchangeData for views on gtk.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/113321
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16012 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | app/app.vcproj | 2 | ||||
-rw-r--r-- | app/os_exchange_data.h | 23 | ||||
-rw-r--r-- | app/os_exchange_data_gtk.cc | 75 | ||||
-rw-r--r-- | app/os_exchange_data_win.cc (renamed from app/os_exchange_data.cc) | 0 | ||||
-rw-r--r-- | app/os_exchange_data_win_unittest.cc (renamed from app/os_exchange_data_unittest.cc) | 0 | ||||
-rw-r--r-- | build/build_config.h | 1 | ||||
-rw-r--r-- | chrome/browser/bookmarks/bookmark_drag_data.cc | 3 | ||||
-rw-r--r-- | chrome/browser/bookmarks/bookmark_drag_data_unittest.cc | 4 | ||||
-rw-r--r-- | chrome/chrome.gyp | 14 | ||||
-rw-r--r-- | chrome/common/temp_scaffolding_stubs.h | 2 | ||||
-rw-r--r-- | chrome/test/unit/unittests.vcproj | 2 |
11 files changed, 115 insertions, 11 deletions
diff --git a/app/app.vcproj b/app/app.vcproj index 64b07d87..cc618af 100644 --- a/app/app.vcproj +++ b/app/app.vcproj @@ -222,7 +222,7 @@ >
</File>
<File
- RelativePath=".\os_exchange_data.cc"
+ RelativePath=".\os_exchange_data_win.cc"
>
</File>
<File
diff --git a/app/os_exchange_data.h b/app/os_exchange_data.h index 5668008..046c77c 100644 --- a/app/os_exchange_data.h +++ b/app/os_exchange_data.h @@ -5,8 +5,12 @@ #ifndef APP_OS_EXCHANGE_DATA_H_ #define APP_OS_EXCHANGE_DATA_H_ +#include "build/build_config.h" + +#if defined(OS_WIN) #include <atlbase.h> #include <objidl.h> +#endif #include <vector> #include "base/basictypes.h" @@ -23,8 +27,13 @@ class Pickle; // translating that into something the OS can understand. // /////////////////////////////////////////////////////////////////////////////// +#if defined(OS_WIN) class OSExchangeData : public IDataObject { +#else +class OSExchangeData { +#endif public: +#if defined(OS_WIN) // Returns true if source has plain text that is a valid url. static bool HasPlainTextURL(IDataObject* source); @@ -32,8 +41,10 @@ class OSExchangeData : public IDataObject { // that url. static bool GetPlainTextURL(IDataObject* source, GURL* url); + explicit OSExchangeData(IDataObject* source); +#endif + OSExchangeData(); - OSExchangeData(IDataObject* source); virtual ~OSExchangeData(); // These functions add data to the OSExchangeData object of various Chrome @@ -51,8 +62,10 @@ class OSExchangeData : public IDataObject { void SetURL(const GURL& url, const std::wstring& title); // A full path to a file void SetFilename(const std::wstring& full_path); +#if defined(OS_WIN) // Adds pickled data of the specified format. void SetPickledData(CLIPFORMAT format, const Pickle& data); +#endif // Adds the bytes of a file (CFSTR_FILECONTENTS and CFSTR_FILEDESCRIPTOR). void SetFileContents(const std::wstring& filename, const std::string& file_contents); @@ -68,7 +81,9 @@ class OSExchangeData : public IDataObject { bool GetURLAndTitle(GURL* url, std::wstring* title) const; // Return the path of a file, if available. bool GetFilename(std::wstring* full_path) const; +#if defined(OS_WIN) bool GetPickledData(CLIPFORMAT format, Pickle* data) const; +#endif bool GetFileContents(std::wstring* filename, std::string* file_contents) const; bool GetHtml(std::wstring* html, GURL* base_url) const; @@ -79,6 +94,7 @@ class OSExchangeData : public IDataObject { bool HasURL() const; bool HasURLTitle() const; bool HasFile() const; +#if defined(OS_WIN) bool HasFormat(CLIPFORMAT format) const; // IDataObject implementation: @@ -100,8 +116,10 @@ class OSExchangeData : public IDataObject { HRESULT __stdcall QueryInterface(const IID& iid, void** object); ULONG __stdcall AddRef(); ULONG __stdcall Release(); +#endif private: +#if defined(OS_WIN) // FormatEtcEnumerator only likes us for our StoredDataMap typedef. friend class FormatEtcEnumerator; @@ -137,8 +155,9 @@ class OSExchangeData : public IDataObject { CComPtr<IDataObject> source_object_; LONG ref_count_; +#endif - DISALLOW_EVIL_CONSTRUCTORS(OSExchangeData); + DISALLOW_COPY_AND_ASSIGN(OSExchangeData); }; #endif // #ifndef APP_OS_EXCHANGE_DATA_H_ diff --git a/app/os_exchange_data_gtk.cc b/app/os_exchange_data_gtk.cc new file mode 100644 index 0000000..b599470 --- /dev/null +++ b/app/os_exchange_data_gtk.cc @@ -0,0 +1,75 @@ +// 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. + +#include "app/os_exchange_data.h" + +#include "base/logging.h" + +OSExchangeData::OSExchangeData() { +} + +OSExchangeData::~OSExchangeData() { +} + +void OSExchangeData::SetString(const std::wstring& data) { + NOTIMPLEMENTED(); +} + +void OSExchangeData::SetURL(const GURL& url, const std::wstring& title) { + NOTIMPLEMENTED(); +} + +void OSExchangeData::SetFilename(const std::wstring& full_path) { + NOTIMPLEMENTED(); +} + +void OSExchangeData::SetFileContents(const std::wstring& filename, + const std::string& file_contents) { + NOTIMPLEMENTED(); +} + +void OSExchangeData::SetHtml(const std::wstring& html, const GURL& base_url) { + NOTIMPLEMENTED(); +} + +bool OSExchangeData::GetString(std::wstring* data) const { + NOTIMPLEMENTED(); + return false; +} + +bool OSExchangeData::GetURLAndTitle(GURL* url, std::wstring* title) const { + NOTIMPLEMENTED(); + return false; +} + +bool OSExchangeData::GetFilename(std::wstring* full_path) const { + NOTIMPLEMENTED(); + return false; +} + +bool OSExchangeData::GetFileContents(std::wstring* filename, + std::string* file_contents) const { + NOTIMPLEMENTED(); + return false; +} + +bool OSExchangeData::GetHtml(std::wstring* html, GURL* base_url) const { + NOTIMPLEMENTED(); + return false; +} + +bool OSExchangeData::HasString() const { + NOTIMPLEMENTED(); + return false; +} + +bool OSExchangeData::HasURL() const { + NOTIMPLEMENTED(); + return false; +} + +bool OSExchangeData::HasFile() const { + NOTIMPLEMENTED(); + return false; +} diff --git a/app/os_exchange_data.cc b/app/os_exchange_data_win.cc index c9e2311..c9e2311 100644 --- a/app/os_exchange_data.cc +++ b/app/os_exchange_data_win.cc diff --git a/app/os_exchange_data_unittest.cc b/app/os_exchange_data_win_unittest.cc index 13a28a9..13a28a9 100644 --- a/app/os_exchange_data_unittest.cc +++ b/app/os_exchange_data_win_unittest.cc diff --git a/build/build_config.h b/build/build_config.h index 43d36f0..a95edc5 100644 --- a/build/build_config.h +++ b/build/build_config.h @@ -25,6 +25,7 @@ #endif #elif defined(_WIN32) #define OS_WIN 1 +#define TOOLKIT_VIEWS 1 #else #error Please add support for your platform in build/build_config.h #endif diff --git a/chrome/browser/bookmarks/bookmark_drag_data.cc b/chrome/browser/bookmarks/bookmark_drag_data.cc index 4b3bdb6..c5a56ed 100644 --- a/chrome/browser/bookmarks/bookmark_drag_data.cc +++ b/chrome/browser/bookmarks/bookmark_drag_data.cc @@ -5,7 +5,7 @@ #include "chrome/browser/bookmarks/bookmark_drag_data.h" // TODO(port): Port this file. -#if defined(OS_WIN) +#if defined(TOOLKIT_VIEWS) #include "app/os_exchange_data.h" #else #include "chrome/common/temp_scaffolding_stubs.h" @@ -17,7 +17,6 @@ #include "chrome/browser/profile.h" #include "chrome/common/url_constants.h" - #if defined(OS_WIN) static CLIPFORMAT clipboard_format = 0; #endif diff --git a/chrome/browser/bookmarks/bookmark_drag_data_unittest.cc b/chrome/browser/bookmarks/bookmark_drag_data_unittest.cc index 1d1e1f2..9507196 100644 --- a/chrome/browser/bookmarks/bookmark_drag_data_unittest.cc +++ b/chrome/browser/bookmarks/bookmark_drag_data_unittest.cc @@ -22,7 +22,7 @@ TEST_F(BookmarkDragDataTest, InitialState) { TEST_F(BookmarkDragDataTest, BogusRead) { scoped_refptr<OSExchangeData> data(new OSExchangeData()); BookmarkDragData drag_data; - EXPECT_FALSE(drag_data.Read(data.get())); + EXPECT_FALSE(drag_data.Read(OSExchangeData(data.get()))); EXPECT_FALSE(drag_data.is_valid()); } @@ -36,7 +36,7 @@ TEST_F(BookmarkDragDataTest, JustURL) { data->SetURL(url, title); BookmarkDragData drag_data; - EXPECT_TRUE(drag_data.Read(data.get())); + EXPECT_TRUE(drag_data.Read(OSExchangeData(data.get()))); EXPECT_TRUE(drag_data.is_valid()); ASSERT_EQ(1, drag_data.elements.size()); EXPECT_TRUE(drag_data.elements[0].is_url); diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp index 4082664..7634269 100644 --- a/chrome/chrome.gyp +++ b/chrome/chrome.gyp @@ -202,7 +202,8 @@ '../app/l10n_util_win.cc', '../app/l10n_util_win.h', '../app/message_box_flags.h', - '../app/os_exchange_data.cc', + '../app/os_exchange_data_win.cc', + '../app/os_exchange_data_gtk.cc', '../app/os_exchange_data.h', '../app/resource_bundle.cc', '../app/resource_bundle.h', @@ -238,7 +239,14 @@ '../app/gfx/icon_util.cc', '../app/gfx/icon_util.h', '../app/os_exchange_data.cc', - '../app/os_exchange_data.h', + ], + 'conditions': [ + ['toolkit_views!="1"', { + 'sources!': [ + '../app/os_exchange_data.h', + '../app/os_exchange_data_gtk.cc', + ], + }], ], }], ], @@ -1588,7 +1596,7 @@ '../third_party/GTM', '../third_party/GTM/AppKit', ], - }], + }], ['OS=="win"', { 'defines': [ '__STD_C', diff --git a/chrome/common/temp_scaffolding_stubs.h b/chrome/common/temp_scaffolding_stubs.h index 35904d2..a5bd9b0 100644 --- a/chrome/common/temp_scaffolding_stubs.h +++ b/chrome/common/temp_scaffolding_stubs.h @@ -461,11 +461,13 @@ class FontsLanguagesWindowView { void SelectLanguagesTab() { NOTIMPLEMENTED(); } }; +#if !defined(TOOLKIT_VIEWS) class OSExchangeData { public: void SetString(const std::wstring& data) { NOTIMPLEMENTED(); } void SetURL(const GURL& url, const std::wstring& title) { NOTIMPLEMENTED(); } }; +#endif class BaseDragSource { }; diff --git a/chrome/test/unit/unittests.vcproj b/chrome/test/unit/unittests.vcproj index 025ce8b..f18b051 100644 --- a/chrome/test/unit/unittests.vcproj +++ b/chrome/test/unit/unittests.vcproj @@ -1120,7 +1120,7 @@ > </File> <File - RelativePath="..\..\..\app\os_exchange_data_unittest.cc" + RelativePath="..\..\..\app\os_exchange_data_win_unittest.cc" > </File> <File |