Commit abb2f2f2 authored by kinaba@chromium.org's avatar kinaba@chromium.org

Remove unnecessary utilities from drive::util.

* drive::util::GetHostedDocumentMimeType is useless, the mime type
is directly obtained from ResourceEntry, especially after we've
moved to Drive API (see Bug 308836 for subtlety).
* kWapiRootDirectoryResourceId is just not used anywhere.

BUG=397391

Review URL: https://codereview.chromium.org/414203003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@285543 0039d316-1c4b-4281-b951-d872f2087c98
parent 9c428473
......@@ -166,8 +166,7 @@ bool IsEligibleEntry(const ResourceEntry& entry, int options) {
if (entry.file_specific_info().is_hosted_document()) {
// Not all hosted documents are cached by Drive offline app.
// http://support.google.com/drive/bin/answer.py?hl=en&answer=1628467
std::string mime_type = drive::util::GetHostedDocumentMimeType(
entry.file_specific_info().document_extension());
std::string mime_type = entry.file_specific_info().content_mime_type();
return mime_type == drive::util::kGoogleDocumentMimeType ||
mime_type == drive::util::kGoogleSpreadsheetMimeType ||
mime_type == drive::util::kGooglePresentationMimeType ||
......
......@@ -14,6 +14,7 @@
#include "chrome/browser/chromeos/drive/file_cache.h"
#include "chrome/browser/chromeos/drive/file_system_util.h"
#include "chrome/browser/chromeos/drive/test_util.h"
#include "chrome/browser/drive/drive_api_util.h"
#include "content/public/test/test_browser_thread_bundle.h"
#include "testing/gtest/include/gtest/gtest.h"
......@@ -117,6 +118,8 @@ class SearchMetadataTest : public testing::Test {
"Document 1 excludeDir-test", "doc1", 8, root_local_id);
entry.mutable_file_specific_info()->set_is_hosted_document(true);
entry.mutable_file_specific_info()->set_document_extension(".gdoc");
entry.mutable_file_specific_info()->set_content_mime_type(
drive::util::kGoogleDocumentMimeType);
EXPECT_EQ(FILE_ERROR_OK, resource_metadata_->AddEntry(entry, &local_id));
}
......
......@@ -44,7 +44,6 @@ const HostedDocumentKind kHostedDocumentKinds[] = {
} // namespace
std::string EscapeQueryStringValue(const std::string& str) {
std::string result;
result.reserve(str.size());
......@@ -342,8 +341,6 @@ std::string GetMd5Digest(const base::FilePath& file_path) {
return MD5DigestToBase16(digest);
}
const char kWapiRootDirectoryResourceId[] = "folder:root";
std::string GetHostedDocumentExtension(const std::string& mime_type) {
for (size_t i = 0; i < arraysize(kHostedDocumentKinds); ++i) {
if (mime_type == kHostedDocumentKinds[i].mime_type)
......@@ -352,14 +349,6 @@ std::string GetHostedDocumentExtension(const std::string& mime_type) {
return std::string();
}
std::string GetHostedDocumentMimeType(const std::string& extension) {
for (size_t i = 0; i < arraysize(kHostedDocumentKinds); ++i) {
if (extension == kHostedDocumentKinds[i].extension)
return kHostedDocumentKinds[i].mime_type;
}
return std::string();
}
bool IsHostedDocument(const std::string& mime_type) {
for (size_t i = 0; i < arraysize(kHostedDocumentKinds); ++i) {
if (mime_type == kHostedDocumentKinds[i].mime_type)
......
......@@ -109,20 +109,11 @@ ConvertChangeListToResourceList(const google_apis::ChangeList& change_list);
// or an empty string if an error is found.
std::string GetMd5Digest(const base::FilePath& file_path);
// The resource ID for the root directory for WAPI is defined in the spec:
// https://developers.google.com/google-apps/documents-list/
extern const char kWapiRootDirectoryResourceId[];
// Returns preferred file extension for hosted documents which have given mime
// type. If the given mime type is not known as one for hosted documents,
// returns empty string.
std::string GetHostedDocumentExtension(const std::string& mime_type);
// Returns mime type for hosted documents which have given extension in form
// ".xxx". If the given extension is not known as one for hosted documents,
// returns empty string.
std::string GetHostedDocumentMimeType(const std::string& extension);
// Returns true if the given mime type is corresponding to one of hosted
// documents.
bool IsHostedDocument(const std::string& mime_type);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment