summaryrefslogtreecommitdiffstats
path: root/google_apis
diff options
context:
space:
mode:
authorfukino@chromium.org <fukino@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-11 14:36:13 +0000
committerfukino@chromium.org <fukino@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-11 14:36:13 +0000
commit799200103c2e46392356e03a08bed5d913f2dabf (patch)
tree3f4466fd4d95036112194b765d68b721ed3c0e59 /google_apis
parentb6e07d160a29b1da442d0ada33859fa21ed11912 (diff)
downloadchromium_src-799200103c2e46392356e03a08bed5d913f2dabf.zip
chromium_src-799200103c2e46392356e03a08bed5d913f2dabf.tar.gz
chromium_src-799200103c2e46392356e03a08bed5d913f2dabf.tar.bz2
Remove unused property from drive api parsers.
BUG=353554 TEST=run unit_tests Review URL: https://codereview.chromium.org/234613003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@263241 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'google_apis')
-rw-r--r--google_apis/drive/drive_api_parser.cc41
-rw-r--r--google_apis/drive/drive_api_parser.h83
-rw-r--r--google_apis/drive/drive_api_parser_unittest.cc27
3 files changed, 2 insertions, 149 deletions
diff --git a/google_apis/drive/drive_api_parser.cc b/google_apis/drive/drive_api_parser.cc
index fff3d9d..c22070e 100644
--- a/google_apis/drive/drive_api_parser.cc
+++ b/google_apis/drive/drive_api_parser.cc
@@ -120,9 +120,6 @@ const char kName[] = "name";
const char kObjectType[] = "objectType";
const char kProductId[] = "productId";
const char kSupportsCreate[] = "supportsCreate";
-const char kSupportsImport[] = "supportsImport";
-const char kInstalled[] = "installed";
-const char kAuthorized[] = "authorized";
const char kRemovable[] = "removable";
const char kPrimaryMimeTypes[] = "primaryMimeTypes";
const char kSecondaryMimeTypes[] = "secondaryMimeTypes";
@@ -139,7 +136,6 @@ const char kAppListKind[] = "drive#appList";
// https://developers.google.com/drive/v2/reference/parents
const char kParentReferenceKind[] = "drive#parentReference";
const char kParentLink[] = "parentLink";
-const char kIsRoot[] = "isRoot";
// File Resource
// https://developers.google.com/drive/v2/reference/files
@@ -149,10 +145,8 @@ const char kMimeType[] = "mimeType";
const char kCreatedDate[] = "createdDate";
const char kModificationDate[] = "modificationDate";
const char kModifiedDate[] = "modifiedDate";
-const char kModifiedByMeDate[] = "modifiedByMeDate";
const char kLastViewedByMeDate[] = "lastViewedByMeDate";
const char kSharedWithMeDate[] = "sharedWithMeDate";
-const char kFileExtension[] = "fileExtension";
const char kMd5Checksum[] = "md5Checksum";
const char kFileSize[] = "fileSize";
const char kAlternateLink[] = "alternateLink";
@@ -162,11 +156,7 @@ const char kLabels[] = "labels";
const char kImageMediaMetadata[] = "imageMediaMetadata";
const char kShared[] = "shared";
// These 5 flags are defined under |labels|.
-const char kLabelStarred[] = "starred";
-const char kLabelHidden[] = "hidden";
const char kLabelTrashed[] = "trashed";
-const char kLabelRestricted[] = "restricted";
-const char kLabelViewed[] = "viewed";
// These 3 flags are defined under |imageMediaMetadata|.
const char kImageMediaMetadataWidth[] = "width";
const char kImageMediaMetadataHeight[] = "height";
@@ -177,7 +167,6 @@ const char kDriveFolderMimeType[] = "application/vnd.google-apps.folder";
// Files List
// https://developers.google.com/drive/v2/reference/files/list
const char kFileListKind[] = "drive#fileList";
-const char kNextPageToken[] = "nextPageToken";
const char kNextLink[] = "nextLink";
// Change Resource
@@ -319,9 +308,6 @@ bool DriveAppIcon::GetIconCategory(const base::StringPiece& category,
AppResource::AppResource()
: supports_create_(false),
- supports_import_(false),
- installed_(false),
- authorized_(false),
removable_(false) {
}
@@ -335,9 +321,6 @@ void AppResource::RegisterJSONConverter(
converter->RegisterStringField(kObjectType, &AppResource::object_type_);
converter->RegisterStringField(kProductId, &AppResource::product_id_);
converter->RegisterBoolField(kSupportsCreate, &AppResource::supports_create_);
- converter->RegisterBoolField(kSupportsImport, &AppResource::supports_import_);
- converter->RegisterBoolField(kInstalled, &AppResource::installed_);
- converter->RegisterBoolField(kAuthorized, &AppResource::authorized_);
converter->RegisterBoolField(kRemovable, &AppResource::removable_);
converter->RegisterRepeatedString(kPrimaryMimeTypes,
&AppResource::primary_mimetypes_);
@@ -409,7 +392,7 @@ bool AppList::Parse(const base::Value& value) {
////////////////////////////////////////////////////////////////////////////////
// ParentReference implementation
-ParentReference::ParentReference() : is_root_(false) {}
+ParentReference::ParentReference() {}
ParentReference::~ParentReference() {}
@@ -420,7 +403,6 @@ void ParentReference::RegisterJSONConverter(
converter->RegisterCustomField<GURL>(kParentLink,
&ParentReference::parent_link_,
GetGURLFromString);
- converter->RegisterBoolField(kIsRoot, &ParentReference::is_root_);
}
// static
@@ -470,10 +452,6 @@ void FileResource::RegisterJSONConverter(
&FileResource::modified_date_,
&util::GetTimeFromString);
converter->RegisterCustomField<base::Time>(
- kModifiedByMeDate,
- &FileResource::modified_by_me_date_,
- &util::GetTimeFromString);
- converter->RegisterCustomField<base::Time>(
kLastViewedByMeDate,
&FileResource::last_viewed_by_me_date_,
&util::GetTimeFromString);
@@ -482,8 +460,6 @@ void FileResource::RegisterJSONConverter(
&FileResource::shared_with_me_date_,
&util::GetTimeFromString);
converter->RegisterBoolField(kShared, &FileResource::shared_);
- converter->RegisterStringField(kFileExtension,
- &FileResource::file_extension_);
converter->RegisterStringField(kMd5Checksum, &FileResource::md5_checksum_);
converter->RegisterCustomField<int64>(kFileSize,
&FileResource::file_size_,
@@ -534,8 +510,6 @@ FileList::~FileList() {}
// static
void FileList::RegisterJSONConverter(
base::JSONValueConverter<FileList>* converter) {
- converter->RegisterStringField(kETag, &FileList::etag_);
- converter->RegisterStringField(kNextPageToken, &FileList::next_page_token_);
converter->RegisterCustomField<GURL>(kNextLink,
&FileList::next_link_,
GetGURLFromString);
@@ -619,8 +593,6 @@ ChangeList::~ChangeList() {}
// static
void ChangeList::RegisterJSONConverter(
base::JSONValueConverter<ChangeList>* converter) {
- converter->RegisterStringField(kETag, &ChangeList::etag_);
- converter->RegisterStringField(kNextPageToken, &ChangeList::next_page_token_);
converter->RegisterCustomField<GURL>(kNextLink,
&ChangeList::next_link_,
GetGURLFromString);
@@ -659,23 +631,14 @@ bool ChangeList::Parse(const base::Value& value) {
////////////////////////////////////////////////////////////////////////////////
// FileLabels implementation
-FileLabels::FileLabels()
- : starred_(false),
- hidden_(false),
- trashed_(false),
- restricted_(false),
- viewed_(false) {}
+FileLabels::FileLabels() : trashed_(false) {}
FileLabels::~FileLabels() {}
// static
void FileLabels::RegisterJSONConverter(
base::JSONValueConverter<FileLabels>* converter) {
- converter->RegisterBoolField(kLabelStarred, &FileLabels::starred_);
- converter->RegisterBoolField(kLabelHidden, &FileLabels::hidden_);
converter->RegisterBoolField(kLabelTrashed, &FileLabels::trashed_);
- converter->RegisterBoolField(kLabelRestricted, &FileLabels::restricted_);
- converter->RegisterBoolField(kLabelViewed, &FileLabels::viewed_);
}
// static
diff --git a/google_apis/drive/drive_api_parser.h b/google_apis/drive/drive_api_parser.h
index daa2b4b..2700dbc 100644
--- a/google_apis/drive/drive_api_parser.h
+++ b/google_apis/drive/drive_api_parser.h
@@ -174,16 +174,6 @@ class AppResource {
// Returns whether this application supports creating new objects.
bool supports_create() const { return supports_create_; }
- // Returns whether this application supports importing Google Docs.
- bool supports_import() const { return supports_import_; }
-
- // Returns whether this application is installed.
- bool is_installed() const { return installed_; }
-
- // Returns whether this application is authorized to access data on the
- // user's Drive.
- bool is_authorized() const { return authorized_; }
-
// Returns whether this application is removable by apps.delete API.
bool is_removable() const { return removable_; }
@@ -236,11 +226,6 @@ class AppResource {
void set_supports_create(bool supports_create) {
supports_create_ = supports_create;
}
- void set_supports_import(bool supports_import) {
- supports_import_ = supports_import;
- }
- void set_installed(bool installed) { installed_ = installed; }
- void set_authorized(bool authorized) { authorized_ = authorized; }
void set_removable(bool removable) { removable_ = removable; }
void set_primary_mimetypes(
ScopedVector<std::string> primary_mimetypes) {
@@ -278,9 +263,6 @@ class AppResource {
std::string object_type_;
std::string product_id_;
bool supports_create_;
- bool supports_import_;
- bool installed_;
- bool authorized_;
bool removable_;
GURL create_url_;
ScopedVector<std::string> primary_mimetypes_;
@@ -355,14 +337,10 @@ class ParentReference {
// Returns the URL for the parent in Drive.
const GURL& parent_link() const { return parent_link_; }
- // Returns true if the reference is root directory.
- bool is_root() const { return is_root_; }
-
void set_file_id(const std::string& file_id) { file_id_ = file_id; }
void set_parent_link(const GURL& parent_link) {
parent_link_ = parent_link;
}
- void set_is_root(bool is_root) { is_root_ = is_root; }
private:
// Parses and initializes data members from content of |value|.
@@ -371,7 +349,6 @@ class ParentReference {
std::string file_id_;
GURL parent_link_;
- bool is_root_;
};
// FileLabels represents labels for file or folder.
@@ -389,22 +366,10 @@ class FileLabels {
// Creates about resource from parsed JSON.
static scoped_ptr<FileLabels> CreateFrom(const base::Value& value);
- // Whether this file is starred by the user.
- bool is_starred() const { return starred_; }
- // Whether this file is hidden from the user.
- bool is_hidden() const { return hidden_; }
// Whether this file has been trashed.
bool is_trashed() const { return trashed_; }
- // Whether viewers are prevented from downloading this file.
- bool is_restricted() const { return restricted_; }
- // Whether this file has been viewed by this user.
- bool is_viewed() const { return viewed_; }
- void set_starred(bool starred) { starred_ = starred; }
- void set_hidden(bool hidden) { hidden_ = hidden; }
void set_trashed(bool trashed) { trashed_ = trashed; }
- void set_restricted(bool restricted) { restricted_ = restricted; }
- void set_viewed(bool viewed) { viewed_ = viewed; }
private:
friend class FileResource;
@@ -413,11 +378,7 @@ class FileLabels {
// Return false if parsing fails.
bool Parse(const base::Value& value);
- bool starred_;
- bool hidden_;
bool trashed_;
- bool restricted_;
- bool viewed_;
};
// ImageMediaMetadata represents image metadata for a file.
@@ -511,9 +472,6 @@ class FileResource {
// Returns modified time of this file.
const base::Time& modified_date() const { return modified_date_; }
- // Returns modification time by the user.
- const base::Time& modified_by_me_date() const { return modified_by_me_date_; }
-
// Returns last access time by the user.
const base::Time& last_viewed_by_me_date() const {
return last_viewed_by_me_date_;
@@ -527,9 +485,6 @@ class FileResource {
// Returns the 'shared' attribute of the file.
bool shared() const { return shared_; }
- // Returns the extension part of the filename.
- const std::string& file_extension() const { return file_extension_; }
-
// Returns MD5 checksum of this file.
const std::string& md5_checksum() const { return md5_checksum_; }
@@ -572,9 +527,6 @@ class FileResource {
void set_modified_date(const base::Time& modified_date) {
modified_date_ = modified_date;
}
- void set_modified_by_me_date(const base::Time& modified_by_me_date) {
- modified_by_me_date_ = modified_by_me_date;
- }
void set_last_viewed_by_me_date(const base::Time& last_viewed_by_me_date) {
last_viewed_by_me_date_ = last_viewed_by_me_date;
}
@@ -584,9 +536,6 @@ class FileResource {
void set_shared(bool shared) {
shared_ = shared;
}
- void set_file_extension(const std::string& file_extension) {
- file_extension_ = file_extension;
- }
void set_md5_checksum(const std::string& md5_checksum) {
md5_checksum_ = md5_checksum;
}
@@ -618,11 +567,9 @@ class FileResource {
ImageMediaMetadata image_media_metadata_;
base::Time created_date_;
base::Time modified_date_;
- base::Time modified_by_me_date_;
base::Time last_viewed_by_me_date_;
base::Time shared_with_me_date_;
bool shared_;
- std::string file_extension_;
std::string md5_checksum_;
int64 file_size_;
GURL alternate_link_;
@@ -648,13 +595,6 @@ class FileList {
// Creates file list from parsed JSON.
static scoped_ptr<FileList> CreateFrom(const base::Value& value);
- // Returns the ETag of the list.
- const std::string& etag() const { return etag_; }
-
- // Returns the page token for the next page of files, if the list is large
- // to fit in one response. If this is empty, there is no more file lists.
- const std::string& next_page_token() const { return next_page_token_; }
-
// Returns a link to the next page of files. The URL includes the next page
// token.
const GURL& next_link() const { return next_link_; }
@@ -662,12 +602,6 @@ class FileList {
// Returns a set of files in this list.
const ScopedVector<FileResource>& items() const { return items_; }
- void set_etag(const std::string& etag) {
- etag_ = etag;
- }
- void set_next_page_token(const std::string& next_page_token) {
- next_page_token_ = next_page_token;
- }
void set_next_link(const GURL& next_link) {
next_link_ = next_link;
}
@@ -683,8 +617,6 @@ class FileList {
// Return false if parsing fails.
bool Parse(const base::Value& value);
- std::string etag_;
- std::string next_page_token_;
GURL next_link_;
ScopedVector<FileResource> items_;
@@ -774,13 +706,6 @@ class ChangeList {
// Creates change list from parsed JSON.
static scoped_ptr<ChangeList> CreateFrom(const base::Value& value);
- // Returns the ETag of the list.
- const std::string& etag() const { return etag_; }
-
- // Returns the page token for the next page of files, if the list is large
- // to fit in one response. If this is empty, there is no more file lists.
- const std::string& next_page_token() const { return next_page_token_; }
-
// Returns a link to the next page of files. The URL includes the next page
// token.
const GURL& next_link() const { return next_link_; }
@@ -791,12 +716,6 @@ class ChangeList {
// Returns a set of changes in this list.
const ScopedVector<ChangeResource>& items() const { return items_; }
- void set_etag(const std::string& etag) {
- etag_ = etag;
- }
- void set_next_page_token(const std::string& next_page_token) {
- next_page_token_ = next_page_token;
- }
void set_next_link(const GURL& next_link) {
next_link_ = next_link;
}
@@ -815,8 +734,6 @@ class ChangeList {
// Return false if parsing fails.
bool Parse(const base::Value& value);
- std::string etag_;
- std::string next_page_token_;
GURL next_link_;
int64 largest_change_id_;
ScopedVector<ChangeResource> items_;
diff --git a/google_apis/drive/drive_api_parser_unittest.cc b/google_apis/drive/drive_api_parser_unittest.cc
index 89f4c01..6f9ee65 100644
--- a/google_apis/drive/drive_api_parser_unittest.cc
+++ b/google_apis/drive/drive_api_parser_unittest.cc
@@ -50,9 +50,6 @@ TEST(DriveAPIParserTest, AppListParser) {
EXPECT_EQ("Drive app 1", app1.name());
EXPECT_EQ("", app1.object_type());
EXPECT_TRUE(app1.supports_create());
- EXPECT_TRUE(app1.supports_import());
- EXPECT_TRUE(app1.is_installed());
- EXPECT_FALSE(app1.is_authorized());
EXPECT_TRUE(app1.is_removable());
EXPECT_EQ("abcdefghabcdefghabcdefghabcdefgh", app1.product_id());
@@ -89,9 +86,6 @@ TEST(DriveAPIParserTest, AppListParser) {
EXPECT_EQ("Drive app 2", app2.name());
EXPECT_EQ("", app2.object_type());
EXPECT_FALSE(app2.supports_create());
- EXPECT_FALSE(app2.supports_import());
- EXPECT_TRUE(app2.is_installed());
- EXPECT_FALSE(app2.is_authorized());
EXPECT_FALSE(app2.is_removable());
EXPECT_EQ("hgfedcbahgfedcbahgfedcbahgfedcba", app2.product_id());
@@ -125,12 +119,6 @@ TEST(DriveAPIParserTest, FileListParser) {
scoped_ptr<FileList> filelist(new FileList);
EXPECT_TRUE(filelist->Parse(*document));
- EXPECT_EQ("\"WtRjAPZWbDA7_fkFjc5ojsEvDEF/zyHTfoHpnRHovyi8bWpwK0DXABC\"",
- filelist->etag());
- EXPECT_EQ("EAIaggELEgA6egpi96It9mH_____f_8AAP__AAD_okhU-cHLz83KzszMxsjMzs_Ry"
- "NGJnridyrbHs7u9tv8AAP__AP7__n__AP8AokhU-cHLz83KzszMxsjMzs_RyNGJnr"
- "idyrbHs7u9tv8A__4QZCEiXPTi_wtIgTkAAAAAngnSXUgCDEAAIgsJPgart10AAAA"
- "ABC", filelist->next_page_token());
EXPECT_EQ(GURL("https://www.googleapis.com/drive/v2/files?pageToken=EAIaggEL"
"EgA6egpi96It9mH_____f_8AAP__AAD_okhU-cHLz83KzszMxsjMzs_RyNGJ"
"nridyrbHs7u9tv8AAP__AP7__n__AP8AokhU-cHLz83KzszMxsjMzs_RyNGJ"
@@ -146,11 +134,7 @@ TEST(DriveAPIParserTest, FileListParser) {
EXPECT_EQ("My first file data", file1.title());
EXPECT_EQ("application/octet-stream", file1.mime_type());
- EXPECT_FALSE(file1.labels().is_starred());
- EXPECT_FALSE(file1.labels().is_hidden());
EXPECT_FALSE(file1.labels().is_trashed());
- EXPECT_FALSE(file1.labels().is_restricted());
- EXPECT_TRUE(file1.labels().is_viewed());
EXPECT_FALSE(file1.shared());
EXPECT_EQ(640, file1.image_media_metadata().width());
@@ -166,16 +150,13 @@ TEST(DriveAPIParserTest, FileListParser) {
ASSERT_TRUE(
util::GetTimeFromString("2012-07-27T05:43:20.269Z", &modified_time));
EXPECT_EQ(modified_time, file1.modified_date());
- EXPECT_EQ(modified_time, file1.modified_by_me_date());
ASSERT_EQ(1U, file1.parents().size());
EXPECT_EQ("0B4v7G8yEYAWHYW1OcExsUVZLABC", file1.parents()[0].file_id());
EXPECT_EQ(GURL("https://www.googleapis.com/drive/v2/files/"
"0B4v7G8yEYAWHYW1OcExsUVZLABC"),
file1.parents()[0].parent_link());
- EXPECT_FALSE(file1.parents()[0].is_root());
- EXPECT_EQ("ext", file1.file_extension());
EXPECT_EQ("d41d8cd98f00b204e9800998ecf8427e", file1.md5_checksum());
EXPECT_EQ(1000U, file1.file_size());
@@ -192,11 +173,7 @@ TEST(DriveAPIParserTest, FileListParser) {
EXPECT_EQ("Test Google Document", file2.title());
EXPECT_EQ("application/vnd.google-apps.document", file2.mime_type());
- EXPECT_TRUE(file2.labels().is_starred());
- EXPECT_TRUE(file2.labels().is_hidden());
EXPECT_TRUE(file2.labels().is_trashed());
- EXPECT_TRUE(file2.labels().is_restricted());
- EXPECT_TRUE(file2.labels().is_viewed());
EXPECT_TRUE(file2.shared());
EXPECT_EQ(-1, file2.image_media_metadata().width());
@@ -224,7 +201,6 @@ TEST(DriveAPIParserTest, FileListParser) {
ASSERT_EQ(1U, file3.parents().size());
EXPECT_EQ("0AIv7G8yEYAWHUk9ABC", file3.parents()[0].file_id());
- EXPECT_TRUE(file3.parents()[0].is_root());
EXPECT_EQ(0U, file3.open_with_links().size());
}
@@ -239,9 +215,6 @@ TEST(DriveAPIParserTest, ChangeListParser) {
scoped_ptr<ChangeList> changelist(new ChangeList);
EXPECT_TRUE(changelist->Parse(*document));
- EXPECT_EQ("\"Lp2bjAtLP341hvGmYHhxjYyBPJ8/BWbu_eylt5f_aGtCN6mGRv9hABC\"",
- changelist->etag());
- EXPECT_EQ("8929", changelist->next_page_token());
EXPECT_EQ("https://www.googleapis.com/drive/v2/changes?pageToken=8929",
changelist->next_link().spec());
EXPECT_EQ(13664, changelist->largest_change_id());