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

Side by Side Diff: webkit/glue/webframeloaderclient_impl.cc

Issue 344030: Handle the fact that MIMETypeRegistry::getMIMETypeForPath returns... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 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
« no previous file with comments | « no previous file | 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) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 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 "config.h" 5 #include "config.h"
6 6
7 #include "Chrome.h" 7 #include "Chrome.h"
8 #include "CString.h" 8 #include "CString.h"
9 #include "Document.h" 9 #include "Document.h"
10 #include "DocumentLoader.h" 10 #include "DocumentLoader.h"
(...skipping 1265 matching lines...) Expand 10 before | Expand all | Expand 10 after
1276 // WebCoreSupport/WebFrameBridge.mm. 1276 // WebCoreSupport/WebFrameBridge.mm.
1277 1277
1278 String mime_type = explicit_mime_type; 1278 String mime_type = explicit_mime_type;
1279 if (mime_type.isEmpty()) { 1279 if (mime_type.isEmpty()) {
1280 // Try to guess the MIME type based off the extension. 1280 // Try to guess the MIME type based off the extension.
1281 String filename = url.lastPathComponent(); 1281 String filename = url.lastPathComponent();
1282 int extension_pos = filename.reverseFind('.'); 1282 int extension_pos = filename.reverseFind('.');
1283 if (extension_pos >= 0) 1283 if (extension_pos >= 0)
1284 mime_type = MIMETypeRegistry::getMIMETypeForPath(url.path()); 1284 mime_type = MIMETypeRegistry::getMIMETypeForPath(url.path());
1285 1285
1286 if (mime_type.isEmpty()) 1286 // MIMETypeRegistry::getMIMETypeForPath returns application/octet-stream
1287 // when it can't find a MIME type for the path.
1288 if (mime_type.isEmpty() || mime_type == "application/octet-stream")
Victor Wang 2009/10/30 18:44:28 what if the path is a binary file. getMIMETypeForP
1287 return ObjectContentFrame; 1289 return ObjectContentFrame;
1288 } 1290 }
1289 1291
1290 if (MIMETypeRegistry::isSupportedImageMIMEType(mime_type)) 1292 if (MIMETypeRegistry::isSupportedImageMIMEType(mime_type))
1291 return ObjectContentImage; 1293 return ObjectContentImage;
1292 1294
1293 // If Chrome is started with the --disable-plugins switch, pluginData is null. 1295 // If Chrome is started with the --disable-plugins switch, pluginData is null.
1294 PluginData* plugin_data = webframe_->frame()->page()->pluginData(); 1296 PluginData* plugin_data = webframe_->frame()->page()->pluginData();
1295 if (plugin_data && plugin_data->supportsMimeType(mime_type)) 1297 if (plugin_data && plugin_data->supportsMimeType(mime_type))
1296 return ObjectContentNetscapePlugin; 1298 return ObjectContentNetscapePlugin;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1330 WebViewImpl* webview = webframe_->GetWebViewImpl(); 1332 WebViewImpl* webview = webframe_->GetWebViewImpl();
1331 if (webview->client()) 1333 if (webview->client())
1332 webview->client()->navigateBackForwardSoon(offset); 1334 webview->client()->navigateBackForwardSoon(offset);
1333 } 1335 }
1334 1336
1335 PassOwnPtr<WebPluginLoadObserver> WebFrameLoaderClient::GetPluginLoadObserver() { 1337 PassOwnPtr<WebPluginLoadObserver> WebFrameLoaderClient::GetPluginLoadObserver() {
1336 WebDataSourceImpl* ds = WebDataSourceImpl::fromDocumentLoader( 1338 WebDataSourceImpl* ds = WebDataSourceImpl::fromDocumentLoader(
1337 webframe_->frame()->loader()->activeDocumentLoader()); 1339 webframe_->frame()->loader()->activeDocumentLoader());
1338 return ds->releasePluginLoadObserver(); 1340 return ds->releasePluginLoadObserver();
1339 } 1341 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698