diff options
author | kinaba@chromium.org <kinaba@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-07 18:16:40 +0000 |
---|---|---|
committer | kinaba@chromium.org <kinaba@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-07 18:16:40 +0000 |
commit | e0f9f23f765a45e6d80863a8f881ee735c9347fe (patch) | |
tree | 68fde44a981de744434c104d57bb7787fff14cd2 /google_apis | |
parent | 223453462ebdbc9252fa0f0fc247d13c4f1188c2 (diff) | |
download | chromium_src-e0f9f23f765a45e6d80863a8f881ee735c9347fe.zip chromium_src-e0f9f23f765a45e6d80863a8f881ee735c9347fe.tar.gz chromium_src-e0f9f23f765a45e6d80863a8f881ee735c9347fe.tar.bz2 |
Parse createUrl field of apps.list Drive API.
This CL just parses and stores the field for future use.
BUG=324165
Review URL: https://codereview.chromium.org/125553004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@243335 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'google_apis')
-rw-r--r-- | google_apis/drive/drive_api_parser.cc | 4 | ||||
-rw-r--r-- | google_apis/drive/drive_api_parser.h | 7 | ||||
-rw-r--r-- | google_apis/drive/drive_api_parser_unittest.cc | 4 |
3 files changed, 15 insertions, 0 deletions
diff --git a/google_apis/drive/drive_api_parser.cc b/google_apis/drive/drive_api_parser.cc index 4b05e8b..cefbc21 100644 --- a/google_apis/drive/drive_api_parser.cc +++ b/google_apis/drive/drive_api_parser.cc @@ -107,6 +107,7 @@ const char kSecondaryMimeTypes[] = "secondaryMimeTypes"; const char kPrimaryFileExtensions[] = "primaryFileExtensions"; const char kSecondaryFileExtensions[] = "secondaryFileExtensions"; const char kIcons[] = "icons"; +const char kCreateUrl[] = "createUrl"; // Apps List // https://developers.google.com/drive/v2/reference/apps/list @@ -328,6 +329,9 @@ void AppResource::RegisterJSONConverter( converter->RegisterRepeatedString(kSecondaryFileExtensions, &AppResource::secondary_file_extensions_); converter->RegisterRepeatedMessage(kIcons, &AppResource::icons_); + converter->RegisterCustomField<GURL>(kCreateUrl, + &AppResource::create_url_, + GetGURLFromString); } // static diff --git a/google_apis/drive/drive_api_parser.h b/google_apis/drive/drive_api_parser.h index ef02035..ef02623 100644 --- a/google_apis/drive/drive_api_parser.h +++ b/google_apis/drive/drive_api_parser.h @@ -184,6 +184,9 @@ class AppResource { // Returns the product URL, e.g. at Chrome Web Store. const GURL& product_url() const { return product_url_; } + // Returns the create URL, i.e., the URL for opening a new file by the app. + const GURL& create_url() const { return create_url_; } + // List of primary mime types supported by this WebApp. Primary status should // trigger this WebApp becoming the default handler of file instances that // have these mime types. @@ -256,6 +259,9 @@ class AppResource { void set_icons(ScopedVector<DriveAppIcon> icons) { icons_ = icons.Pass(); } + void set_create_url(const GURL& url) { + create_url_ = url; + } private: friend class base::internal::RepeatedMessageConverter<AppResource>; @@ -273,6 +279,7 @@ class AppResource { bool installed_; bool authorized_; GURL product_url_; + GURL create_url_; ScopedVector<std::string> primary_mimetypes_; ScopedVector<std::string> secondary_mimetypes_; ScopedVector<std::string> primary_file_extensions_; diff --git a/google_apis/drive/drive_api_parser_unittest.cc b/google_apis/drive/drive_api_parser_unittest.cc index 0960b27..0c9f7a9 100644 --- a/google_apis/drive/drive_api_parser_unittest.cc +++ b/google_apis/drive/drive_api_parser_unittest.cc @@ -82,6 +82,8 @@ TEST(DriveAPIParserTest, AppListParser) { EXPECT_EQ(16, icon6.icon_side_length()); EXPECT_EQ("http://www.example.com/ds16.png", icon6.icon_url().spec()); + EXPECT_EQ("https://www.example.com/createForApp1", app1.create_url().spec()); + // Check Drive app 2 const AppResource& app2 = *applist->items()[1]; EXPECT_EQ("876543210000", app2.application_id()); @@ -110,6 +112,8 @@ TEST(DriveAPIParserTest, AppListParser) { EXPECT_EQ(DriveAppIcon::DOCUMENT, icon2.category()); EXPECT_EQ(10, icon2.icon_side_length()); EXPECT_EQ("http://www.example.com/d10.png", icon2.icon_url().spec()); + + EXPECT_EQ("https://www.example.com/createForApp2", app2.create_url().spec()); } // Test file list parsing. |