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

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

Issue 416223003: Unify HasGDocFileExtension and IsHostedDocumentByExtentoin. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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') | chrome/browser/drive/drive_api_util_unittest.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 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 } 361 }
362 362
363 bool IsHostedDocument(const std::string& mime_type) { 363 bool IsHostedDocument(const std::string& mime_type) {
364 for (size_t i = 0; i < arraysize(kHostedDocumentKinds); ++i) { 364 for (size_t i = 0; i < arraysize(kHostedDocumentKinds); ++i) {
365 if (mime_type == kHostedDocumentKinds[i].mime_type) 365 if (mime_type == kHostedDocumentKinds[i].mime_type)
366 return true; 366 return true;
367 } 367 }
368 return false; 368 return false;
369 } 369 }
370 370
371 bool IsHostedDocumentByExtension(const std::string& extension) { 371 bool HasHostedDocumentExtension(const base::FilePath& path) {
372 const std::string extension = base::FilePath(path.Extension()).AsUTF8Unsafe();
372 for (size_t i = 0; i < arraysize(kHostedDocumentKinds); ++i) { 373 for (size_t i = 0; i < arraysize(kHostedDocumentKinds); ++i) {
373 if (extension == kHostedDocumentKinds[i].extension) 374 if (extension == kHostedDocumentKinds[i].extension)
374 return true; 375 return true;
375 } 376 }
376 return false; 377 return false;
377 } 378 }
378 379
379 } // namespace util 380 } // namespace util
380 } // namespace drive 381 } // namespace drive
OLDNEW
« no previous file with comments | « chrome/browser/drive/drive_api_util.h ('k') | chrome/browser/drive/drive_api_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698