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

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

Issue 414203003: Remove unnecessary utilities from drive::util. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix test 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') | no next file » | 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 26 matching lines...) Expand all
37 {kGoogleDocumentMimeType, ".gdoc"}, 37 {kGoogleDocumentMimeType, ".gdoc"},
38 {kGoogleSpreadsheetMimeType, ".gsheet"}, 38 {kGoogleSpreadsheetMimeType, ".gsheet"},
39 {kGooglePresentationMimeType, ".gslides"}, 39 {kGooglePresentationMimeType, ".gslides"},
40 {kGoogleDrawingMimeType, ".gdraw"}, 40 {kGoogleDrawingMimeType, ".gdraw"},
41 {kGoogleTableMimeType, ".gtable"}, 41 {kGoogleTableMimeType, ".gtable"},
42 {kGoogleFormMimeType, ".gform"} 42 {kGoogleFormMimeType, ".gform"}
43 }; 43 };
44 44
45 } // namespace 45 } // namespace
46 46
47
48 std::string EscapeQueryStringValue(const std::string& str) { 47 std::string EscapeQueryStringValue(const std::string& str) {
49 std::string result; 48 std::string result;
50 result.reserve(str.size()); 49 result.reserve(str.size());
51 for (size_t i = 0; i < str.size(); ++i) { 50 for (size_t i = 0; i < str.size(); ++i) {
52 if (str[i] == '\\' || str[i] == '\'') { 51 if (str[i] == '\\' || str[i] == '\'') {
53 result.push_back('\\'); 52 result.push_back('\\');
54 } 53 }
55 result.push_back(str[i]); 54 result.push_back(str[i]);
56 } 55 }
57 return result; 56 return result;
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 334
336 offset += result; 335 offset += result;
337 base::MD5Update(&context, base::StringPiece(buffer.get(), result)); 336 base::MD5Update(&context, base::StringPiece(buffer.get(), result));
338 } 337 }
339 338
340 base::MD5Digest digest; 339 base::MD5Digest digest;
341 base::MD5Final(&digest, &context); 340 base::MD5Final(&digest, &context);
342 return MD5DigestToBase16(digest); 341 return MD5DigestToBase16(digest);
343 } 342 }
344 343
345 const char kWapiRootDirectoryResourceId[] = "folder:root";
346
347 std::string GetHostedDocumentExtension(const std::string& mime_type) { 344 std::string GetHostedDocumentExtension(const std::string& mime_type) {
348 for (size_t i = 0; i < arraysize(kHostedDocumentKinds); ++i) { 345 for (size_t i = 0; i < arraysize(kHostedDocumentKinds); ++i) {
349 if (mime_type == kHostedDocumentKinds[i].mime_type) 346 if (mime_type == kHostedDocumentKinds[i].mime_type)
350 return kHostedDocumentKinds[i].extension; 347 return kHostedDocumentKinds[i].extension;
351 } 348 }
352 return std::string(); 349 return std::string();
353 } 350 }
354 351
355 std::string GetHostedDocumentMimeType(const std::string& extension) {
356 for (size_t i = 0; i < arraysize(kHostedDocumentKinds); ++i) {
357 if (extension == kHostedDocumentKinds[i].extension)
358 return kHostedDocumentKinds[i].mime_type;
359 }
360 return std::string();
361 }
362
363 bool IsHostedDocument(const std::string& mime_type) { 352 bool IsHostedDocument(const std::string& mime_type) {
364 for (size_t i = 0; i < arraysize(kHostedDocumentKinds); ++i) { 353 for (size_t i = 0; i < arraysize(kHostedDocumentKinds); ++i) {
365 if (mime_type == kHostedDocumentKinds[i].mime_type) 354 if (mime_type == kHostedDocumentKinds[i].mime_type)
366 return true; 355 return true;
367 } 356 }
368 return false; 357 return false;
369 } 358 }
370 359
371 bool IsHostedDocumentByExtension(const std::string& extension) { 360 bool IsHostedDocumentByExtension(const std::string& extension) {
372 for (size_t i = 0; i < arraysize(kHostedDocumentKinds); ++i) { 361 for (size_t i = 0; i < arraysize(kHostedDocumentKinds); ++i) {
373 if (extension == kHostedDocumentKinds[i].extension) 362 if (extension == kHostedDocumentKinds[i].extension)
374 return true; 363 return true;
375 } 364 }
376 return false; 365 return false;
377 } 366 }
378 367
379 } // namespace util 368 } // namespace util
380 } // namespace drive 369 } // namespace drive
OLDNEW
« no previous file with comments | « chrome/browser/drive/drive_api_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698