Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(169)

Side by Side Diff: chrome/browser/drive/drive_api_util.h

Issue 861133002: Remove WAPI-related code, except the type definition of ResourceEntry. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove more WAPI related code. Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_DRIVE_DRIVE_API_UTIL_H_ 5 #ifndef CHROME_BROWSER_DRIVE_DRIVE_API_UTIL_H_
6 #define CHROME_BROWSER_DRIVE_DRIVE_API_UTIL_H_ 6 #define CHROME_BROWSER_DRIVE_DRIVE_API_UTIL_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "google_apis/drive/drive_common_callbacks.h" 11 #include "google_apis/drive/drive_common_callbacks.h"
12 #include "google_apis/drive/gdata_errorcode.h" 12 #include "google_apis/drive/gdata_errorcode.h"
13 13
14 class GURL; 14 class GURL;
15 15
16 namespace base { 16 namespace base {
17 class FilePath; 17 class FilePath;
18 class Value; 18 class Value;
19 } // namespace base 19 } // namespace base
20 20
21 namespace google_apis { 21 namespace google_apis {
22 class ChangeList; 22 class ChangeList;
23 class ChangeResource; 23 class ChangeResource;
24 class FileList; 24 class FileList;
25 class FileResource; 25 class FileResource;
26 class ResourceEntry; 26 class ResourceEntry;
27 class ResourceList;
28 } // namespace google_apis 27 } // namespace google_apis
29 28
30 namespace drive { 29 namespace drive {
31 namespace util { 30 namespace util {
32 31
33 // Google Apps MIME types: 32 // Google Apps MIME types:
34 const char kGoogleDocumentMimeType[] = "application/vnd.google-apps.document"; 33 const char kGoogleDocumentMimeType[] = "application/vnd.google-apps.document";
35 const char kGoogleDrawingMimeType[] = "application/vnd.google-apps.drawing"; 34 const char kGoogleDrawingMimeType[] = "application/vnd.google-apps.drawing";
36 const char kGooglePresentationMimeType[] = 35 const char kGooglePresentationMimeType[] =
37 "application/vnd.google-apps.presentation"; 36 "application/vnd.google-apps.presentation";
(...skipping 12 matching lines...) Expand all
50 // Parses the query, and builds a search query for Drive API v2. 49 // Parses the query, and builds a search query for Drive API v2.
51 // This only supports: 50 // This only supports:
52 // Regular query (e.g. dog => fullText contains 'dog') 51 // Regular query (e.g. dog => fullText contains 'dog')
53 // Conjunctions 52 // Conjunctions
54 // (e.g. dog cat => fullText contains 'dog' and fullText contains 'cat') 53 // (e.g. dog cat => fullText contains 'dog' and fullText contains 'cat')
55 // Exclusion query (e.g. -cat => not fullText contains 'cat'). 54 // Exclusion query (e.g. -cat => not fullText contains 'cat').
56 // Quoted query (e.g. "dog cat" => fullText contains 'dog cat'). 55 // Quoted query (e.g. "dog cat" => fullText contains 'dog cat').
57 // See also: https://developers.google.com/drive/search-parameters 56 // See also: https://developers.google.com/drive/search-parameters
58 std::string TranslateQuery(const std::string& original_query); 57 std::string TranslateQuery(const std::string& original_query);
59 58
60 // Extracts resource_id out of edit url.
61 std::string ExtractResourceIdFromUrl(const GURL& url);
62
63 // If |resource_id| is in the old resource ID format used by WAPI, converts it 59 // If |resource_id| is in the old resource ID format used by WAPI, converts it
64 // into the new format. 60 // into the new format.
65 std::string CanonicalizeResourceId(const std::string& resource_id); 61 std::string CanonicalizeResourceId(const std::string& resource_id);
66 62
67 // Converts FileResource to ResourceEntry. 63 // Converts FileResource to ResourceEntry.
68 scoped_ptr<google_apis::ResourceEntry> 64 scoped_ptr<google_apis::ResourceEntry>
69 ConvertFileResourceToResourceEntry( 65 ConvertFileResourceToResourceEntry(
70 const google_apis::FileResource& file_resource); 66 const google_apis::FileResource& file_resource);
71 67
72 // Converts ChangeResource to ResourceEntry.
73 scoped_ptr<google_apis::ResourceEntry>
74 ConvertChangeResourceToResourceEntry(
75 const google_apis::ChangeResource& change_resource);
76
77 // Converts FileList to ResourceList.
78 scoped_ptr<google_apis::ResourceList>
79 ConvertFileListToResourceList(const google_apis::FileList& file_list);
80
81 // Converts ChangeList to ResourceList.
82 scoped_ptr<google_apis::ResourceList>
83 ConvertChangeListToResourceList(const google_apis::ChangeList& change_list);
84
85 // Returns the (base-16 encoded) MD5 digest of the file content at |file_path|, 68 // Returns the (base-16 encoded) MD5 digest of the file content at |file_path|,
86 // or an empty string if an error is found. 69 // or an empty string if an error is found.
87 std::string GetMd5Digest(const base::FilePath& file_path); 70 std::string GetMd5Digest(const base::FilePath& file_path);
88 71
89 // Returns preferred file extension for hosted documents which have given mime 72 // Returns preferred file extension for hosted documents which have given mime
90 // type. 73 // type.
91 std::string GetHostedDocumentExtension(const std::string& mime_type); 74 std::string GetHostedDocumentExtension(const std::string& mime_type);
92 75
93 // Returns true if the given mime type is corresponding to one of known hosted 76 // Returns true if the given mime type is corresponding to one of known hosted
94 // document types. 77 // document types.
95 bool IsKnownHostedDocumentMimeType(const std::string& mime_type); 78 bool IsKnownHostedDocumentMimeType(const std::string& mime_type);
96 79
97 // Returns true if the given file path has an extension corresponding to one of 80 // Returns true if the given file path has an extension corresponding to one of
98 // hosted document types. 81 // hosted document types.
99 bool HasHostedDocumentExtension(const base::FilePath& path); 82 bool HasHostedDocumentExtension(const base::FilePath& path);
100 83
101 } // namespace util 84 } // namespace util
102 } // namespace drive 85 } // namespace drive
103 86
104 #endif // CHROME_BROWSER_DRIVE_DRIVE_API_UTIL_H_ 87 #endif // CHROME_BROWSER_DRIVE_DRIVE_API_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698