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

Side by Side Diff: chrome/browser/chromeos/drive/file_system/copy_operation.cc

Issue 276313002: drive: Change FileCache::GetCacheEntry's return type to FileError (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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/chromeos/drive/file_system/copy_operation.h" 5 #include "chrome/browser/chromeos/drive/file_system/copy_operation.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/task_runner_util.h" 10 #include "base/task_runner_util.h"
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 break; 111 break;
112 case FILE_ERROR_NOT_FOUND: 112 case FILE_ERROR_NOT_FOUND:
113 break; 113 break;
114 default: 114 default:
115 return error; 115 return error;
116 } 116 }
117 117
118 // If the cache file is not present and the entry exists on the server, 118 // If the cache file is not present and the entry exists on the server,
119 // server side copy should be used. 119 // server side copy should be used.
120 FileCacheEntry cache_entry; 120 FileCacheEntry cache_entry;
121 cache->GetCacheEntry(params->src_entry.local_id(), &cache_entry); 121 error = cache->GetCacheEntry(params->src_entry.local_id(), &cache_entry);
122 if (error != FILE_ERROR_OK && error != FILE_ERROR_NOT_FOUND)
123 return error;
122 if (!cache_entry.is_present() && !params->src_entry.resource_id().empty()) { 124 if (!cache_entry.is_present() && !params->src_entry.resource_id().empty()) {
123 *should_copy_on_server = true; 125 *should_copy_on_server = true;
124 return FILE_ERROR_OK; 126 return FILE_ERROR_OK;
125 } 127 }
126 128
127 // Copy locally. 129 // Copy locally.
128 ResourceEntry entry; 130 ResourceEntry entry;
129 const int64 now = base::Time::Now().ToInternalValue(); 131 const int64 now = base::Time::Now().ToInternalValue();
130 entry.set_title(params->dest_file_path.BaseName().AsUTF8Unsafe()); 132 entry.set_title(params->dest_file_path.BaseName().AsUTF8Unsafe());
131 entry.set_parent_local_id(params->parent_entry.local_id()); 133 entry.set_parent_local_id(params->parent_entry.local_id());
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 582
581 if (error == FILE_ERROR_OK) { 583 if (error == FILE_ERROR_OK) {
582 observer_->OnDirectoryChangedByOperation(remote_dest_path.DirName()); 584 observer_->OnDirectoryChangedByOperation(remote_dest_path.DirName());
583 observer_->OnEntryUpdatedByOperation(*local_id); 585 observer_->OnEntryUpdatedByOperation(*local_id);
584 } 586 }
585 callback.Run(error); 587 callback.Run(error);
586 } 588 }
587 589
588 } // namespace file_system 590 } // namespace file_system
589 } // namespace drive 591 } // namespace drive
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/drive/file_system.cc ('k') | chrome/browser/chromeos/drive/file_system/copy_operation_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698