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

Side by Side Diff: third_party/WebKit/Source/modules/filesystem/DataTransferItemFileSystem.cpp

Issue 2810513002: Replace ASSERT, ASSERT_NOT_REACHED, and RELEASE_ASSERT in modules/filesystem (Closed)
Patch Set: split Created 3 years, 8 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 Entry* DataTransferItemFileSystem::webkitGetAsEntry(ScriptState* script_state, 50 Entry* DataTransferItemFileSystem::webkitGetAsEntry(ScriptState* script_state,
51 DataTransferItem& item) { 51 DataTransferItem& item) {
52 if (!item.GetDataObjectItem()->IsFilename()) 52 if (!item.GetDataObjectItem()->IsFilename())
53 return 0; 53 return 0;
54 54
55 // For dragged files getAsFile must be pretty lightweight. 55 // For dragged files getAsFile must be pretty lightweight.
56 Blob* file = item.getAsFile(); 56 Blob* file = item.getAsFile();
57 // The clipboard may not be in a readable state. 57 // The clipboard may not be in a readable state.
58 if (!file) 58 if (!file)
59 return 0; 59 return 0;
60 ASSERT(file->IsFile()); 60 DCHECK(file->IsFile());
61 61
62 DOMFileSystem* dom_file_system = 62 DOMFileSystem* dom_file_system =
63 DraggedIsolatedFileSystemImpl::GetDOMFileSystem( 63 DraggedIsolatedFileSystemImpl::GetDOMFileSystem(
64 item.GetDataTransfer()->GetDataObject(), 64 item.GetDataTransfer()->GetDataObject(),
65 script_state->GetExecutionContext(), *item.GetDataObjectItem()); 65 script_state->GetExecutionContext(), *item.GetDataObjectItem());
66 if (!dom_file_system) { 66 if (!dom_file_system) {
67 // IsolatedFileSystem may not be enabled. 67 // IsolatedFileSystem may not be enabled.
68 return 0; 68 return 0;
69 } 69 }
70 70
71 // The dropped entries are mapped as top-level entries in the isolated 71 // The dropped entries are mapped as top-level entries in the isolated
72 // filesystem. 72 // filesystem.
73 String virtual_path = DOMFilePath::Append("/", ToFile(file)->name()); 73 String virtual_path = DOMFilePath::Append("/", ToFile(file)->name());
74 74
75 // FIXME: This involves synchronous file operation. Consider passing file type 75 // FIXME: This involves synchronous file operation. Consider passing file type
76 // data when we dispatch drag event. 76 // data when we dispatch drag event.
77 FileMetadata metadata; 77 FileMetadata metadata;
78 if (!GetFileMetadata(ToFile(file)->GetPath(), metadata)) 78 if (!GetFileMetadata(ToFile(file)->GetPath(), metadata))
79 return 0; 79 return 0;
80 80
81 if (metadata.type == FileMetadata::kTypeDirectory) 81 if (metadata.type == FileMetadata::kTypeDirectory)
82 return DirectoryEntry::Create(dom_file_system, virtual_path); 82 return DirectoryEntry::Create(dom_file_system, virtual_path);
83 return FileEntry::Create(dom_file_system, virtual_path); 83 return FileEntry::Create(dom_file_system, virtual_path);
84 } 84 }
85 85
86 } // namespace blink 86 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698