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

Side by Side Diff: net/base/platform_mime_util_linux.cc

Issue 8429034: Upstream: Build net_unittests for Android. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 9 years, 1 month 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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "net/base/platform_mime_util.h" 5 #include "net/base/platform_mime_util.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
11 11
12 #if defined(OS_ANDROID) 12 #if defined(OS_ANDROID)
13 #include "net/android/network_library.h" 13 #include "net/android/network_library.h"
14 #else 14 #else
15 #include "base/mime_util.h" 15 #include "base/mime_util.h"
16 #endif 16 #endif
17 17
18 namespace net { 18 namespace net {
19 19
20 #if defined(OS_ANDROID) 20 #if defined(OS_ANDROID)
21 bool PlatformMimeUtil::GetPlatformMimeTypeFromExtension( 21 bool PlatformMimeUtil::GetPlatformMimeTypeFromExtension(
22 const FilePath::StringType& ext, std::string* result) const { 22 const FilePath::StringType& ext, std::string* result) const {
23 return android::GetMimeTypeFromExtension(ext, result); 23 // TODO(jingzhao): Replace "false" with
24 // "android::GetMimeTypeFromExtension(ext, result)" once we support JNI.
John Grabowski 2011/11/01 23:09:34 Please start spreadsheet docing these "once we hav
Jing Zhao 2011/11/02 16:22:55 Done.
25 return false;
24 } 26 }
25 #elif defined(USE_AURA) 27 #elif defined(USE_AURA)
26 bool PlatformMimeUtil::GetPlatformMimeTypeFromExtension( 28 bool PlatformMimeUtil::GetPlatformMimeTypeFromExtension(
27 const FilePath::StringType& ext, std::string* result) const { 29 const FilePath::StringType& ext, std::string* result) const {
28 NOTIMPLEMENTED(); 30 NOTIMPLEMENTED();
29 return false; 31 return false;
30 } 32 }
31 #else 33 #else
32 bool PlatformMimeUtil::GetPlatformMimeTypeFromExtension( 34 bool PlatformMimeUtil::GetPlatformMimeTypeFromExtension(
33 const FilePath::StringType& ext, std::string* result) const { 35 const FilePath::StringType& ext, std::string* result) const {
34 // TODO(thestig) This is a temporary hack until we can fix this 36 // TODO(thestig): This is a temporary hack until we can fix this
35 // properly in test shell / webkit. 37 // properly in test shell / webkit.
36 // We have to play dumb and not return application/x-perl here 38 // We have to play dumb and not return application/x-perl here
37 // to make the reload-subframe-object layout test happy. 39 // to make the reload-subframe-object layout test happy.
38 if (ext == "pl") 40 if (ext == "pl")
39 return false; 41 return false;
40 42
41 FilePath dummy_path("foo." + ext); 43 FilePath dummy_path("foo." + ext);
42 std::string out = mime_util::GetFileMimeType(dummy_path); 44 std::string out = mime_util::GetFileMimeType(dummy_path);
43 45
44 // GetFileMimeType likes to return application/octet-stream 46 // GetFileMimeType likes to return application/octet-stream
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 // 100 //
99 // If we wanted to do this properly, we would read the mime.cache file which 101 // If we wanted to do this properly, we would read the mime.cache file which
100 // has a section where they assign a glob (*.gif) to a mimetype 102 // has a section where they assign a glob (*.gif) to a mimetype
101 // (image/gif). We look up the "heaviest" glob for a certain mime type and 103 // (image/gif). We look up the "heaviest" glob for a certain mime type and
102 // then then try to chop off "*.". 104 // then then try to chop off "*.".
103 105
104 return false; 106 return false;
105 } 107 }
106 108
107 } // namespace net 109 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698