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

Side by Side Diff: google_apis/drive/gdata_wapi_parser.cc

Issue 103013004: Google drive forms should not appear in the "offline" tab of Files.app. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « google_apis/drive/gdata_wapi_parser.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 "google_apis/drive/gdata_wapi_parser.h" 5 #include "google_apis/drive/gdata_wapi_parser.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 if (kEntryKindMap[i].extension) 529 if (kEntryKindMap[i].extension)
530 return std::string(kEntryKindMap[i].extension); 530 return std::string(kEntryKindMap[i].extension);
531 else 531 else
532 return std::string(); 532 return std::string();
533 } 533 }
534 } 534 }
535 return std::string(); 535 return std::string();
536 } 536 }
537 537
538 // static 538 // static
539 DriveEntryKind ResourceEntry::GetEntryKindFromExtension(
540 const std::string& extension) {
541 for (size_t i = 0; i < arraysize(kEntryKindMap); ++i) {
542 const char* document_extension = kEntryKindMap[i].extension;
543 if (document_extension && extension == document_extension)
544 return kEntryKindMap[i].kind;
545 }
546 return ENTRY_KIND_UNKNOWN;
547 }
548
549 // static
539 int ResourceEntry::ClassifyEntryKindByFileExtension( 550 int ResourceEntry::ClassifyEntryKindByFileExtension(
540 const base::FilePath& file_path) { 551 const base::FilePath& file_path) {
541 #if defined(OS_WIN) 552 #if defined(OS_WIN)
542 std::string file_extension = base::WideToUTF8(file_path.Extension()); 553 std::string file_extension = base::WideToUTF8(file_path.Extension());
543 #else 554 #else
544 std::string file_extension = file_path.Extension(); 555 std::string file_extension = file_path.Extension();
545 #endif 556 #endif
546 for (size_t i = 0; i < arraysize(kEntryKindMap); ++i) { 557 return ClassifyEntryKind(GetEntryKindFromExtension(file_extension));
547 const char* document_extension = kEntryKindMap[i].extension;
548 if (document_extension && file_extension == document_extension)
549 return ClassifyEntryKind(kEntryKindMap[i].kind);
550 }
551 return 0;
552 } 558 }
553 559
554 // static 560 // static
555 DriveEntryKind ResourceEntry::GetEntryKindFromTerm( 561 DriveEntryKind ResourceEntry::GetEntryKindFromTerm(
556 const std::string& term) { 562 const std::string& term) {
557 if (!StartsWithASCII(term, kTermPrefix, false)) { 563 if (!StartsWithASCII(term, kTermPrefix, false)) {
558 DVLOG(1) << "Unexpected term prefix term " << term; 564 DVLOG(1) << "Unexpected term prefix term " << term;
559 return ENTRY_KIND_UNKNOWN; 565 return ENTRY_KIND_UNKNOWN;
560 } 566 }
561 567
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
874 bool AccountMetadata::Parse(const base::Value& value) { 880 bool AccountMetadata::Parse(const base::Value& value) {
875 base::JSONValueConverter<AccountMetadata> converter; 881 base::JSONValueConverter<AccountMetadata> converter;
876 if (!converter.Convert(value, this)) { 882 if (!converter.Convert(value, this)) {
877 LOG(ERROR) << "Unable to parse: Invalid account metadata feed!"; 883 LOG(ERROR) << "Unable to parse: Invalid account metadata feed!";
878 return false; 884 return false;
879 } 885 }
880 return true; 886 return true;
881 } 887 }
882 888
883 } // namespace google_apis 889 } // namespace google_apis
OLDNEW
« no previous file with comments | « google_apis/drive/gdata_wapi_parser.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698