| OLD | NEW |
| 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" |
| 11 #include "chrome/browser/chromeos/file_manager/fileapi_util.h" |
| 11 #include "chrome/browser/chromeos/file_manager/url_util.h" | 12 #include "chrome/browser/chromeos/file_manager/url_util.h" |
| 12 #include "chrome/browser/chromeos/fileapi/file_system_backend.h" | 13 #include "chrome/browser/chromeos/fileapi/file_system_backend.h" |
| 13 #include "chrome/browser/drive/drive_app_registry.h" | 14 #include "chrome/browser/drive/drive_app_registry.h" |
| 14 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
| 15 #include "chrome/common/extensions/api/file_browser_private.h" | 16 #include "chrome/common/extensions/api/file_browser_private.h" |
| 16 #include "content/public/browser/browser_thread.h" | 17 #include "content/public/browser/browser_thread.h" |
| 17 #include "webkit/common/fileapi/file_system_info.h" | 18 #include "webkit/common/fileapi/file_system_info.h" |
| 18 #include "webkit/common/fileapi/file_system_util.h" | 19 #include "webkit/common/fileapi/file_system_util.h" |
| 19 | 20 |
| 20 using content::BrowserThread; | 21 using content::BrowserThread; |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 | 398 |
| 398 base::ListValue* entries = new base::ListValue(); | 399 base::ListValue* entries = new base::ListValue(); |
| 399 | 400 |
| 400 // Convert Drive files to something File API stack can understand. | 401 // Convert Drive files to something File API stack can understand. |
| 401 fileapi::FileSystemInfo info = | 402 fileapi::FileSystemInfo info = |
| 402 fileapi::GetFileSystemInfoForChromeOS(source_url_.GetOrigin()); | 403 fileapi::GetFileSystemInfoForChromeOS(source_url_.GetOrigin()); |
| 403 for (size_t i = 0; i < results->size(); ++i) { | 404 for (size_t i = 0; i < results->size(); ++i) { |
| 404 base::DictionaryValue* entry = new base::DictionaryValue(); | 405 base::DictionaryValue* entry = new base::DictionaryValue(); |
| 405 entry->SetString("fileSystemName", info.name); | 406 entry->SetString("fileSystemName", info.name); |
| 406 entry->SetString("fileSystemRoot", info.root_url.spec()); | 407 entry->SetString("fileSystemRoot", info.root_url.spec()); |
| 407 entry->SetString("fileFullPath", "/" + results->at(i).path.value()); | 408 entry->SetString("fileFullPath", |
| 409 "/" + file_manager::util::ConvertDrivePathToRelativeFileSystemPath( |
| 410 GetProfile(), results->at(i).path).AsUTF8Unsafe()); |
| 408 entry->SetBoolean("fileIsDirectory", results->at(i).is_directory); | 411 entry->SetBoolean("fileIsDirectory", results->at(i).is_directory); |
| 409 entries->Append(entry); | 412 entries->Append(entry); |
| 410 } | 413 } |
| 411 | 414 |
| 412 base::DictionaryValue* result = new base::DictionaryValue(); | 415 base::DictionaryValue* result = new base::DictionaryValue(); |
| 413 result->Set("entries", entries); | 416 result->Set("entries", entries); |
| 414 result->SetString("nextFeed", next_link.spec()); | 417 result->SetString("nextFeed", next_link.spec()); |
| 415 | 418 |
| 416 SetResult(result); | 419 SetResult(result); |
| 417 SendResponse(true); | 420 SendResponse(true); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 484 // converted to a FileEntry. | 487 // converted to a FileEntry. |
| 485 fileapi::FileSystemInfo info = | 488 fileapi::FileSystemInfo info = |
| 486 fileapi::GetFileSystemInfoForChromeOS(source_url_.GetOrigin()); | 489 fileapi::GetFileSystemInfoForChromeOS(source_url_.GetOrigin()); |
| 487 for (size_t i = 0; i < results->size(); ++i) { | 490 for (size_t i = 0; i < results->size(); ++i) { |
| 488 base::DictionaryValue* result_dict = new base::DictionaryValue(); | 491 base::DictionaryValue* result_dict = new base::DictionaryValue(); |
| 489 | 492 |
| 490 // FileEntry fields. | 493 // FileEntry fields. |
| 491 base::DictionaryValue* entry = new base::DictionaryValue(); | 494 base::DictionaryValue* entry = new base::DictionaryValue(); |
| 492 entry->SetString("fileSystemName", info.name); | 495 entry->SetString("fileSystemName", info.name); |
| 493 entry->SetString("fileSystemRoot", info.root_url.spec()); | 496 entry->SetString("fileSystemRoot", info.root_url.spec()); |
| 494 entry->SetString("fileFullPath", "/" + results->at(i).path.value()); | 497 entry->SetString("fileFullPath", |
| 498 "/" + file_manager::util::ConvertDrivePathToRelativeFileSystemPath( |
| 499 GetProfile(), results->at(i).path).AsUTF8Unsafe()); |
| 495 entry->SetBoolean("fileIsDirectory", | 500 entry->SetBoolean("fileIsDirectory", |
| 496 results->at(i).entry.file_info().is_directory()); | 501 results->at(i).entry.file_info().is_directory()); |
| 497 | 502 |
| 498 result_dict->Set("entry", entry); | 503 result_dict->Set("entry", entry); |
| 499 result_dict->SetString("highlightedBaseName", | 504 result_dict->SetString("highlightedBaseName", |
| 500 results->at(i).highlighted_base_name); | 505 results->at(i).highlighted_base_name); |
| 501 results_list->Append(result_dict); | 506 results_list->Append(result_dict); |
| 502 } | 507 } |
| 503 | 508 |
| 504 SetResult(results_list); | 509 SetResult(results_list); |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 602 error_ = "Share Url for this item is not available."; | 607 error_ = "Share Url for this item is not available."; |
| 603 SendResponse(false); | 608 SendResponse(false); |
| 604 return; | 609 return; |
| 605 } | 610 } |
| 606 | 611 |
| 607 SetResult(new base::StringValue(share_url.spec())); | 612 SetResult(new base::StringValue(share_url.spec())); |
| 608 SendResponse(true); | 613 SendResponse(true); |
| 609 } | 614 } |
| 610 | 615 |
| 611 } // namespace extensions | 616 } // namespace extensions |
| OLD | NEW |