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 #ifndef CHROME_BROWSER_UI_COCOA_DRAG_UTIL_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_DRAG_UTIL_H_ |
6 #define CHROME_BROWSER_UI_COCOA_DRAG_UTIL_H_ | 6 #define CHROME_BROWSER_UI_COCOA_DRAG_UTIL_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #import <Cocoa/Cocoa.h> | 9 #import <Cocoa/Cocoa.h> |
10 | 10 |
11 #include "base/basictypes.h" | 11 class GURL; |
12 #include "googleurl/src/gurl.h" | |
13 | |
14 class Profile; | 12 class Profile; |
15 | 13 |
16 namespace drag_util { | 14 namespace drag_util { |
17 | 15 |
18 // Populates the |url| and |title| with URL data in |pboard|. There may be more | |
19 // than one, but we only handle dropping the first. |url| must not be |NULL|; | |
20 // |title| is an optional parameter. Returns |YES| if URL data was obtained from | |
21 // the pasteboard, |NO| otherwise. If |convert_filenames| is |YES|, the function | |
22 // will also attempt to convert filenames in |pboard| to file URLs. | |
23 BOOL PopulateURLAndTitleFromPasteBoard(GURL* url, | |
24 string16* title, | |
25 NSPasteboard* pboard, | |
26 BOOL convert_filenames); | |
27 | |
28 // Returns the first file URL from |info|, if there is one. If |info| doesn't | 16 // Returns the first file URL from |info|, if there is one. If |info| doesn't |
29 // contain any file URLs, an empty |GURL| is returned. | 17 // contain any file URLs, an empty |GURL| is returned. |
30 GURL GetFileURLFromDropData(id<NSDraggingInfo> info); | 18 GURL GetFileURLFromDropData(id<NSDraggingInfo> info); |
31 | 19 |
32 // Determines whether the given drag and drop operation contains content that | 20 // Determines whether the given drag and drop operation contains content that |
33 // is supported by the web view. In particular, if the content is a local file | 21 // is supported by the web view. In particular, if the content is a local file |
34 // URL, this checks if it is of a type that can be shown in the tab contents. | 22 // URL, this checks if it is of a type that can be shown in the tab contents. |
35 BOOL IsUnsupportedDropData(Profile* profile, id<NSDraggingInfo> info); | 23 BOOL IsUnsupportedDropData(Profile* profile, id<NSDraggingInfo> info); |
36 | 24 |
37 } // namespace drag_util | 25 } // namespace drag_util |
38 | 26 |
39 #endif // CHROME_BROWSER_UI_COCOA_DRAG_UTIL_H_ | 27 #endif // CHROME_BROWSER_UI_COCOA_DRAG_UTIL_H_ |
OLD | NEW |