diff options
author | fukino <fukino@chromium.org> | 2015-01-26 17:53:34 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-01-27 01:54:33 +0000 |
commit | 99daa8e4da877ec034860c63f8564a6dc5382aed (patch) | |
tree | f18ed8d98dbd83275d68fea493901df9c353f64c /google_apis | |
parent | 5393fb5df017dcf7ef8c8e2129b62c842556f525 (diff) | |
download | chromium_src-99daa8e4da877ec034860c63f8564a6dc5382aed.zip chromium_src-99daa8e4da877ec034860c63f8564a6dc5382aed.tar.gz chromium_src-99daa8e4da877ec034860c63f8564a6dc5382aed.tar.bz2 |
Remove WAPI-related code, except the type definition of ResourceEntry.
To remove ResourceEntry completely, tests for syncFileSystem need to be modified.
I'll do it by a separate CL.
BUG=357038
TBR=rogerta@chromium.org
TBRing for removal of unused files from *.gyp and *.gn under google_api
TEST=build all targets
Review URL: https://codereview.chromium.org/861133002
Cr-Commit-Position: refs/heads/master@{#313202}
Diffstat (limited to 'google_apis')
-rw-r--r-- | google_apis/BUILD.gn | 7 | ||||
-rw-r--r-- | google_apis/drive/drive_common_callbacks.h | 12 | ||||
-rw-r--r-- | google_apis/drive/gdata_wapi_parser.cc | 545 | ||||
-rw-r--r-- | google_apis/drive/gdata_wapi_parser.h | 545 | ||||
-rw-r--r-- | google_apis/drive/gdata_wapi_parser_unittest.cc | 234 | ||||
-rw-r--r-- | google_apis/drive/gdata_wapi_requests.cc | 81 | ||||
-rw-r--r-- | google_apis/drive/gdata_wapi_requests.h | 59 | ||||
-rw-r--r-- | google_apis/drive/gdata_wapi_requests_unittest.cc | 153 | ||||
-rw-r--r-- | google_apis/drive/gdata_wapi_url_generator.cc | 69 | ||||
-rw-r--r-- | google_apis/drive/gdata_wapi_url_generator.h | 59 | ||||
-rw-r--r-- | google_apis/drive/gdata_wapi_url_generator_unittest.cc | 60 | ||||
-rw-r--r-- | google_apis/drive/test_util.cc | 1 | ||||
-rw-r--r-- | google_apis/google_apis.gyp | 7 |
13 files changed, 5 insertions, 1827 deletions
diff --git a/google_apis/BUILD.gn b/google_apis/BUILD.gn index b07feb7..cbc483a 100644 --- a/google_apis/BUILD.gn +++ b/google_apis/BUILD.gn @@ -153,12 +153,8 @@ source_set("google_apis") { "drive/drive_common_callbacks.h", "drive/gdata_errorcode.cc", "drive/gdata_errorcode.h", - "drive/gdata_wapi_requests.cc", - "drive/gdata_wapi_requests.h", "drive/gdata_wapi_parser.cc", "drive/gdata_wapi_parser.h", - "drive/gdata_wapi_url_generator.cc", - "drive/gdata_wapi_url_generator.h", "drive/request_sender.cc", "drive/request_sender.h", "drive/request_util.cc", @@ -236,9 +232,6 @@ test("google_apis_unittest") { "drive/drive_api_parser_unittest.cc", "drive/drive_api_requests_unittest.cc", "drive/drive_api_url_generator_unittest.cc", - "drive/gdata_wapi_parser_unittest.cc", - "drive/gdata_wapi_requests_unittest.cc", - "drive/gdata_wapi_url_generator_unittest.cc", "drive/request_sender_unittest.cc", "drive/request_util_unittest.cc", "drive/time_util_unittest.cc", diff --git a/google_apis/drive/drive_common_callbacks.h b/google_apis/drive/drive_common_callbacks.h index 234c531..db2a7ae 100644 --- a/google_apis/drive/drive_common_callbacks.h +++ b/google_apis/drive/drive_common_callbacks.h @@ -14,18 +14,6 @@ namespace google_apis { class AboutResource; class AppList; -class ResourceEntry; -class ResourceList; - -// Callback used for getting ResourceList. -typedef base::Callback<void(GDataErrorCode error, - scoped_ptr<ResourceList> resource_list)> - GetResourceListCallback; - -// Callback used for getting ResourceEntry. -typedef base::Callback<void(GDataErrorCode error, - scoped_ptr<ResourceEntry> entry)> - GetResourceEntryCallback; // Callback used for getting AboutResource. typedef base::Callback<void(GDataErrorCode error, diff --git a/google_apis/drive/gdata_wapi_parser.cc b/google_apis/drive/gdata_wapi_parser.cc index 83beacc..d0c6a57 100644 --- a/google_apis/drive/gdata_wapi_parser.cc +++ b/google_apis/drive/gdata_wapi_parser.cc @@ -4,560 +4,17 @@ #include "google_apis/drive/gdata_wapi_parser.h" -#include <algorithm> -#include <string> - -#include "base/basictypes.h" -#include "base/files/file_path.h" -#include "base/json/json_value_converter.h" -#include "base/memory/scoped_ptr.h" -#include "base/strings/string_number_conversions.h" -#include "base/strings/string_piece.h" -#include "base/strings/string_util.h" -#include "base/strings/utf_string_conversions.h" -#include "base/values.h" -#include "google_apis/drive/time_util.h" - -using base::Value; -using base::DictionaryValue; -using base::ListValue; - namespace google_apis { -namespace { - -// Term values for kSchemeKind category: -const char kTermPrefix[] = "http://schemas.google.com/docs/2007#"; - -// Node names. -const char kEntryNode[] = "entry"; - -// Field names. -const char kAuthorField[] = "author"; -const char kCategoryField[] = "category"; -const char kChangestampField[] = "docs$changestamp.value"; -const char kContentField[] = "content"; -const char kDeletedField[] = "gd$deleted"; -const char kETagField[] = "gd$etag"; -const char kEmailField[] = "email.$t"; -const char kEntryField[] = "entry"; -const char kFeedField[] = "feed"; -const char kFeedLinkField[] = "gd$feedLink"; -const char kFileNameField[] = "docs$filename.$t"; -const char kHrefField[] = "href"; -const char kIDField[] = "id.$t"; -const char kItemsPerPageField[] = "openSearch$itemsPerPage.$t"; -const char kLabelField[] = "label"; -const char kLargestChangestampField[] = "docs$largestChangestamp.value"; -const char kLastViewedField[] = "gd$lastViewed.$t"; -const char kLinkField[] = "link"; -const char kMD5Field[] = "docs$md5Checksum.$t"; -const char kNameField[] = "name.$t"; -const char kPublishedField[] = "published.$t"; -const char kRelField[] = "rel"; -const char kRemovedField[] = "docs$removed"; -const char kResourceIdField[] = "gd$resourceId.$t"; -const char kSchemeField[] = "scheme"; -const char kSizeField[] = "docs$size.$t"; -const char kSrcField[] = "src"; -const char kStartIndexField[] = "openSearch$startIndex.$t"; -const char kSuggestedFileNameField[] = "docs$suggestedFilename.$t"; -const char kTermField[] = "term"; -const char kTitleField[] = "title"; -const char kTitleTField[] = "title.$t"; -const char kTypeField[] = "type"; -const char kUpdatedField[] = "updated.$t"; - -// Link Prefixes -const char kOpenWithPrefix[] = "http://schemas.google.com/docs/2007#open-with-"; -const size_t kOpenWithPrefixSize = arraysize(kOpenWithPrefix) - 1; - -struct LinkTypeMap { - Link::LinkType type; - const char* rel; -}; - -const LinkTypeMap kLinkTypeMap[] = { - { Link::LINK_SELF, - "self" }, - { Link::LINK_NEXT, - "next" }, - { Link::LINK_PARENT, - "http://schemas.google.com/docs/2007#parent" }, - { Link::LINK_ALTERNATE, - "alternate"}, - { Link::LINK_EDIT, - "edit" }, - { Link::LINK_EDIT_MEDIA, - "edit-media" }, - { Link::LINK_ALT_EDIT_MEDIA, - "http://schemas.google.com/docs/2007#alt-edit-media" }, - { Link::LINK_ALT_POST, - "http://schemas.google.com/docs/2007#alt-post" }, - { Link::LINK_FEED, - "http://schemas.google.com/g/2005#feed"}, - { Link::LINK_POST, - "http://schemas.google.com/g/2005#post"}, - { Link::LINK_BATCH, - "http://schemas.google.com/g/2005#batch"}, - { Link::LINK_THUMBNAIL, - "http://schemas.google.com/docs/2007/thumbnail"}, - { Link::LINK_RESUMABLE_EDIT_MEDIA, - "http://schemas.google.com/g/2005#resumable-edit-media"}, - { Link::LINK_RESUMABLE_CREATE_MEDIA, - "http://schemas.google.com/g/2005#resumable-create-media"}, - { Link::LINK_TABLES_FEED, - "http://schemas.google.com/spreadsheets/2006#tablesfeed"}, - { Link::LINK_WORKSHEET_FEED, - "http://schemas.google.com/spreadsheets/2006#worksheetsfeed"}, - { Link::LINK_EMBED, - "http://schemas.google.com/docs/2007#embed"}, - { Link::LINK_PRODUCT, - "http://schemas.google.com/docs/2007#product"}, - { Link::LINK_ICON, - "http://schemas.google.com/docs/2007#icon"}, - { Link::LINK_SHARE, - "http://schemas.google.com/docs/2007#share"}, -}; - -struct ResourceLinkTypeMap { - ResourceLink::ResourceLinkType type; - const char* rel; -}; - -const ResourceLinkTypeMap kFeedLinkTypeMap[] = { - { ResourceLink::FEED_LINK_ACL, - "http://schemas.google.com/acl/2007#accessControlList" }, - { ResourceLink::FEED_LINK_REVISIONS, - "http://schemas.google.com/docs/2007/revisions" }, -}; - -struct CategoryTypeMap { - Category::CategoryType type; - const char* scheme; -}; - -const CategoryTypeMap kCategoryTypeMap[] = { - { Category::CATEGORY_KIND, "http://schemas.google.com/g/2005#kind" }, - { Category::CATEGORY_LABEL, "http://schemas.google.com/g/2005/labels" }, -}; - -// Converts |url_string| to |result|. Always returns true to be used -// for JSONValueConverter::RegisterCustomField method. -// TODO(mukai): make it return false in case of invalid |url_string|. -bool GetGURLFromString(const base::StringPiece& url_string, GURL* result) { - *result = GURL(url_string.as_string()); - return true; -} - -} // namespace - -//////////////////////////////////////////////////////////////////////////////// -// Author implementation - -Author::Author() { -} - -// static -void Author::RegisterJSONConverter( - base::JSONValueConverter<Author>* converter) { - converter->RegisterStringField(kNameField, &Author::name_); - converter->RegisterStringField(kEmailField, &Author::email_); -} - -//////////////////////////////////////////////////////////////////////////////// -// Link implementation - -Link::Link() : type_(Link::LINK_UNKNOWN) { -} - -Link::~Link() { -} - -// static -bool Link::GetAppID(const base::StringPiece& rel, std::string* app_id) { - DCHECK(app_id); - // Fast return path if the link clearly isn't an OPEN_WITH link. - if (rel.size() < kOpenWithPrefixSize) { - app_id->clear(); - return true; - } - - const std::string kOpenWithPrefixStr(kOpenWithPrefix); - if (StartsWithASCII(rel.as_string(), kOpenWithPrefixStr, false)) { - *app_id = rel.as_string().substr(kOpenWithPrefixStr.size()); - return true; - } - - app_id->clear(); - return true; -} - -// static. -bool Link::GetLinkType(const base::StringPiece& rel, Link::LinkType* type) { - DCHECK(type); - for (size_t i = 0; i < arraysize(kLinkTypeMap); i++) { - if (rel == kLinkTypeMap[i].rel) { - *type = kLinkTypeMap[i].type; - return true; - } - } - - // OPEN_WITH links have extra information at the end of the rel that is unique - // for each one, so we can't just check the usual map. This check is slightly - // redundant to provide a quick skip if it's obviously not an OPEN_WITH url. - if (rel.size() >= kOpenWithPrefixSize && - StartsWithASCII(rel.as_string(), kOpenWithPrefix, false)) { - *type = LINK_OPEN_WITH; - return true; - } - - // Let unknown link types through, just report it; if the link type is needed - // in the future, add it into LinkType and kLinkTypeMap. - DVLOG(1) << "Ignoring unknown link type for rel " << rel; - *type = LINK_UNKNOWN; - return true; -} - -// static -void Link::RegisterJSONConverter(base::JSONValueConverter<Link>* converter) { - converter->RegisterCustomField<Link::LinkType>(kRelField, - &Link::type_, - &Link::GetLinkType); - // We have to register kRelField twice because we extract two different pieces - // of data from the same rel field. - converter->RegisterCustomField<std::string>(kRelField, - &Link::app_id_, - &Link::GetAppID); - converter->RegisterCustomField(kHrefField, &Link::href_, &GetGURLFromString); - converter->RegisterStringField(kTitleField, &Link::title_); - converter->RegisterStringField(kTypeField, &Link::mime_type_); -} - -//////////////////////////////////////////////////////////////////////////////// -// ResourceLink implementation - -ResourceLink::ResourceLink() : type_(ResourceLink::FEED_LINK_UNKNOWN) { -} - -// static. -bool ResourceLink::GetFeedLinkType( - const base::StringPiece& rel, ResourceLink::ResourceLinkType* result) { - for (size_t i = 0; i < arraysize(kFeedLinkTypeMap); i++) { - if (rel == kFeedLinkTypeMap[i].rel) { - *result = kFeedLinkTypeMap[i].type; - return true; - } - } - DVLOG(1) << "Unknown feed link type for rel " << rel; - return false; -} - -// static -void ResourceLink::RegisterJSONConverter( - base::JSONValueConverter<ResourceLink>* converter) { - converter->RegisterCustomField<ResourceLink::ResourceLinkType>( - kRelField, &ResourceLink::type_, &ResourceLink::GetFeedLinkType); - converter->RegisterCustomField( - kHrefField, &ResourceLink::href_, &GetGURLFromString); -} - -//////////////////////////////////////////////////////////////////////////////// -// Category implementation - -Category::Category() : type_(CATEGORY_UNKNOWN) { -} - -// Converts category.scheme into CategoryType enum. -bool Category::GetCategoryTypeFromScheme( - const base::StringPiece& scheme, Category::CategoryType* result) { - for (size_t i = 0; i < arraysize(kCategoryTypeMap); i++) { - if (scheme == kCategoryTypeMap[i].scheme) { - *result = kCategoryTypeMap[i].type; - return true; - } - } - DVLOG(1) << "Unknown feed link type for scheme " << scheme; - return false; -} - -// static -void Category::RegisterJSONConverter( - base::JSONValueConverter<Category>* converter) { - converter->RegisterStringField(kLabelField, &Category::label_); - converter->RegisterCustomField<Category::CategoryType>( - kSchemeField, &Category::type_, &Category::GetCategoryTypeFromScheme); - converter->RegisterStringField(kTermField, &Category::term_); -} - -const Link* CommonMetadata::GetLinkByType(Link::LinkType type) const { - for (size_t i = 0; i < links_.size(); ++i) { - if (links_[i]->type() == type) - return links_[i]; - } - return NULL; -} - -//////////////////////////////////////////////////////////////////////////////// -// Content implementation - -Content::Content() { -} - -// static -void Content::RegisterJSONConverter( - base::JSONValueConverter<Content>* converter) { - converter->RegisterCustomField(kSrcField, &Content::url_, &GetGURLFromString); - converter->RegisterStringField(kTypeField, &Content::mime_type_); -} - -//////////////////////////////////////////////////////////////////////////////// -// CommonMetadata implementation - -CommonMetadata::CommonMetadata() { -} - -CommonMetadata::~CommonMetadata() { -} - -// static -template<typename CommonMetadataDescendant> -void CommonMetadata::RegisterJSONConverter( - base::JSONValueConverter<CommonMetadataDescendant>* converter) { - converter->RegisterStringField(kETagField, &CommonMetadata::etag_); - converter->template RegisterRepeatedMessage<Author>( - kAuthorField, &CommonMetadata::authors_); - converter->template RegisterRepeatedMessage<Link>( - kLinkField, &CommonMetadata::links_); - converter->template RegisterRepeatedMessage<Category>( - kCategoryField, &CommonMetadata::categories_); - converter->template RegisterCustomField<base::Time>( - kUpdatedField, &CommonMetadata::updated_time_, &util::GetTimeFromString); -} - //////////////////////////////////////////////////////////////////////////////// // ResourceEntry implementation ResourceEntry::ResourceEntry() : kind_(ENTRY_KIND_UNKNOWN), - file_size_(0), - deleted_(false), - removed_(false), - changestamp_(0), - image_width_(-1), - image_height_(-1), - image_rotation_(-1) { + deleted_(false) { } ResourceEntry::~ResourceEntry() { } -bool ResourceEntry::HasFieldPresent(const base::Value* value, - bool* result) { - *result = (value != NULL); - return true; -} - -bool ResourceEntry::ParseChangestamp(const base::Value* value, - int64* result) { - DCHECK(result); - if (!value) { - *result = 0; - return true; - } - - std::string string_value; - if (value->GetAsString(&string_value) && - base::StringToInt64(string_value, result)) - return true; - - return false; -} - -// static -void ResourceEntry::RegisterJSONConverter( - base::JSONValueConverter<ResourceEntry>* converter) { - // Inherit the parent registrations. - CommonMetadata::RegisterJSONConverter(converter); - converter->RegisterStringField( - kResourceIdField, &ResourceEntry::resource_id_); - converter->RegisterStringField(kIDField, &ResourceEntry::id_); - converter->RegisterStringField(kTitleTField, &ResourceEntry::title_); - converter->RegisterCustomField<base::Time>( - kPublishedField, &ResourceEntry::published_time_, - &util::GetTimeFromString); - converter->RegisterCustomField<base::Time>( - kLastViewedField, &ResourceEntry::last_viewed_time_, - &util::GetTimeFromString); - converter->RegisterRepeatedMessage( - kFeedLinkField, &ResourceEntry::resource_links_); - converter->RegisterNestedField(kContentField, &ResourceEntry::content_); - - // File properties. If the resource type is not a normal file, then - // that's no problem because those feed must not have these fields - // themselves, which does not report errors. - converter->RegisterStringField(kFileNameField, &ResourceEntry::filename_); - converter->RegisterStringField(kMD5Field, &ResourceEntry::file_md5_); - converter->RegisterCustomField<int64>( - kSizeField, &ResourceEntry::file_size_, &base::StringToInt64); - converter->RegisterStringField( - kSuggestedFileNameField, &ResourceEntry::suggested_filename_); - // Deleted are treated as 'trashed' items on web client side. Removed files - // are gone for good. We treat both cases as 'deleted' for this client. - converter->RegisterCustomValueField<bool>( - kDeletedField, &ResourceEntry::deleted_, &ResourceEntry::HasFieldPresent); - converter->RegisterCustomValueField<bool>( - kRemovedField, &ResourceEntry::removed_, &ResourceEntry::HasFieldPresent); - converter->RegisterCustomValueField<int64>( - kChangestampField, &ResourceEntry::changestamp_, - &ResourceEntry::ParseChangestamp); - // ImageMediaMetadata fields are not supported by WAPI. -} - -// static -ResourceEntry::ResourceEntryKind ResourceEntry::GetEntryKindFromTerm( - const std::string& term) { - if (!StartsWithASCII(term, kTermPrefix, false)) { - DVLOG(1) << "Unexpected term prefix term " << term; - return ENTRY_KIND_UNKNOWN; - } - - std::string type = term.substr(strlen(kTermPrefix)); - if (type == "folder") - return ENTRY_KIND_FOLDER; - if (type == "file" || type == "pdf") - return ENTRY_KIND_FILE; - - DVLOG(1) << "Unknown entry type for term " << term << ", type " << type; - return ENTRY_KIND_UNKNOWN; -} - -void ResourceEntry::FillRemainingFields() { - // Set |kind_| and |labels_| based on the |categories_| in the class. - // JSONValueConverter does not have the ability to catch an element in a list - // based on a predicate. Thus we need to iterate over |categories_| and - // find the elements to set these fields as a post-process. - for (size_t i = 0; i < categories_.size(); ++i) { - const Category* category = categories_[i]; - if (category->type() == Category::CATEGORY_KIND) - kind_ = GetEntryKindFromTerm(category->term()); - else if (category->type() == Category::CATEGORY_LABEL) - labels_.push_back(category->label()); - } -} - -// static -scoped_ptr<ResourceEntry> ResourceEntry::ExtractAndParse( - const base::Value& value) { - const base::DictionaryValue* as_dict = NULL; - const base::DictionaryValue* entry_dict = NULL; - if (value.GetAsDictionary(&as_dict) && - as_dict->GetDictionary(kEntryField, &entry_dict)) { - return ResourceEntry::CreateFrom(*entry_dict); - } - return scoped_ptr<ResourceEntry>(); -} - -// static -scoped_ptr<ResourceEntry> ResourceEntry::CreateFrom(const base::Value& value) { - base::JSONValueConverter<ResourceEntry> converter; - scoped_ptr<ResourceEntry> entry(new ResourceEntry()); - if (!converter.Convert(value, entry.get())) { - DVLOG(1) << "Invalid resource entry!"; - return scoped_ptr<ResourceEntry>(); - } - - entry->FillRemainingFields(); - return entry.Pass(); -} - -// static -std::string ResourceEntry::GetEntryNodeName() { - return kEntryNode; -} - -//////////////////////////////////////////////////////////////////////////////// -// ResourceList implementation - -ResourceList::ResourceList() - : start_index_(0), - items_per_page_(0), - largest_changestamp_(0) { -} - -ResourceList::~ResourceList() { -} - -// static -void ResourceList::RegisterJSONConverter( - base::JSONValueConverter<ResourceList>* converter) { - // inheritance - CommonMetadata::RegisterJSONConverter(converter); - // TODO(zelidrag): Once we figure out where these will be used, we should - // check for valid start_index_ and items_per_page_ values. - converter->RegisterCustomField<int>( - kStartIndexField, &ResourceList::start_index_, &base::StringToInt); - converter->RegisterCustomField<int>( - kItemsPerPageField, &ResourceList::items_per_page_, &base::StringToInt); - converter->RegisterStringField(kTitleTField, &ResourceList::title_); - converter->RegisterRepeatedMessage(kEntryField, &ResourceList::entries_); - converter->RegisterCustomField<int64>( - kLargestChangestampField, &ResourceList::largest_changestamp_, - &base::StringToInt64); -} - -bool ResourceList::Parse(const base::Value& value) { - base::JSONValueConverter<ResourceList> converter; - if (!converter.Convert(value, this)) { - DVLOG(1) << "Invalid resource list!"; - return false; - } - - ScopedVector<ResourceEntry>::iterator iter = entries_.begin(); - while (iter != entries_.end()) { - ResourceEntry* entry = (*iter); - entry->FillRemainingFields(); - ++iter; - } - return true; -} - -// static -scoped_ptr<ResourceList> ResourceList::ExtractAndParse( - const base::Value& value) { - const base::DictionaryValue* as_dict = NULL; - const base::DictionaryValue* feed_dict = NULL; - if (value.GetAsDictionary(&as_dict) && - as_dict->GetDictionary(kFeedField, &feed_dict)) { - return ResourceList::CreateFrom(*feed_dict); - } - return scoped_ptr<ResourceList>(); -} - -// static -scoped_ptr<ResourceList> ResourceList::CreateFrom(const base::Value& value) { - scoped_ptr<ResourceList> feed(new ResourceList()); - if (!feed->Parse(value)) { - DVLOG(1) << "Invalid resource list!"; - return scoped_ptr<ResourceList>(); - } - - return feed.Pass(); -} - -bool ResourceList::GetNextFeedURL(GURL* url) const { - DCHECK(url); - for (size_t i = 0; i < links_.size(); ++i) { - if (links_[i]->type() == Link::LINK_NEXT) { - *url = links_[i]->href(); - return true; - } - } - return false; -} - -void ResourceList::ReleaseEntries(std::vector<ResourceEntry*>* entries) { - entries_.release(entries); -} - } // namespace google_apis diff --git a/google_apis/drive/gdata_wapi_parser.h b/google_apis/drive/gdata_wapi_parser.h index 5d2ec50..2ba79b6 100644 --- a/google_apis/drive/gdata_wapi_parser.h +++ b/google_apis/drive/gdata_wapi_parser.h @@ -6,310 +6,16 @@ #define GOOGLE_APIS_DRIVE_GDATA_WAPI_PARSER_H_ #include <string> -#include <utility> -#include <vector> -#include "base/compiler_specific.h" -#include "base/memory/scoped_ptr.h" -#include "base/memory/scoped_vector.h" -#include "base/strings/string_piece.h" -#include "base/time/time.h" -#include "url/gurl.h" - -namespace base { -class FilePath; -class DictionaryValue; -class Value; - -template <class StructType> -class JSONValueConverter; - -namespace internal { -template <class NestedType> -class RepeatedMessageConverter; -} // namespace internal - -} // namespace base +#include "base/macros.h" // Defines data elements of Google Documents API as described in // http://code.google.com/apis/documents/. namespace google_apis { -// Defines link (URL) of an entity (document, file, feed...). Each entity could -// have more than one link representing it. -class Link { - public: - enum LinkType { - LINK_UNKNOWN, - LINK_SELF, - LINK_NEXT, - LINK_PARENT, - LINK_ALTERNATE, - LINK_EDIT, - LINK_EDIT_MEDIA, - LINK_ALT_EDIT_MEDIA, - LINK_ALT_POST, - LINK_FEED, - LINK_POST, - LINK_BATCH, - LINK_RESUMABLE_EDIT_MEDIA, - LINK_RESUMABLE_CREATE_MEDIA, - LINK_TABLES_FEED, - LINK_WORKSHEET_FEED, - LINK_THUMBNAIL, - LINK_EMBED, - LINK_PRODUCT, - LINK_ICON, - LINK_OPEN_WITH, - LINK_SHARE, - }; - Link(); - ~Link(); - - // Registers the mapping between JSON field names and the members in - // this class. - static void RegisterJSONConverter(base::JSONValueConverter<Link>* converter); - - // Type of the link. - LinkType type() const { return type_; } - - // URL of the link. - const GURL& href() const { return href_; } - - // Title of the link. - const std::string& title() const { return title_; } - - // For OPEN_WITH links, this contains the application ID. For all other link - // types, it is the empty string. - const std::string& app_id() const { return app_id_; } - - // Link MIME type. - const std::string& mime_type() const { return mime_type_; } - - void set_type(LinkType type) { type_ = type; } - void set_href(const GURL& href) { href_ = href; } - void set_title(const std::string& title) { title_ = title; } - void set_app_id(const std::string& app_id) { app_id_ = app_id; } - void set_mime_type(const std::string& mime_type) { mime_type_ = mime_type; } - - private: - friend class ResourceEntry; - // Converts value of link.rel into LinkType. Outputs to |type| and returns - // true when |rel| has a valid value. Otherwise does nothing and returns - // false. - static bool GetLinkType(const base::StringPiece& rel, LinkType* type); - - // Converts value of link.rel to application ID, if there is one embedded in - // the link.rel field. Outputs to |app_id| and returns true when |rel| has a - // valid value. Otherwise does nothing and returns false. - static bool GetAppID(const base::StringPiece& rel, std::string* app_id); - - LinkType type_; - GURL href_; - std::string title_; - std::string app_id_; - std::string mime_type_; - - DISALLOW_COPY_AND_ASSIGN(Link); -}; - -// Feed links define links (URLs) to special list of entries (i.e. list of -// previous document revisions). -class ResourceLink { - public: - enum ResourceLinkType { - FEED_LINK_UNKNOWN, - FEED_LINK_ACL, - FEED_LINK_REVISIONS, - }; - ResourceLink(); - - // Registers the mapping between JSON field names and the members in - // this class. - static void RegisterJSONConverter( - base::JSONValueConverter<ResourceLink>* converter); - - // MIME type of the feed. - ResourceLinkType type() const { return type_; } - - // URL of the feed. - const GURL& href() const { return href_; } - - void set_type(ResourceLinkType type) { type_ = type; } - void set_href(const GURL& href) { href_ = href; } - - private: - friend class ResourceEntry; - // Converts value of gd$feedLink.rel into ResourceLinkType enum. - // Outputs to |result| and returns true when |rel| has a valid - // value. Otherwise does nothing and returns false. - static bool GetFeedLinkType( - const base::StringPiece& rel, ResourceLinkType* result); - - ResourceLinkType type_; - GURL href_; - - DISALLOW_COPY_AND_ASSIGN(ResourceLink); -}; - -// Author represents an author of an entity. -class Author { - public: - Author(); - - // Registers the mapping between JSON field names and the members in - // this class. - static void RegisterJSONConverter( - base::JSONValueConverter<Author>* converter); - - // Getters. - const std::string& name() const { return name_; } - const std::string& email() const { return email_; } - - void set_name(const std::string& name) { name_ = name; } - void set_email(const std::string& email) { email_ = email; } - - private: - friend class ResourceEntry; - - std::string name_; - std::string email_; - - DISALLOW_COPY_AND_ASSIGN(Author); -}; - -// Entry category. -class Category { - public: - enum CategoryType { - CATEGORY_UNKNOWN, - CATEGORY_ITEM, - CATEGORY_KIND, - CATEGORY_LABEL, - }; - - Category(); - - // Registers the mapping between JSON field names and the members in - // this class. - static void RegisterJSONConverter( - base::JSONValueConverter<Category>* converter); - - // Category label. - const std::string& label() const { return label_; } - - // Category type. - CategoryType type() const { return type_; } - - // Category term. - const std::string& term() const { return term_; } - - void set_label(const std::string& label) { label_ = label; } - void set_type(CategoryType type) { type_ = type; } - void set_term(const std::string& term) { term_ = term; } - - private: - friend class ResourceEntry; - // Converts category scheme into CategoryType enum. For example, - // http://schemas.google.com/g/2005#kind => Category::CATEGORY_KIND - // Returns false and does not change |result| when |scheme| has an - // unrecognizable value. - static bool GetCategoryTypeFromScheme( - const base::StringPiece& scheme, CategoryType* result); - - std::string label_; - CategoryType type_; - std::string term_; - - DISALLOW_COPY_AND_ASSIGN(Category); -}; - -// Content details of a resource: mime-type, url, and so on. -class Content { - public: - Content(); - - // Registers the mapping between JSON field names and the members in - // this class. - static void RegisterJSONConverter( - base::JSONValueConverter<Content>* converter); - - // The URL to download the file content. - // Note that the url can expire, so we'll fetch the latest resource - // entry before starting a download to get the download URL. - const GURL& url() const { return url_; } - const std::string& mime_type() const { return mime_type_; } - - void set_url(const GURL& url) { url_ = url; } - void set_mime_type(const std::string& mime_type) { mime_type_ = mime_type; } - - private: - friend class ResourceEntry; - - GURL url_; - std::string mime_type_; -}; - -// Base class for feed entries. This class defines fields commonly used by -// various feeds. -class CommonMetadata { - public: - CommonMetadata(); - virtual ~CommonMetadata(); - - // Returns a link of a given |type| for this entry. If not found, it returns - // NULL. - const Link* GetLinkByType(Link::LinkType type) const; - - // Entry update time. - base::Time updated_time() const { return updated_time_; } - - // Entry ETag. - const std::string& etag() const { return etag_; } - - // List of entry authors. - const ScopedVector<Author>& authors() const { return authors_; } - - // List of entry links. - const ScopedVector<Link>& links() const { return links_; } - ScopedVector<Link>* mutable_links() { return &links_; } - - // List of entry categories. - const ScopedVector<Category>& categories() const { return categories_; } - - void set_etag(const std::string& etag) { etag_ = etag; } - void set_authors(ScopedVector<Author> authors) { - authors_ = authors.Pass(); - } - void set_links(ScopedVector<Link> links) { - links_ = links.Pass(); - } - void set_categories(ScopedVector<Category> categories) { - categories_ = categories.Pass(); - } - void set_updated_time(const base::Time& updated_time) { - updated_time_ = updated_time; - } - - protected: - // Registers the mapping between JSON field names and the members in - // this class. - template<typename CommonMetadataDescendant> - static void RegisterJSONConverter( - base::JSONValueConverter<CommonMetadataDescendant>* converter); - - std::string etag_; - ScopedVector<Author> authors_; - ScopedVector<Link> links_; - ScopedVector<Category> categories_; - base::Time updated_time_; - - DISALLOW_COPY_AND_ASSIGN(CommonMetadata); -}; - // This class represents a resource entry. A resource is a generic term which // refers to a file and a directory. -class ResourceEntry : public CommonMetadata { +class ResourceEntry { public: enum ResourceEntryKind { ENTRY_KIND_UNKNOWN, @@ -317,110 +23,17 @@ class ResourceEntry : public CommonMetadata { ENTRY_KIND_FILE }; ResourceEntry(); - ~ResourceEntry() override; - - // Extracts "entry" dictionary from the JSON value, and parse the contents, - // using CreateFrom(). Returns NULL on failure. The input JSON data, coming - // from the gdata server, looks like: - // - // { - // "encoding": "UTF-8", - // "entry": { ... }, // This function will extract this and parse. - // "version": "1.0" - // } - // - // The caller should delete the returned object. - static scoped_ptr<ResourceEntry> ExtractAndParse(const base::Value& value); - - // Creates resource entry from parsed JSON Value. You should call - // this instead of instantiating JSONValueConverter by yourself - // because this method does some post-process for some fields. See - // FillRemainingFields comment and implementation for the details. - static scoped_ptr<ResourceEntry> CreateFrom(const base::Value& value); - - // Returns name of entry node. - static std::string GetEntryNodeName(); - - // Registers the mapping between JSON field names and the members in - // this class. - static void RegisterJSONConverter( - base::JSONValueConverter<ResourceEntry>* converter); - - // Sets true to |result| if the field exists. - // Always returns true even when the field does not exist. - static bool HasFieldPresent(const base::Value* value, bool* result); - - // Parses |value| as int64 and sets it to |result|. If the field does not - // exist, sets 0 to |result| as default value. - // Returns true if |value| is NULL or it is parsed as int64 successfully. - static bool ParseChangestamp(const base::Value* value, int64* result); + ~ResourceEntry(); // The resource ID is used to identify a resource, which looks like: // file:d41d8cd98f00b204e9800998ecf8 const std::string& resource_id() const { return resource_id_; } - // This is a URL looks like: - // https://docs.google.com/feeds/id/file%3Ad41d8cd98f00b204e9800998ecf8. - // The URL is currently not used. - const std::string& id() const { return id_; } - ResourceEntryKind kind() const { return kind_; } const std::string& title() const { return title_; } - base::Time published_time() const { return published_time_; } - base::Time last_viewed_time() const { return last_viewed_time_; } - const std::vector<std::string>& labels() const { return labels_; } - - // The URL to download a file content. - // Search for 'download_url' in gdata_wapi_requests.h for details. - const GURL& download_url() const { return content_.url(); } - - const std::string& content_mime_type() const { return content_.mime_type(); } - - // The resource links contain extra links for revisions and access control, - // etc. Note that links() contain more basic links like edit URL, - // alternative URL, etc. - const ScopedVector<ResourceLink>& resource_links() const { - return resource_links_; - } - - // File name (exists only for kinds FILE and PDF). - const std::string& filename() const { return filename_; } - - // Suggested file name (exists only for kinds FILE and PDF). - const std::string& suggested_filename() const { return suggested_filename_; } - - // File content MD5 (exists only for kinds FILE and PDF). - const std::string& file_md5() const { return file_md5_; } - - // File size (exists only for kinds FILE and PDF). - int64 file_size() const { return file_size_; } // True if the file or directory is deleted (applicable to change list only). - bool deleted() const { return deleted_ || removed_; } - - // Changestamp (exists only for change query results). - // If not exists, defaults to 0. - int64 changestamp() const { return changestamp_; } - - // Image width (exists only for images). - // If doesn't exist, then equals -1. - int64 image_width() const { return image_width_; } - - // Image height (exists only for images). - // If doesn't exist, then equals -1. - int64 image_height() const { return image_height_; } - - // Image rotation in clockwise degrees (exists only for images). - // If doesn't exist, then equals -1. - int64 image_rotation() const { return image_rotation_; } - - // The time of this modification. - // Note: This property is filled only when converted from ChangeResource. - const base::Time& modification_date() const { return modification_date_; } - - // Text version of resource entry kind. Returns an empty string for - // unknown entry kind. - std::string GetEntryKindText() const; + bool deleted() const { return deleted_; } // True if resource entry is a folder (collection). bool is_folder() const { @@ -434,169 +47,19 @@ class ResourceEntry : public CommonMetadata { void set_resource_id(const std::string& resource_id) { resource_id_ = resource_id; } - void set_id(const std::string& id) { id_ = id; } void set_kind(ResourceEntryKind kind) { kind_ = kind; } void set_title(const std::string& title) { title_ = title; } - void set_published_time(const base::Time& published_time) { - published_time_ = published_time; - } - void set_last_viewed_time(const base::Time& last_viewed_time) { - last_viewed_time_ = last_viewed_time; - } - void set_labels(const std::vector<std::string>& labels) { - labels_ = labels; - } - void set_content(const Content& content) { - content_ = content; - } - void set_resource_links(ScopedVector<ResourceLink> resource_links) { - resource_links_ = resource_links.Pass(); - } - void set_filename(const std::string& filename) { filename_ = filename; } - void set_suggested_filename(const std::string& suggested_filename) { - suggested_filename_ = suggested_filename; - } - void set_file_md5(const std::string& file_md5) { file_md5_ = file_md5; } - void set_file_size(int64 file_size) { file_size_ = file_size; } void set_deleted(bool deleted) { deleted_ = deleted; } - void set_removed(bool removed) { removed_ = removed; } - void set_changestamp(int64 changestamp) { changestamp_ = changestamp; } - void set_image_width(int64 image_width) { image_width_ = image_width; } - void set_image_height(int64 image_height) { image_height_ = image_height; } - void set_image_rotation(int64 image_rotation) { - image_rotation_ = image_rotation; - } - void set_modification_date(const base::Time& modification_date) { - modification_date_ = modification_date; - } - - // Fills the remaining fields where JSONValueConverter cannot catch. - // Currently, sets |kind_| and |labels_| based on the |categories_| in the - // class. - void FillRemainingFields(); private: - friend class base::internal::RepeatedMessageConverter<ResourceEntry>; - friend class ResourceList; - friend class ResumeUploadRequest; - - // Converts categories.term into ResourceEntryKind enum. - static ResourceEntryKind GetEntryKindFromTerm(const std::string& term); - std::string resource_id_; - std::string id_; ResourceEntryKind kind_; std::string title_; - base::Time published_time_; - // Last viewed value may be unreliable. See: crbug.com/152628. - base::Time last_viewed_time_; - std::vector<std::string> labels_; - Content content_; - ScopedVector<ResourceLink> resource_links_; - // Optional fields for files only. - std::string filename_; - std::string suggested_filename_; - std::string file_md5_; - int64 file_size_; bool deleted_; - bool removed_; - int64 changestamp_; - int64 image_width_; - int64 image_height_; - int64 image_rotation_; - - base::Time modification_date_; DISALLOW_COPY_AND_ASSIGN(ResourceEntry); }; -// This class represents a list of resource entries with some extra metadata -// such as the root upload URL. The feed is paginated and the rest of the -// feed can be fetched by retrieving the remaining parts of the feed from -// URLs provided by GetNextFeedURL() method. -class ResourceList : public CommonMetadata { - public: - ResourceList(); - ~ResourceList() override; - - // Extracts "feed" dictionary from the JSON value, and parse the contents, - // using CreateFrom(). Returns NULL on failure. The input JSON data, coming - // from the gdata server, looks like: - // - // { - // "encoding": "UTF-8", - // "feed": { ... }, // This function will extract this and parse. - // "version": "1.0" - // } - static scoped_ptr<ResourceList> ExtractAndParse(const base::Value& value); - - // Creates feed from parsed JSON Value. You should call this - // instead of instantiating JSONValueConverter by yourself because - // this method does some post-process for some fields. See - // FillRemainingFields comment and implementation in ResourceEntry - // class for the details. - static scoped_ptr<ResourceList> CreateFrom(const base::Value& value); - - // Registers the mapping between JSON field names and the members in - // this class. - static void RegisterJSONConverter( - base::JSONValueConverter<ResourceList>* converter); - - // Returns true and passes|url| of the next feed if the current entry list - // does not completed this feed. - bool GetNextFeedURL(GURL* url) const; - - // List of resource entries. - const ScopedVector<ResourceEntry>& entries() const { return entries_; } - ScopedVector<ResourceEntry>* mutable_entries() { return &entries_; } - - // Releases entries_ into |entries|. This is a transfer of ownership, so the - // caller is responsible for deleting the elements of |entries|. - void ReleaseEntries(std::vector<ResourceEntry*>* entries); - - // Start index of the resource entry list. - int start_index() const { return start_index_; } - - // Number of items per feed of the resource entry list. - int items_per_page() const { return items_per_page_; } - - // The largest changestamp. Next time the resource list should be fetched - // from this changestamp. - int64 largest_changestamp() const { return largest_changestamp_; } - - // Resource entry list title. - const std::string& title() { return title_; } - - void set_entries(ScopedVector<ResourceEntry> entries) { - entries_ = entries.Pass(); - } - void set_start_index(int start_index) { - start_index_ = start_index; - } - void set_items_per_page(int items_per_page) { - items_per_page_ = items_per_page; - } - void set_title(const std::string& title) { - title_ = title; - } - void set_largest_changestamp(int64 largest_changestamp) { - largest_changestamp_ = largest_changestamp; - } - - private: - // Parses and initializes data members from content of |value|. - // Return false if parsing fails. - bool Parse(const base::Value& value); - - ScopedVector<ResourceEntry> entries_; - int start_index_; - int items_per_page_; - std::string title_; - int64 largest_changestamp_; - - DISALLOW_COPY_AND_ASSIGN(ResourceList); -}; - } // namespace google_apis #endif // GOOGLE_APIS_DRIVE_GDATA_WAPI_PARSER_H_ diff --git a/google_apis/drive/gdata_wapi_parser_unittest.cc b/google_apis/drive/gdata_wapi_parser_unittest.cc deleted file mode 100644 index fd15a95..0000000 --- a/google_apis/drive/gdata_wapi_parser_unittest.cc +++ /dev/null @@ -1,234 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "google_apis/drive/gdata_wapi_parser.h" - -#include <string> - -#include "base/json/json_file_value_serializer.h" -#include "base/time/time.h" -#include "base/values.h" -#include "google_apis/drive/test_util.h" -#include "google_apis/drive/time_util.h" -#include "testing/gtest/include/gtest/gtest.h" - -namespace google_apis { - -// Test document feed parsing. -TEST(GDataWAPIParserTest, ResourceListJsonParser) { - std::string error; - scoped_ptr<base::Value> document = - test_util::LoadJSONFile("gdata/basic_feed.json"); - ASSERT_TRUE(document.get()); - ASSERT_EQ(base::Value::TYPE_DICTIONARY, document->GetType()); - scoped_ptr<ResourceList> feed(ResourceList::ExtractAndParse(*document)); - ASSERT_TRUE(feed.get()); - - base::Time update_time; - ASSERT_TRUE(util::GetTimeFromString("2011-12-14T01:03:21.151Z", - &update_time)); - - EXPECT_EQ(1, feed->start_index()); - EXPECT_EQ(1000, feed->items_per_page()); - EXPECT_EQ(update_time, feed->updated_time()); - - // Check authors. - ASSERT_EQ(1U, feed->authors().size()); - EXPECT_EQ("tester", feed->authors()[0]->name()); - EXPECT_EQ("tester@testing.com", feed->authors()[0]->email()); - - // Check links. - ASSERT_EQ(6U, feed->links().size()); - const Link* self_link = feed->GetLinkByType(Link::LINK_SELF); - ASSERT_TRUE(self_link); - EXPECT_EQ("https://self_link/", self_link->href().spec()); - EXPECT_EQ("application/atom+xml", self_link->mime_type()); - - const Link* resumable_link = - feed->GetLinkByType(Link::LINK_RESUMABLE_CREATE_MEDIA); - ASSERT_TRUE(resumable_link); - EXPECT_EQ("https://resumable_create_media_link/", - resumable_link->href().spec()); - EXPECT_EQ("application/atom+xml", resumable_link->mime_type()); - - // Check entries. - ASSERT_EQ(4U, feed->entries().size()); - - // Check a folder entry. - const ResourceEntry* folder_entry = feed->entries()[0]; - ASSERT_TRUE(folder_entry); - EXPECT_EQ(ResourceEntry::ENTRY_KIND_FOLDER, folder_entry->kind()); - EXPECT_EQ("\"HhMOFgcNHSt7ImBr\"", folder_entry->etag()); - EXPECT_EQ("folder:sub_sub_directory_folder_id", folder_entry->resource_id()); - EXPECT_EQ("https://1_folder_id", folder_entry->id()); - EXPECT_EQ("Entry 1 Title", folder_entry->title()); - base::Time entry1_update_time; - base::Time entry1_publish_time; - ASSERT_TRUE(util::GetTimeFromString("2011-04-01T18:34:08.234Z", - &entry1_update_time)); - ASSERT_TRUE(util::GetTimeFromString("2010-11-07T05:03:54.719Z", - &entry1_publish_time)); - EXPECT_EQ(entry1_update_time, folder_entry->updated_time()); - EXPECT_EQ(entry1_publish_time, folder_entry->published_time()); - - ASSERT_EQ(1U, folder_entry->authors().size()); - EXPECT_EQ("entry_tester", folder_entry->authors()[0]->name()); - EXPECT_EQ("entry_tester@testing.com", folder_entry->authors()[0]->email()); - EXPECT_EQ("https://1_folder_content_url/", - folder_entry->download_url().spec()); - EXPECT_EQ("application/atom+xml;type=feed", - folder_entry->content_mime_type()); - - ASSERT_EQ(1U, folder_entry->resource_links().size()); - const ResourceLink* feed_link = folder_entry->resource_links()[0]; - ASSERT_TRUE(feed_link); - ASSERT_EQ(ResourceLink::FEED_LINK_ACL, feed_link->type()); - - const Link* entry1_alternate_link = - folder_entry->GetLinkByType(Link::LINK_ALTERNATE); - ASSERT_TRUE(entry1_alternate_link); - EXPECT_EQ("https://1_folder_alternate_link/", - entry1_alternate_link->href().spec()); - EXPECT_EQ("text/html", entry1_alternate_link->mime_type()); - - const Link* entry1_edit_link = folder_entry->GetLinkByType(Link::LINK_EDIT); - ASSERT_TRUE(entry1_edit_link); - EXPECT_EQ("https://1_edit_link/", entry1_edit_link->href().spec()); - EXPECT_EQ("application/atom+xml", entry1_edit_link->mime_type()); - - // Check a file entry. - const ResourceEntry* file_entry = feed->entries()[1]; - ASSERT_TRUE(file_entry); - EXPECT_EQ(ResourceEntry::ENTRY_KIND_FILE, file_entry->kind()); - EXPECT_EQ("filename.m4a", file_entry->filename()); - EXPECT_EQ("sugg_file_name.m4a", file_entry->suggested_filename()); - EXPECT_EQ("3b4382ebefec6e743578c76bbd0575ce", file_entry->file_md5()); - EXPECT_EQ(892721, file_entry->file_size()); - const Link* file_parent_link = file_entry->GetLinkByType(Link::LINK_PARENT); - ASSERT_TRUE(file_parent_link); - EXPECT_EQ("https://file_link_parent/", file_parent_link->href().spec()); - EXPECT_EQ("application/atom+xml", file_parent_link->mime_type()); - EXPECT_EQ("Medical", file_parent_link->title()); - const Link* file_open_with_link = - file_entry->GetLinkByType(Link::LINK_OPEN_WITH); - ASSERT_TRUE(file_open_with_link); - EXPECT_EQ("https://xml_file_entry_open_with_link/", - file_open_with_link->href().spec()); - EXPECT_EQ("application/atom+xml", file_open_with_link->mime_type()); - EXPECT_EQ("the_app_id", file_open_with_link->app_id()); - EXPECT_EQ(654321, file_entry->changestamp()); - - const Link* file_unknown_link = file_entry->GetLinkByType(Link::LINK_UNKNOWN); - ASSERT_TRUE(file_unknown_link); - EXPECT_EQ("https://xml_file_fake_entry_open_with_link/", - file_unknown_link->href().spec()); - EXPECT_EQ("application/atom+xml", file_unknown_link->mime_type()); - EXPECT_EQ("", file_unknown_link->app_id()); - - // Check a file entry. - const ResourceEntry* resource_entry = feed->entries()[2]; - ASSERT_TRUE(resource_entry); - // Hosted documents are treated as unknown kind so that sync file system - // doesn't assume them as neither folders nor normal files. - EXPECT_EQ(ResourceEntry::ENTRY_KIND_UNKNOWN, resource_entry->kind()); - - // Check an external document entry. - const ResourceEntry* app_entry = feed->entries()[3]; - ASSERT_TRUE(app_entry); - // Hosted documents are treated as unknown kind so that sync file system - // doesn't assume them as neither folders nor normal files. - EXPECT_EQ(ResourceEntry::ENTRY_KIND_UNKNOWN, app_entry->kind()); -} - - -// Test document feed parsing. -TEST(GDataWAPIParserTest, ResourceEntryJsonParser) { - std::string error; - scoped_ptr<base::Value> document = - test_util::LoadJSONFile("gdata/file_entry.json"); - ASSERT_TRUE(document.get()); - ASSERT_EQ(base::Value::TYPE_DICTIONARY, document->GetType()); - scoped_ptr<ResourceEntry> entry(ResourceEntry::ExtractAndParse(*document)); - ASSERT_TRUE(entry.get()); - - EXPECT_EQ(ResourceEntry::ENTRY_KIND_FILE, entry->kind()); - EXPECT_EQ("\"HhMOFgxXHit7ImBr\"", entry->etag()); - EXPECT_EQ("file:2_file_resource_id", entry->resource_id()); - EXPECT_EQ("2_file_id", entry->id()); - EXPECT_EQ("File 1.mp3", entry->title()); - base::Time entry1_update_time; - base::Time entry1_publish_time; - ASSERT_TRUE(util::GetTimeFromString("2011-12-14T00:40:47.330Z", - &entry1_update_time)); - ASSERT_TRUE(util::GetTimeFromString("2011-12-13T00:40:47.330Z", - &entry1_publish_time)); - EXPECT_EQ(entry1_update_time, entry->updated_time()); - EXPECT_EQ(entry1_publish_time, entry->published_time()); - - EXPECT_EQ(1U, entry->authors().size()); - EXPECT_EQ("tester", entry->authors()[0]->name()); - EXPECT_EQ("tester@testing.com", entry->authors()[0]->email()); - EXPECT_EQ("https://file_content_url/", - entry->download_url().spec()); - EXPECT_EQ("audio/mpeg", - entry->content_mime_type()); - - // Check feed links. - ASSERT_EQ(1U, entry->resource_links().size()); - const ResourceLink* feed_link_1 = entry->resource_links()[0]; - ASSERT_TRUE(feed_link_1); - EXPECT_EQ(ResourceLink::FEED_LINK_REVISIONS, feed_link_1->type()); - - // Check links. - ASSERT_EQ(8U, entry->links().size()); - const Link* entry1_alternate_link = - entry->GetLinkByType(Link::LINK_ALTERNATE); - ASSERT_TRUE(entry1_alternate_link); - EXPECT_EQ("https://file_link_alternate/", - entry1_alternate_link->href().spec()); - EXPECT_EQ("text/html", entry1_alternate_link->mime_type()); - - const Link* entry1_edit_link = entry->GetLinkByType(Link::LINK_EDIT_MEDIA); - ASSERT_TRUE(entry1_edit_link); - EXPECT_EQ("https://file_edit_media/", - entry1_edit_link->href().spec()); - EXPECT_EQ("audio/mpeg", entry1_edit_link->mime_type()); - - const Link* entry1_self_link = entry->GetLinkByType(Link::LINK_SELF); - ASSERT_TRUE(entry1_self_link); - EXPECT_EQ("https://file1_link_self/file%3A2_file_resource_id", - entry1_self_link->href().spec()); - EXPECT_EQ("application/atom+xml", entry1_self_link->mime_type()); - EXPECT_EQ("", entry1_self_link->app_id()); - - const Link* entry1_open_with_link = - entry->GetLinkByType(Link::LINK_OPEN_WITH); - ASSERT_TRUE(entry1_open_with_link); - EXPECT_EQ("https://entry1_open_with_link/", - entry1_open_with_link->href().spec()); - EXPECT_EQ("application/atom+xml", entry1_open_with_link->mime_type()); - EXPECT_EQ("the_app_id", entry1_open_with_link->app_id()); - - const Link* entry1_unknown_link = entry->GetLinkByType(Link::LINK_UNKNOWN); - ASSERT_TRUE(entry1_unknown_link); - EXPECT_EQ("https://entry1_fake_entry_open_with_link/", - entry1_unknown_link->href().spec()); - EXPECT_EQ("application/atom+xml", entry1_unknown_link->mime_type()); - EXPECT_EQ("", entry1_unknown_link->app_id()); - - // Check a file properties. - EXPECT_EQ(ResourceEntry::ENTRY_KIND_FILE, entry->kind()); - EXPECT_EQ("File 1.mp3", entry->filename()); - EXPECT_EQ("File 1.mp3", entry->suggested_filename()); - EXPECT_EQ("3b4382ebefec6e743578c76bbd0575ce", entry->file_md5()); - EXPECT_EQ(892721, entry->file_size()); - - // WAPI doesn't provide image metadata, but these fields are available - // since this class can wrap data received from Drive API (via a converter). - EXPECT_EQ(-1, entry->image_width()); - EXPECT_EQ(-1, entry->image_height()); - EXPECT_EQ(-1, entry->image_rotation()); -} - -} // namespace google_apis diff --git a/google_apis/drive/gdata_wapi_requests.cc b/google_apis/drive/gdata_wapi_requests.cc deleted file mode 100644 index 7c3e532..0000000 --- a/google_apis/drive/gdata_wapi_requests.cc +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "google_apis/drive/gdata_wapi_requests.h" - -#include "base/location.h" -#include "base/sequenced_task_runner.h" -#include "base/task_runner_util.h" -#include "base/values.h" -#include "google_apis/drive/gdata_wapi_parser.h" -#include "google_apis/drive/gdata_wapi_url_generator.h" - -namespace google_apis { - -namespace { - -scoped_ptr<ResourceEntry> ParseResourceEntry(const std::string& json) { - scoped_ptr<base::Value> value = ParseJson(json); - return value ? ResourceEntry::ExtractAndParse(*value) : - scoped_ptr<ResourceEntry>(); -} - -} // namespace - -GetResourceEntryRequest::GetResourceEntryRequest( - RequestSender* sender, - const GDataWapiUrlGenerator& url_generator, - const std::string& resource_id, - const GURL& embed_origin, - const GetResourceEntryCallback& callback) - : UrlFetchRequestBase(sender), - url_generator_(url_generator), - resource_id_(resource_id), - embed_origin_(embed_origin), - callback_(callback), - weak_ptr_factory_(this) { - DCHECK(!callback.is_null()); -} - -GetResourceEntryRequest::~GetResourceEntryRequest() {} - -GURL GetResourceEntryRequest::GetURL() const { - return url_generator_.GenerateEditUrlWithEmbedOrigin( - resource_id_, embed_origin_); -} - -void GetResourceEntryRequest::ProcessURLFetchResults( - const net::URLFetcher* source) { - GDataErrorCode error = GetErrorCode(); - switch (error) { - case HTTP_SUCCESS: - case HTTP_CREATED: - base::PostTaskAndReplyWithResult( - blocking_task_runner(), - FROM_HERE, - base::Bind(&ParseResourceEntry, response_writer()->data()), - base::Bind(&GetResourceEntryRequest::OnDataParsed, - weak_ptr_factory_.GetWeakPtr(), error)); - break; - default: - RunCallbackOnPrematureFailure(error); - OnProcessURLFetchResultsComplete(); - break; - } -} - -void GetResourceEntryRequest::RunCallbackOnPrematureFailure( - GDataErrorCode error) { - callback_.Run(error, scoped_ptr<ResourceEntry>()); -} - -void GetResourceEntryRequest::OnDataParsed(GDataErrorCode error, - scoped_ptr<ResourceEntry> entry) { - if (!entry) - error = GDATA_PARSE_ERROR; - callback_.Run(error, entry.Pass()); - OnProcessURLFetchResultsComplete(); -} - -} // namespace google_apis diff --git a/google_apis/drive/gdata_wapi_requests.h b/google_apis/drive/gdata_wapi_requests.h deleted file mode 100644 index 4a9962b..0000000 --- a/google_apis/drive/gdata_wapi_requests.h +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef GOOGLE_APIS_DRIVE_GDATA_WAPI_REQUESTS_H_ -#define GOOGLE_APIS_DRIVE_GDATA_WAPI_REQUESTS_H_ - -#include <string> - -#include "google_apis/drive/base_requests.h" -#include "google_apis/drive/gdata_wapi_url_generator.h" - -namespace google_apis { - -class ResourceEntry; - -// Callback type for GetResourceEntryRequest. -typedef base::Callback<void(GDataErrorCode error, - scoped_ptr<ResourceEntry> entry)> - GetResourceEntryCallback; - -// This class performs the request for fetching a single resource entry. -class GetResourceEntryRequest : public UrlFetchRequestBase { - public: - // |callback| must not be null. - GetResourceEntryRequest(RequestSender* sender, - const GDataWapiUrlGenerator& url_generator, - const std::string& resource_id, - const GURL& embed_origin, - const GetResourceEntryCallback& callback); - ~GetResourceEntryRequest() override; - - protected: - // UrlFetchRequestBase overrides. - void ProcessURLFetchResults(const net::URLFetcher* source) override; - void RunCallbackOnPrematureFailure(GDataErrorCode error) override; - GURL GetURL() const override; - - private: - void OnDataParsed(GDataErrorCode error, scoped_ptr<ResourceEntry> entry); - - const GDataWapiUrlGenerator url_generator_; - // Resource id of the requested entry. - const std::string resource_id_; - // Embed origin for an url to the sharing dialog. Can be empty. - GURL embed_origin_; - - const GetResourceEntryCallback callback_; - - // Note: This should remain the last member so it'll be destroyed and - // invalidate its weak pointers before any other members are destroyed. - base::WeakPtrFactory<GetResourceEntryRequest> weak_ptr_factory_; - - DISALLOW_COPY_AND_ASSIGN(GetResourceEntryRequest); -}; - -} // namespace google_apis - -#endif // GOOGLE_APIS_DRIVE_GDATA_WAPI_REQUESTS_H_ diff --git a/google_apis/drive/gdata_wapi_requests_unittest.cc b/google_apis/drive/gdata_wapi_requests_unittest.cc deleted file mode 100644 index 87dc8c6..0000000 --- a/google_apis/drive/gdata_wapi_requests_unittest.cc +++ /dev/null @@ -1,153 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "base/bind.h" -#include "base/message_loop/message_loop.h" -#include "base/run_loop.h" -#include "google_apis/drive/dummy_auth_service.h" -#include "google_apis/drive/gdata_wapi_parser.h" -#include "google_apis/drive/gdata_wapi_requests.h" -#include "google_apis/drive/gdata_wapi_url_generator.h" -#include "google_apis/drive/request_sender.h" -#include "google_apis/drive/test_util.h" -#include "net/base/escape.h" -#include "net/test/embedded_test_server/embedded_test_server.h" -#include "net/test/embedded_test_server/http_request.h" -#include "net/test/embedded_test_server/http_response.h" -#include "net/url_request/url_request_test_util.h" -#include "testing/gtest/include/gtest/gtest.h" - -namespace google_apis { - -namespace { - -const char kTestUserAgent[] = "test-user-agent"; - -class GDataWapiRequestsTest : public testing::Test { - public: - void SetUp() override { - request_context_getter_ = new net::TestURLRequestContextGetter( - message_loop_.message_loop_proxy()); - - request_sender_.reset(new RequestSender(new DummyAuthService, - request_context_getter_.get(), - message_loop_.message_loop_proxy(), - kTestUserAgent)); - - ASSERT_TRUE(test_server_.InitializeAndWaitUntilReady()); - test_server_.RegisterRequestHandler( - base::Bind(&GDataWapiRequestsTest::HandleResourceFeedRequest, - base::Unretained(this))); - - GURL test_base_url = test_util::GetBaseUrlForTesting(test_server_.port()); - url_generator_.reset(new GDataWapiUrlGenerator(test_base_url)); - } - - protected: - // Handles a request for fetching a resource feed. - scoped_ptr<net::test_server::HttpResponse> HandleResourceFeedRequest( - const net::test_server::HttpRequest& request) { - http_request_ = request; - - const GURL absolute_url = test_server_.GetURL(request.relative_url); - std::string remaining_path; - - if (!test_util::RemovePrefix(absolute_url.path(), - "/feeds/default/private/full", - &remaining_path)) { - return nullptr; - } - - // Process a feed for a single resource ID. - const std::string resource_id = net::UnescapeURLComponent( - remaining_path.substr(1), net::UnescapeRule::URL_SPECIAL_CHARS); - if (resource_id == "file:2_file_resource_id") { - scoped_ptr<net::test_server::BasicHttpResponse> result( - test_util::CreateHttpResponseFromFile( - test_util::GetTestFilePath("gdata/file_entry.json"))); - return result.Pass(); - } else if (resource_id == "invalid_resource_id") { - // Check if this is an authorization request for an app. - // This emulates to return invalid formatted result from the server. - if (request.method == net::test_server::METHOD_PUT && - request.content.find("<docs:authorizedApp>") != std::string::npos) { - scoped_ptr<net::test_server::BasicHttpResponse> result( - test_util::CreateHttpResponseFromFile( - test_util::GetTestFilePath("drive/testfile.txt"))); - return result.Pass(); - } - } - - return nullptr; - } - - base::MessageLoopForIO message_loop_; // Test server needs IO thread. - net::test_server::EmbeddedTestServer test_server_; - scoped_ptr<RequestSender> request_sender_; - scoped_ptr<GDataWapiUrlGenerator> url_generator_; - scoped_refptr<net::TestURLRequestContextGetter> request_context_getter_; - - // The incoming HTTP request is saved so tests can verify the request - // parameters like HTTP method (ex. some requests should use DELETE - // instead of GET). - net::test_server::HttpRequest http_request_; -}; - -} // namespace - -TEST_F(GDataWapiRequestsTest, GetResourceEntryRequest_ValidResourceId) { - GDataErrorCode result_code = GDATA_OTHER_ERROR; - scoped_ptr<ResourceEntry> result_data; - - { - base::RunLoop run_loop; - GetResourceEntryRequest* request = new GetResourceEntryRequest( - request_sender_.get(), - *url_generator_, - "file:2_file_resource_id", // resource ID - GURL(), // embed origin - test_util::CreateQuitCallback( - &run_loop, - test_util::CreateCopyResultCallback(&result_code, &result_data))); - request_sender_->StartRequestWithRetry(request); - run_loop.Run(); - } - - EXPECT_EQ(HTTP_SUCCESS, result_code); - EXPECT_EQ(net::test_server::METHOD_GET, http_request_.method); - EXPECT_EQ("/feeds/default/private/full/file%3A2_file_resource_id" - "?v=3&alt=json&showroot=true", - http_request_.relative_url); - EXPECT_TRUE(result_data); - EXPECT_EQ("File 1.mp3", result_data->filename()); - EXPECT_EQ("3b4382ebefec6e743578c76bbd0575ce", result_data->file_md5()); -} - -TEST_F(GDataWapiRequestsTest, GetResourceEntryRequest_InvalidResourceId) { - GDataErrorCode result_code = GDATA_OTHER_ERROR; - scoped_ptr<ResourceEntry> result_data; - - { - base::RunLoop run_loop; - GetResourceEntryRequest* request = new GetResourceEntryRequest( - request_sender_.get(), - *url_generator_, - "<invalid>", // resource ID - GURL(), // embed origin - test_util::CreateQuitCallback( - &run_loop, - test_util::CreateCopyResultCallback(&result_code, &result_data))); - request_sender_->StartRequestWithRetry(request); - run_loop.Run(); - } - - EXPECT_EQ(HTTP_NOT_FOUND, result_code); - EXPECT_EQ(net::test_server::METHOD_GET, http_request_.method); - EXPECT_EQ("/feeds/default/private/full/%3Cinvalid%3E?v=3&alt=json" - "&showroot=true", - http_request_.relative_url); - ASSERT_FALSE(result_data); -} - -} // namespace google_apis diff --git a/google_apis/drive/gdata_wapi_url_generator.cc b/google_apis/drive/gdata_wapi_url_generator.cc deleted file mode 100644 index ffdb0f3..0000000 --- a/google_apis/drive/gdata_wapi_url_generator.cc +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "google_apis/drive/gdata_wapi_url_generator.h" - -#include "base/logging.h" -#include "base/strings/string_number_conversions.h" -#include "base/strings/stringprintf.h" -#include "net/base/escape.h" -#include "net/base/url_util.h" -#include "url/gurl.h" - -namespace google_apis { -namespace { - -// URL requesting single resource entry whose resource id is followed by this -// prefix. -const char kGetEditURLPrefix[] = "/feeds/default/private/full/"; - -} // namespace - -const char GDataWapiUrlGenerator::kBaseUrlForProduction[] = - "https://docs.google.com/"; - -// static -GURL GDataWapiUrlGenerator::AddStandardUrlParams(const GURL& url) { - GURL result = net::AppendOrReplaceQueryParameter(url, "v", "3"); - result = net::AppendOrReplaceQueryParameter(result, "alt", "json"); - result = net::AppendOrReplaceQueryParameter(result, "showroot", "true"); - return result; -} - -GDataWapiUrlGenerator::GDataWapiUrlGenerator(const GURL& base_url) - : base_url_(base_url) { -} - -GDataWapiUrlGenerator::~GDataWapiUrlGenerator() { -} - -GURL GDataWapiUrlGenerator::GenerateEditUrl( - const std::string& resource_id) const { - return AddStandardUrlParams(GenerateEditUrlWithoutParams(resource_id)); -} - -GURL GDataWapiUrlGenerator::GenerateEditUrlWithoutParams( - const std::string& resource_id) const { - return base_url_.Resolve(kGetEditURLPrefix + net::EscapePath(resource_id)); -} - -GURL GDataWapiUrlGenerator::GenerateEditUrlWithEmbedOrigin( - const std::string& resource_id, const GURL& embed_origin) const { - GURL url = GenerateEditUrl(resource_id); - if (!embed_origin.is_empty()) { - // Construct a valid serialized embed origin from an url, according to - // WD-html5-20110525. Such string has to be built manually, since - // GURL::spec() always adds the trailing slash. Moreover, ports are - // currently not supported. - DCHECK(!embed_origin.has_port()); - DCHECK(!embed_origin.has_path() || embed_origin.path() == "/"); - const std::string serialized_embed_origin = - embed_origin.scheme() + "://" + embed_origin.host(); - url = net::AppendOrReplaceQueryParameter( - url, "embedOrigin", serialized_embed_origin); - } - return url; -} - -} // namespace google_apis diff --git a/google_apis/drive/gdata_wapi_url_generator.h b/google_apis/drive/gdata_wapi_url_generator.h deleted file mode 100644 index c0486cf..0000000 --- a/google_apis/drive/gdata_wapi_url_generator.h +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. -// -// URL utility functions for Google Documents List API (aka WAPI). - -#ifndef GOOGLE_APIS_DRIVE_GDATA_WAPI_URL_GENERATOR_H_ -#define GOOGLE_APIS_DRIVE_GDATA_WAPI_URL_GENERATOR_H_ - -#include <string> - -#include "url/gurl.h" - -namespace google_apis { - -// The class is used to generate URLs for communicating with the WAPI server. -// for production, and the local server for testing. -class GDataWapiUrlGenerator { - public: - GDataWapiUrlGenerator(const GURL& base_url); - ~GDataWapiUrlGenerator(); - - // The base URL for communicating with the WAPI server for production. - static const char kBaseUrlForProduction[]; - - // The base URL for the file download server for production. - static const char kBaseDownloadUrlForProduction[]; - - // Adds additional parameters for API version, output content type and to - // show folders in the feed are added to document feed URLs. - static GURL AddStandardUrlParams(const GURL& url); - - // Generates a URL for getting or editing the resource entry of - // the given resource ID. - GURL GenerateEditUrl(const std::string& resource_id) const; - - // Generates a URL for getting or editing the resource entry of the - // given resource ID without query params. - // Note that, in order to access to the WAPI server, it is necessary to - // append some query parameters to the URL. GenerateEditUrl declared above - // should be used in such cases. This method is designed for constructing - // the data, such as xml element/attributes in request body containing - // edit urls. - GURL GenerateEditUrlWithoutParams(const std::string& resource_id) const; - - // Generates a URL for getting or editing the resource entry of the given - // resource ID with additionally passed embed origin. This is used to fetch - // share urls for the sharing dialog to be embedded with the |embed_origin| - // origin. - GURL GenerateEditUrlWithEmbedOrigin(const std::string& resource_id, - const GURL& embed_origin) const; - - private: - const GURL base_url_; -}; - -} // namespace google_apis - -#endif // GOOGLE_APIS_DRIVE_GDATA_WAPI_URL_GENERATOR_H_ diff --git a/google_apis/drive/gdata_wapi_url_generator_unittest.cc b/google_apis/drive/gdata_wapi_url_generator_unittest.cc deleted file mode 100644 index 0ac8508..0000000 --- a/google_apis/drive/gdata_wapi_url_generator_unittest.cc +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "google_apis/drive/gdata_wapi_url_generator.h" - -#include "testing/gtest/include/gtest/gtest.h" -#include "url/gurl.h" -#include "url/url_util.h" - -namespace google_apis { - -class GDataWapiUrlGeneratorTest : public testing::Test { - public: - GDataWapiUrlGeneratorTest() - : url_generator_( - GURL(GDataWapiUrlGenerator::kBaseUrlForProduction)) { - } - - protected: - GDataWapiUrlGenerator url_generator_; -}; - -TEST_F(GDataWapiUrlGeneratorTest, AddStandardUrlParams) { - EXPECT_EQ("http://www.example.com/?v=3&alt=json&showroot=true", - GDataWapiUrlGenerator::AddStandardUrlParams( - GURL("http://www.example.com")).spec()); -} - -TEST_F(GDataWapiUrlGeneratorTest, GenerateEditUrl) { - EXPECT_EQ( - "https://docs.google.com/feeds/default/private/full/XXX?v=3&alt=json" - "&showroot=true", - url_generator_.GenerateEditUrl("XXX").spec()); -} - -TEST_F(GDataWapiUrlGeneratorTest, GenerateEditUrlWithoutParams) { - EXPECT_EQ( - "https://docs.google.com/feeds/default/private/full/XXX", - url_generator_.GenerateEditUrlWithoutParams("XXX").spec()); -} - -TEST_F(GDataWapiUrlGeneratorTest, GenerateEditUrlWithEmbedOrigin) { - url::AddStandardScheme("chrome-extension"); - - EXPECT_EQ( - "https://docs.google.com/feeds/default/private/full/XXX?v=3&alt=json" - "&showroot=true&embedOrigin=chrome-extension%3A%2F%2Ftest", - url_generator_.GenerateEditUrlWithEmbedOrigin( - "XXX", - GURL("chrome-extension://test")).spec()); - EXPECT_EQ( - "https://docs.google.com/feeds/default/private/full/XXX?v=3&alt=json" - "&showroot=true", - url_generator_.GenerateEditUrlWithEmbedOrigin( - "XXX", - GURL()).spec()); -} - -} // namespace google_apis diff --git a/google_apis/drive/test_util.cc b/google_apis/drive/test_util.cc index 6d92eb0..ee400c0 100644 --- a/google_apis/drive/test_util.cc +++ b/google_apis/drive/test_util.cc @@ -17,7 +17,6 @@ #include "base/strings/stringprintf.h" #include "google_apis/drive/drive_api_parser.h" #include "google_apis/drive/gdata_wapi_parser.h" -#include "google_apis/drive/gdata_wapi_requests.h" #include "net/test/embedded_test_server/http_request.h" #include "net/test/embedded_test_server/http_response.h" #include "url/gurl.h" diff --git a/google_apis/google_apis.gyp b/google_apis/google_apis.gyp index 228fba8..436e7b1 100644 --- a/google_apis/google_apis.gyp +++ b/google_apis/google_apis.gyp @@ -57,12 +57,8 @@ 'drive/drive_common_callbacks.h', 'drive/gdata_errorcode.cc', 'drive/gdata_errorcode.h', - 'drive/gdata_wapi_requests.cc', - 'drive/gdata_wapi_requests.h', 'drive/gdata_wapi_parser.cc', 'drive/gdata_wapi_parser.h', - 'drive/gdata_wapi_url_generator.cc', - 'drive/gdata_wapi_url_generator.h', 'drive/request_sender.cc', 'drive/request_sender.h', 'drive/request_util.cc', @@ -161,9 +157,6 @@ 'drive/drive_api_parser_unittest.cc', 'drive/drive_api_requests_unittest.cc', 'drive/drive_api_url_generator_unittest.cc', - 'drive/gdata_wapi_parser_unittest.cc', - 'drive/gdata_wapi_requests_unittest.cc', - 'drive/gdata_wapi_url_generator_unittest.cc', 'drive/request_sender_unittest.cc', 'drive/request_util_unittest.cc', 'drive/time_util_unittest.cc', |