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

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

Issue 137343008: Make chrome.fileSystem.chooseEntry work on Google Drive directories. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix test. 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
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/fake_drive_service.h" 5 #include "chrome/browser/drive/fake_drive_service.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after
774 // Go through entries and copy the one that matches |resource_id|. 774 // Go through entries and copy the one that matches |resource_id|.
775 if (resource_list_value_->GetList("entry", &entries)) { 775 if (resource_list_value_->GetList("entry", &entries)) {
776 for (size_t i = 0; i < entries->GetSize(); ++i) { 776 for (size_t i = 0; i < entries->GetSize(); ++i) {
777 base::DictionaryValue* entry = NULL; 777 base::DictionaryValue* entry = NULL;
778 std::string current_resource_id; 778 std::string current_resource_id;
779 if (entries->GetDictionary(i, &entry) && 779 if (entries->GetDictionary(i, &entry) &&
780 entry->GetString("gd$resourceId.$t", &current_resource_id) && 780 entry->GetString("gd$resourceId.$t", &current_resource_id) &&
781 resource_id == current_resource_id) { 781 resource_id == current_resource_id) {
782 // Make a copy and set the new resource ID and the new title. 782 // Make a copy and set the new resource ID and the new title.
783 scoped_ptr<base::DictionaryValue> copied_entry(entry->DeepCopy()); 783 scoped_ptr<base::DictionaryValue> copied_entry(entry->DeepCopy());
784 copied_entry->SetString("gd$resourceId.$t", 784 copied_entry->SetString("gd$resourceId.$t", GetNewResourceId());
785 resource_id + "_copied");
786 copied_entry->SetString("title.$t", new_title); 785 copied_entry->SetString("title.$t", new_title);
787 786
788 // Reset parent directory. 787 // Reset parent directory.
789 base::ListValue* links = NULL; 788 base::ListValue* links = NULL;
790 if (!copied_entry->GetList("link", &links)) { 789 if (!copied_entry->GetList("link", &links)) {
791 links = new base::ListValue; 790 links = new base::ListValue;
792 copied_entry->Set("link", links); 791 copied_entry->Set("link", links);
793 } 792 }
794 links->Clear(); 793 links->Clear();
795 794
(...skipping 937 matching lines...) Expand 10 before | Expand all | Expand 10 after
1733 FROM_HERE, 1732 FROM_HERE,
1734 base::Bind(callback, HTTP_SUCCESS, base::Passed(&resource_list))); 1733 base::Bind(callback, HTTP_SUCCESS, base::Passed(&resource_list)));
1735 } 1734 }
1736 1735
1737 GURL FakeDriveService::GetNewUploadSessionUrl() { 1736 GURL FakeDriveService::GetNewUploadSessionUrl() {
1738 return GURL("https://upload_session_url/" + 1737 return GURL("https://upload_session_url/" +
1739 base::Int64ToString(next_upload_sequence_number_++)); 1738 base::Int64ToString(next_upload_sequence_number_++));
1740 } 1739 }
1741 1740
1742 } // namespace drive 1741 } // namespace drive
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/drive/file_system_util.cc ('k') | chrome/browser/drive/fake_drive_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698