OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 // TODO : Support NP_ASFILEONLY mode | 5 // TODO : Support NP_ASFILEONLY mode |
6 // TODO : Support NP_SEEK mode | 6 // TODO : Support NP_SEEK mode |
7 // TODO : Support SEEKABLE=true in NewStream | 7 // TODO : Support SEEKABLE=true in NewStream |
8 | 8 |
9 #include "config.h" | 9 #include "config.h" |
10 | 10 |
11 #include "webkit/glue/plugins/plugin_stream.h" | 11 #include "webkit/glue/plugins/plugin_stream.h" |
12 | 12 |
13 #include "base/string_util.h" | 13 #include "base/string_util.h" |
14 #include "base/message_loop.h" | 14 #include "base/message_loop.h" |
| 15 #include "net/base/mime_util.h" |
15 #include "webkit/glue/plugins/plugin_instance.h" | 16 #include "webkit/glue/plugins/plugin_instance.h" |
16 #include "webkit/glue/webkit_glue.h" | |
17 #include "googleurl/src/gurl.h" | 17 #include "googleurl/src/gurl.h" |
18 | 18 |
19 namespace NPAPI { | 19 namespace NPAPI { |
20 | 20 |
21 PluginStream::~PluginStream() { | 21 PluginStream::~PluginStream() { |
22 // always close our temporary files. | 22 // always close our temporary files. |
23 CloseTempFile(); | 23 CloseTempFile(); |
24 free(const_cast<char*>(stream_.url)); | 24 free(const_cast<char*>(stream_.url)); |
25 } | 25 } |
26 | 26 |
(...skipping 23 matching lines...) Expand all Loading... |
50 if (!mime_type.empty()) { | 50 if (!mime_type.empty()) { |
51 char_mime_type = mime_type.c_str(); | 51 char_mime_type = mime_type.c_str(); |
52 } else { | 52 } else { |
53 GURL gurl(stream_.url); | 53 GURL gurl(stream_.url); |
54 | 54 |
55 #if defined(OS_WIN) | 55 #if defined(OS_WIN) |
56 FilePath path(UTF8ToWide(gurl.path())); | 56 FilePath path(UTF8ToWide(gurl.path())); |
57 #elif defined(OS_POSIX) | 57 #elif defined(OS_POSIX) |
58 FilePath path(gurl.path()); | 58 FilePath path(gurl.path()); |
59 #endif | 59 #endif |
60 if (webkit_glue::GetMimeTypeFromFile(path, &temp_mime_type)) | 60 if (net::GetMimeTypeFromFile(path, &temp_mime_type)) |
61 char_mime_type = temp_mime_type.c_str(); | 61 char_mime_type = temp_mime_type.c_str(); |
62 } | 62 } |
63 | 63 |
64 // Silverlight expects a valid mime type | 64 // Silverlight expects a valid mime type |
65 DCHECK(strlen(char_mime_type) != 0); | 65 DCHECK(strlen(char_mime_type) != 0); |
66 NPError err = instance_->NPP_NewStream((NPMIMEType)char_mime_type, | 66 NPError err = instance_->NPP_NewStream((NPMIMEType)char_mime_type, |
67 &stream_, seekable_stream, | 67 &stream_, seekable_stream, |
68 &requested_plugin_mode_); | 68 &requested_plugin_mode_); |
69 if (err != NPERR_NO_ERROR) { | 69 if (err != NPERR_NO_ERROR) { |
70 Notify(err); | 70 Notify(err); |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 | 244 |
245 void PluginStream::Notify(NPReason reason) { | 245 void PluginStream::Notify(NPReason reason) { |
246 if (notify_needed_) { | 246 if (notify_needed_) { |
247 instance_->NPP_URLNotify(stream_.url, reason, notify_data_); | 247 instance_->NPP_URLNotify(stream_.url, reason, notify_data_); |
248 notify_needed_ = false; | 248 notify_needed_ = false; |
249 } | 249 } |
250 } | 250 } |
251 | 251 |
252 } // namespace NPAPI | 252 } // namespace NPAPI |
253 | 253 |
OLD | NEW |