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

Side by Side Diff: chrome/browser/chromeos/extensions/file_manager/private_api_drive.cc

Issue 141473004: Random cleanup for c/b/cros/extensions/file_manager. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/extensions/file_manager/private_api_drive.h" 5 #include "chrome/browser/chromeos/extensions/file_manager/private_api_drive.h"
6 6
7 #include "chrome/browser/chromeos/drive/drive_integration_service.h" 7 #include "chrome/browser/chromeos/drive/drive_integration_service.h"
8 #include "chrome/browser/chromeos/drive/logging.h" 8 #include "chrome/browser/chromeos/drive/logging.h"
9 #include "chrome/browser/chromeos/extensions/file_manager/private_api_util.h" 9 #include "chrome/browser/chromeos/extensions/file_manager/private_api_util.h"
10 #include "chrome/browser/chromeos/file_manager/file_tasks.h" 10 #include "chrome/browser/chromeos/file_manager/file_tasks.h"
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 return true; 221 return true;
222 } 222 }
223 223
224 void FileBrowserPrivatePinDriveFileFunction:: 224 void FileBrowserPrivatePinDriveFileFunction::
225 OnPinStateSet(drive::FileError error) { 225 OnPinStateSet(drive::FileError error) {
226 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 226 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
227 227
228 if (error == drive::FILE_ERROR_OK) { 228 if (error == drive::FILE_ERROR_OK) {
229 SendResponse(true); 229 SendResponse(true);
230 } else { 230 } else {
231 error_ = drive::FileErrorToString(error); 231 SetError(drive::FileErrorToString(error));
232 SendResponse(false); 232 SendResponse(false);
233 } 233 }
234 } 234 }
235 235
236 FileBrowserPrivateGetDriveFilesFunction:: 236 FileBrowserPrivateGetDriveFilesFunction::
237 FileBrowserPrivateGetDriveFilesFunction() { 237 FileBrowserPrivateGetDriveFilesFunction() {
238 } 238 }
239 239
240 FileBrowserPrivateGetDriveFilesFunction:: 240 FileBrowserPrivateGetDriveFilesFunction::
241 ~FileBrowserPrivateGetDriveFilesFunction() { 241 ~FileBrowserPrivateGetDriveFilesFunction() {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 288
289 void FileBrowserPrivateGetDriveFilesFunction::OnFileReady( 289 void FileBrowserPrivateGetDriveFilesFunction::OnFileReady(
290 drive::FileError error, 290 drive::FileError error,
291 const base::FilePath& local_path, 291 const base::FilePath& local_path,
292 scoped_ptr<drive::ResourceEntry> entry) { 292 scoped_ptr<drive::ResourceEntry> entry) {
293 base::FilePath drive_path = remaining_drive_paths_.front(); 293 base::FilePath drive_path = remaining_drive_paths_.front();
294 294
295 if (error == drive::FILE_ERROR_OK) { 295 if (error == drive::FILE_ERROR_OK) {
296 local_paths_.push_back(local_path.AsUTF8Unsafe()); 296 local_paths_.push_back(local_path.AsUTF8Unsafe());
297 DVLOG(1) << "Got " << drive_path.value() << " as " << local_path.value(); 297 DVLOG(1) << "Got " << drive_path.value() << " as " << local_path.value();
298
299 // TODO(benchan): If the file is a hosted document, a temporary JSON file
300 // is created to represent the document. The JSON file is not cached and
301 // should be deleted after use. We need to somehow communicate with
302 // file_manager.js to manage the lifetime of the temporary file.
303 // See crosbug.com/28058.
304 } else { 298 } else {
305 local_paths_.push_back(""); 299 local_paths_.push_back("");
306 DVLOG(1) << "Failed to get " << drive_path.value() 300 DVLOG(1) << "Failed to get " << drive_path.value()
307 << " with error code: " << error; 301 << " with error code: " << error;
308 } 302 }
309 303
310 remaining_drive_paths_.pop(); 304 remaining_drive_paths_.pop();
311 305
312 // Start getting the next file. 306 // Start getting the next file.
313 GetFileOrSendResponse(); 307 GetFileOrSendResponse();
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 drive_path, 591 drive_path,
598 file_manager::util::GetFileManagerBaseUrl(), // embed origin 592 file_manager::util::GetFileManagerBaseUrl(), // embed origin
599 base::Bind(&FileBrowserPrivateGetShareUrlFunction::OnGetShareUrl, this)); 593 base::Bind(&FileBrowserPrivateGetShareUrlFunction::OnGetShareUrl, this));
600 return true; 594 return true;
601 } 595 }
602 596
603 void FileBrowserPrivateGetShareUrlFunction::OnGetShareUrl( 597 void FileBrowserPrivateGetShareUrlFunction::OnGetShareUrl(
604 drive::FileError error, 598 drive::FileError error,
605 const GURL& share_url) { 599 const GURL& share_url) {
606 if (error != drive::FILE_ERROR_OK) { 600 if (error != drive::FILE_ERROR_OK) {
607 error_ = "Share Url for this item is not available."; 601 SetError("Share Url for this item is not available.");
608 SendResponse(false); 602 SendResponse(false);
609 return; 603 return;
610 } 604 }
611 605
612 SetResult(new base::StringValue(share_url.spec())); 606 SetResult(new base::StringValue(share_url.spec()));
613 SendResponse(true); 607 SendResponse(true);
614 } 608 }
615 609
616 } // namespace extensions 610 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698