OLD | NEW |
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 #import "chrome/browser/ui/cocoa/drag_util.h" | 5 #import "chrome/browser/ui/cocoa/drag_util.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/sys_string_conversions.h" | 9 #include "base/sys_string_conversions.h" |
10 #include "content/common/url_constants.h" | 10 #include "content/common/url_constants.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 // This logic mirrors |BufferedResourceHandler::ShouldDownload()|. | 75 // This logic mirrors |BufferedResourceHandler::ShouldDownload()|. |
76 // TODO(asvitkine): Refactor this out to a common location instead of | 76 // TODO(asvitkine): Refactor this out to a common location instead of |
77 // duplicating code. | 77 // duplicating code. |
78 if (net::IsSupportedMimeType(mime_type)) | 78 if (net::IsSupportedMimeType(mime_type)) |
79 return YES; | 79 return YES; |
80 | 80 |
81 // Check whether there is a plugin that supports the mime type. (e.g. PDF) | 81 // Check whether there is a plugin that supports the mime type. (e.g. PDF) |
82 // TODO(bauerb): This possibly uses stale information, but it's guaranteed not | 82 // TODO(bauerb): This possibly uses stale information, but it's guaranteed not |
83 // to do disk access. | 83 // to do disk access. |
84 bool stale = false; | 84 bool stale = false; |
85 std::vector<webkit::npapi::WebPluginInfo> info_array; | 85 std::vector<webkit::WebPluginInfo> info_array; |
86 webkit::npapi::PluginList::Singleton()->GetPluginInfoArray( | 86 webkit::npapi::PluginList::Singleton()->GetPluginInfoArray( |
87 url, mime_type, false, &stale, &info_array, NULL); | 87 url, mime_type, false, &stale, &info_array, NULL); |
88 for (size_t i = 0; i < info_array.size(); ++i) { | 88 for (size_t i = 0; i < info_array.size(); ++i) { |
89 if (webkit::npapi::IsPluginEnabled(info_array[i])) | 89 if (webkit::IsPluginEnabled(info_array[i])) |
90 return true; | 90 return true; |
91 } | 91 } |
92 | 92 |
93 return NO; | 93 return NO; |
94 } | 94 } |
95 | 95 |
96 BOOL IsUnsupportedDropData(id<NSDraggingInfo> info) { | 96 BOOL IsUnsupportedDropData(id<NSDraggingInfo> info) { |
97 GURL url = GetFileURLFromDropData(info); | 97 GURL url = GetFileURLFromDropData(info); |
98 if (!url.is_empty()) { | 98 if (!url.is_empty()) { |
99 // If dragging a file, only allow dropping supported file types (that the | 99 // If dragging a file, only allow dropping supported file types (that the |
100 // web view can display). | 100 // web view can display). |
101 return !IsSupportedFileURL(url); | 101 return !IsSupportedFileURL(url); |
102 } | 102 } |
103 return NO; | 103 return NO; |
104 } | 104 } |
105 | 105 |
106 } // namespace drag_util | 106 } // namespace drag_util |
OLD | NEW |