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: third_party/WebKit/Source/core/clipboard/DataObjectItem.h

Issue 2582463002: Fix webkitGetEntry for non-native files. (Closed)
Patch Set: . Created 4 years 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 class Blob; 43 class Blob;
44 44
45 class CORE_EXPORT DataObjectItem 45 class CORE_EXPORT DataObjectItem
46 : public GarbageCollectedFinalized<DataObjectItem> { 46 : public GarbageCollectedFinalized<DataObjectItem> {
47 public: 47 public:
48 enum ItemKind { StringKind, FileKind }; 48 enum ItemKind { StringKind, FileKind };
49 49
50 static DataObjectItem* createFromString(const String& type, 50 static DataObjectItem* createFromString(const String& type,
51 const String& data); 51 const String& data);
52 static DataObjectItem* createFromFile(File*); 52 static DataObjectItem* createFromFile(File*);
53 // File with non-empty filesystem ID can be converted into FileEntry by using
54 // webkitGetAsEntry.
55 static DataObjectItem* createFromFileWithFileSystemId(
56 File*,
57 const String& fileSystemId);
53 static DataObjectItem* createFromURL(const String& url, const String& title); 58 static DataObjectItem* createFromURL(const String& url, const String& title);
54 static DataObjectItem* createFromHTML(const String& html, 59 static DataObjectItem* createFromHTML(const String& html,
55 const KURL& baseURL); 60 const KURL& baseURL);
56 static DataObjectItem* createFromSharedBuffer(const String& filename, 61 static DataObjectItem* createFromSharedBuffer(const String& filename,
57 PassRefPtr<SharedBuffer>); 62 PassRefPtr<SharedBuffer>);
58 static DataObjectItem* createFromPasteboard(const String& type, 63 static DataObjectItem* createFromPasteboard(const String& type,
59 uint64_t sequenceNumber); 64 uint64_t sequenceNumber);
60 65
61 ItemKind kind() const { return m_kind; } 66 ItemKind kind() const { return m_kind; }
62 String type() const { return m_type; } 67 String type() const { return m_type; }
63 String getAsString() const; 68 String getAsString() const;
64 Blob* getAsFile() const; 69 Blob* getAsFile() const;
65 70
66 // Used to support legacy DataTransfer APIs and renderer->browser 71 // Used to support legacy DataTransfer APIs and renderer->browser
67 // serialization. 72 // serialization.
68 PassRefPtr<SharedBuffer> sharedBuffer() const { return m_sharedBuffer; } 73 PassRefPtr<SharedBuffer> sharedBuffer() const { return m_sharedBuffer; }
69 String title() const { return m_title; } 74 String title() const { return m_title; }
70 KURL baseURL() const { return m_baseURL; } 75 KURL baseURL() const { return m_baseURL; }
71 bool isFilename() const; 76 bool isFilename() const;
72 77
78 bool hasFileSystemId() const;
79 String fileSystemId() const;
80
73 DECLARE_TRACE(); 81 DECLARE_TRACE();
74 82
75 private: 83 private:
76 enum DataSource { 84 enum DataSource {
77 PasteboardSource, 85 PasteboardSource,
78 InternalSource, 86 InternalSource,
79 }; 87 };
80 88
81 DataObjectItem(ItemKind, const String& type); 89 DataObjectItem(ItemKind, const String& type);
82 DataObjectItem(ItemKind, const String& type, uint64_t sequenceNumber); 90 DataObjectItem(ItemKind, const String& type, uint64_t sequenceNumber);
83 91
84 DataSource m_source; 92 DataSource m_source;
85 ItemKind m_kind; 93 ItemKind m_kind;
86 String m_type; 94 String m_type;
87 95
88 String m_data; 96 String m_data;
89 Member<File> m_file; 97 Member<File> m_file;
90 RefPtr<SharedBuffer> m_sharedBuffer; 98 RefPtr<SharedBuffer> m_sharedBuffer;
91 // Optional metadata. Currently used for URL, HTML, and dragging files in. 99 // Optional metadata. Currently used for URL, HTML, and dragging files in.
92 String m_title; 100 String m_title;
93 KURL m_baseURL; 101 KURL m_baseURL;
94 102
95 uint64_t m_sequenceNumber; // Only valid when m_source == PasteboardSource 103 uint64_t m_sequenceNumber; // Only valid when m_source == PasteboardSource
104 String m_fileSystemId; // Only valid when m_file is backed by FileEntry.
96 }; 105 };
97 106
98 } // namespace blink 107 } // namespace blink
99 108
100 #endif // DataObjectItem_h 109 #endif // DataObjectItem_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/clipboard/DataObject.cpp ('k') | third_party/WebKit/Source/core/clipboard/DataObjectItem.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698