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

Side by Side Diff: WebCore/html/File.cpp

Issue 1769002: BlobBuilder/FormData refactor attempt (Closed)
Patch Set: back to simple FormData Created 10 years, 6 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
« no previous file with comments | « WebCore/html/File.h ('k') | WebCore/html/FileReader.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 Apple 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 15 matching lines...) Expand all
26 #include "config.h" 26 #include "config.h"
27 #include "File.h" 27 #include "File.h"
28 28
29 #include "FileSystem.h" 29 #include "FileSystem.h"
30 #include "MIMETypeRegistry.h" 30 #include "MIMETypeRegistry.h"
31 31
32 namespace WebCore { 32 namespace WebCore {
33 33
34 File::File(const String& path) 34 File::File(const String& path)
35 : Blob(path) 35 : Blob(path)
36 , m_name(pathGetFileName(path))
37 { 36 {
38 // We don't use MIMETypeRegistry::getMIMETypeForPath() because it returns "a pplication/octet-stream" upon failure. 37 // We don't use MIMETypeRegistry::getMIMETypeForPath() because it returns "a pplication/octet-stream" upon failure.
39 int index = m_name.reverseFind('.'); 38 const String& fileName = name();
39 int index = fileName.reverseFind('.');
40 if (index != -1) 40 if (index != -1)
41 m_type = MIMETypeRegistry::getMIMETypeForExtension(m_name.substring(inde x + 1)); 41 m_type = MIMETypeRegistry::getMIMETypeForExtension(fileName.substring(in dex + 1));
42 }
43
44 const String& File::name() const
45 {
46 return items().at(0)->toFileBlobItem()->name();
42 } 47 }
43 48
44 } // namespace WebCore 49 } // namespace WebCore
OLDNEW
« no previous file with comments | « WebCore/html/File.h ('k') | WebCore/html/FileReader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698