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

Side by Side Diff: webkit/plugins/npapi/plugin_stream.cc

Issue 14680012: Clean up ifdef around FilePath creation(webkit) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@filepath2
Patch Set: Clean up ifdef around FilePath creation(webkit) Created 7 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
« net/base/mime_util.cc ('K') | « net/base/mime_util.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "webkit/plugins/npapi/plugin_stream.h" 9 #include "webkit/plugins/npapi/plugin_stream.h"
10 10
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 } 76 }
77 } 77 }
78 78
79 const char* char_mime_type = "application/x-unknown-content-type"; 79 const char* char_mime_type = "application/x-unknown-content-type";
80 std::string temp_mime_type; 80 std::string temp_mime_type;
81 if (!mime_type.empty()) { 81 if (!mime_type.empty()) {
82 char_mime_type = mime_type.c_str(); 82 char_mime_type = mime_type.c_str();
83 } else { 83 } else {
84 GURL gurl(stream_.url); 84 GURL gurl(stream_.url);
85 85
86 #if defined(OS_WIN) 86 base::FilePath path = base::FilePath::FromUTF8Unsafe(gurl.path());
87 base::FilePath path(UTF8ToWide(gurl.path()));
88 #elif defined(OS_POSIX)
89 base::FilePath path(gurl.path());
90 #endif
91 if (net::GetMimeTypeFromFile(path, &temp_mime_type)) 87 if (net::GetMimeTypeFromFile(path, &temp_mime_type))
92 char_mime_type = temp_mime_type.c_str(); 88 char_mime_type = temp_mime_type.c_str();
93 } 89 }
94 90
95 // Silverlight expects a valid mime type 91 // Silverlight expects a valid mime type
96 DCHECK_NE(0U, strlen(char_mime_type)); 92 DCHECK_NE(0U, strlen(char_mime_type));
97 NPError err = instance_->NPP_NewStream((NPMIMEType)char_mime_type, 93 NPError err = instance_->NPP_NewStream((NPMIMEType)char_mime_type,
98 &stream_, seekable_stream, 94 &stream_, seekable_stream,
99 &requested_plugin_mode_); 95 &requested_plugin_mode_);
100 if (err != NPERR_NO_ERROR) { 96 if (err != NPERR_NO_ERROR) {
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 } 280 }
285 } 281 }
286 282
287 bool PluginStream::RequestedPluginModeIsAsFile() const { 283 bool PluginStream::RequestedPluginModeIsAsFile() const {
288 return (requested_plugin_mode_ == NP_ASFILE || 284 return (requested_plugin_mode_ == NP_ASFILE ||
289 requested_plugin_mode_ == NP_ASFILEONLY); 285 requested_plugin_mode_ == NP_ASFILEONLY);
290 } 286 }
291 287
292 } // namespace npapi 288 } // namespace npapi
293 } // namespace webkit 289 } // namespace webkit
OLDNEW
« net/base/mime_util.cc ('K') | « net/base/mime_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698