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

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

Issue 443303003: Random cleanup around google_apis/drive and c/b/drive. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/drive/drive_api_util.h ('k') | google_apis/drive/auth_service.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "chrome/browser/drive/drive_api_util.h" 5 #include "chrome/browser/drive/drive_api_util.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/files/file.h" 9 #include "base/files/file.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 std::string CanonicalizeResourceId(const std::string& resource_id) { 129 std::string CanonicalizeResourceId(const std::string& resource_id) {
130 // If resource ID is in the old WAPI format starting with a prefix like 130 // If resource ID is in the old WAPI format starting with a prefix like
131 // "document:", strip it and return the remaining part. 131 // "document:", strip it and return the remaining part.
132 std::string stripped_resource_id; 132 std::string stripped_resource_id;
133 if (RE2::FullMatch(resource_id, "^[a-z-]+(?::|%3A)([\\w-]+)$", 133 if (RE2::FullMatch(resource_id, "^[a-z-]+(?::|%3A)([\\w-]+)$",
134 &stripped_resource_id)) 134 &stripped_resource_id))
135 return stripped_resource_id; 135 return stripped_resource_id;
136 return resource_id; 136 return resource_id;
137 } 137 }
138 138
139 const char kDocsListScope[] = "https://docs.google.com/feeds/";
140 const char kDriveAppsScope[] = "https://www.googleapis.com/auth/drive.apps";
141
142 scoped_ptr<google_apis::ResourceEntry> 139 scoped_ptr<google_apis::ResourceEntry>
143 ConvertFileResourceToResourceEntry( 140 ConvertFileResourceToResourceEntry(
144 const google_apis::FileResource& file_resource) { 141 const google_apis::FileResource& file_resource) {
145 scoped_ptr<google_apis::ResourceEntry> entry(new google_apis::ResourceEntry); 142 scoped_ptr<google_apis::ResourceEntry> entry(new google_apis::ResourceEntry);
146 143
147 // ResourceEntry 144 // ResourceEntry
148 entry->set_resource_id(file_resource.file_id()); 145 entry->set_resource_id(file_resource.file_id());
149 entry->set_id(file_resource.file_id()); 146 entry->set_id(file_resource.file_id());
150 if (file_resource.IsDirectory()) 147 if (file_resource.IsDirectory())
151 entry->set_kind(google_apis::ResourceEntry::ENTRY_KIND_FOLDER); 148 entry->set_kind(google_apis::ResourceEntry::ENTRY_KIND_FOLDER);
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 const std::string extension = base::FilePath(path.Extension()).AsUTF8Unsafe(); 330 const std::string extension = base::FilePath(path.Extension()).AsUTF8Unsafe();
334 for (size_t i = 0; i < arraysize(kHostedDocumentKinds); ++i) { 331 for (size_t i = 0; i < arraysize(kHostedDocumentKinds); ++i) {
335 if (extension == kHostedDocumentKinds[i].extension) 332 if (extension == kHostedDocumentKinds[i].extension)
336 return true; 333 return true;
337 } 334 }
338 return extension == kUnknownHostedDocumentExtension; 335 return extension == kUnknownHostedDocumentExtension;
339 } 336 }
340 337
341 } // namespace util 338 } // namespace util
342 } // namespace drive 339 } // namespace drive
OLDNEW
« no previous file with comments | « chrome/browser/drive/drive_api_util.h ('k') | google_apis/drive/auth_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698