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/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
9 #include "content/public/browser/plugin_service.h" | 9 #include "content/public/browser/plugin_service.h" |
10 #include "content/public/common/url_constants.h" | 10 #include "content/public/common/url_constants.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 } // namespace | 51 } // namespace |
52 | 52 |
53 GURL GetFileURLFromDropData(id<NSDraggingInfo> info) { | 53 GURL GetFileURLFromDropData(id<NSDraggingInfo> info) { |
54 if ([[info draggingPasteboard] containsURLData]) { | 54 if ([[info draggingPasteboard] containsURLData]) { |
55 GURL url; | 55 GURL url; |
56 ui::PopulateURLAndTitleFromPasteboard(&url, | 56 ui::PopulateURLAndTitleFromPasteboard(&url, |
57 NULL, | 57 NULL, |
58 [info draggingPasteboard], | 58 [info draggingPasteboard], |
59 YES); | 59 YES); |
60 | 60 |
61 if (url.SchemeIs(content::kFileScheme)) | 61 if (url.SchemeIs(url::kFileScheme)) |
62 return url; | 62 return url; |
63 } | 63 } |
64 return GURL(); | 64 return GURL(); |
65 } | 65 } |
66 | 66 |
67 BOOL IsUnsupportedDropData(Profile* profile, id<NSDraggingInfo> info) { | 67 BOOL IsUnsupportedDropData(Profile* profile, id<NSDraggingInfo> info) { |
68 GURL url = GetFileURLFromDropData(info); | 68 GURL url = GetFileURLFromDropData(info); |
69 if (!url.is_empty()) { | 69 if (!url.is_empty()) { |
70 // If dragging a file, only allow dropping supported file types (that the | 70 // If dragging a file, only allow dropping supported file types (that the |
71 // web view can display). | 71 // web view can display). |
72 return !IsSupportedFileURL(profile, url); | 72 return !IsSupportedFileURL(profile, url); |
73 } | 73 } |
74 return NO; | 74 return NO; |
75 } | 75 } |
76 | 76 |
77 } // namespace drag_util | 77 } // namespace drag_util |
OLD | NEW |