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_file_syste
m.h" | 5 #include "chrome/browser/chromeos/extensions/file_manager/private_api_file_syste
m.h" |
6 | 6 |
7 #include <sys/statvfs.h> | 7 #include <sys/statvfs.h> |
8 | 8 |
9 #include "base/posix/eintr_wrapper.h" | 9 #include "base/posix/eintr_wrapper.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 | 319 |
320 void FileBrowserPrivateRequestFileSystemFunction::OnEntryDefinition( | 320 void FileBrowserPrivateRequestFileSystemFunction::OnEntryDefinition( |
321 const EntryDefinition& entry_definition) { | 321 const EntryDefinition& entry_definition) { |
322 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 322 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
323 | 323 |
324 if (entry_definition.error != base::File::FILE_OK) { | 324 if (entry_definition.error != base::File::FILE_OK) { |
325 DidFail(entry_definition.error); | 325 DidFail(entry_definition.error); |
326 return; | 326 return; |
327 } | 327 } |
328 | 328 |
| 329 if (!entry_definition.is_directory) { |
| 330 DidFail(base::File::FILE_ERROR_NOT_A_DIRECTORY); |
| 331 return; |
| 332 } |
| 333 |
329 base::DictionaryValue* dict = new base::DictionaryValue(); | 334 base::DictionaryValue* dict = new base::DictionaryValue(); |
330 SetResult(dict); | 335 SetResult(dict); |
331 dict->SetString("name", entry_definition.file_system_name); | 336 dict->SetString("name", entry_definition.file_system_name); |
332 dict->SetString("root_url", entry_definition.file_system_root_url); | 337 dict->SetString("root_url", entry_definition.file_system_root_url); |
333 dict->SetInteger("error", drive::FILE_ERROR_OK); | 338 dict->SetInteger("error", drive::FILE_ERROR_OK); |
334 SendResponse(true); | 339 SendResponse(true); |
335 } | 340 } |
336 | 341 |
337 void FileWatchFunctionBase::Respond(bool success) { | 342 void FileWatchFunctionBase::Respond(bool success) { |
338 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 343 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
661 "/" + entry_definition_list->at(i).full_path.AsUTF8Unsafe(); | 666 "/" + entry_definition_list->at(i).full_path.AsUTF8Unsafe(); |
662 entry->file_is_directory = entry_definition_list->at(i).is_directory; | 667 entry->file_is_directory = entry_definition_list->at(i).is_directory; |
663 entries.push_back(entry); | 668 entries.push_back(entry); |
664 } | 669 } |
665 | 670 |
666 results_ = extensions::api::file_browser_private_internal:: | 671 results_ = extensions::api::file_browser_private_internal:: |
667 ResolveIsolatedEntries::Results::Create(entries); | 672 ResolveIsolatedEntries::Results::Create(entries); |
668 SendResponse(true); | 673 SendResponse(true); |
669 } | 674 } |
670 } // namespace extensions | 675 } // namespace extensions |
OLD | NEW |