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

Side by Side Diff: third_party/WebKit/Source/core/clipboard/DataObjectItem.h

Issue 2565283002: 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 static DataObjectItem* createFromFileEntry(File*, const String& fileSystemId);
kinuko 2016/12/12 08:03:35 I would expect that it takes FileEntry for this me
hirono 2016/12/13 08:12:13 Done.
53 static DataObjectItem* createFromURL(const String& url, const String& title); 54 static DataObjectItem* createFromURL(const String& url, const String& title);
54 static DataObjectItem* createFromHTML(const String& html, 55 static DataObjectItem* createFromHTML(const String& html,
55 const KURL& baseURL); 56 const KURL& baseURL);
56 static DataObjectItem* createFromSharedBuffer(const String& filename, 57 static DataObjectItem* createFromSharedBuffer(const String& filename,
57 PassRefPtr<SharedBuffer>); 58 PassRefPtr<SharedBuffer>);
58 static DataObjectItem* createFromPasteboard(const String& type, 59 static DataObjectItem* createFromPasteboard(const String& type,
59 uint64_t sequenceNumber); 60 uint64_t sequenceNumber);
60 61
61 ItemKind kind() const { return m_kind; } 62 ItemKind kind() const { return m_kind; }
62 String type() const { return m_type; } 63 String type() const { return m_type; }
63 String getAsString() const; 64 String getAsString() const;
64 Blob* getAsFile() const; 65 Blob* getAsFile() const;
65 66
66 // Used to support legacy DataTransfer APIs and renderer->browser 67 // Used to support legacy DataTransfer APIs and renderer->browser
67 // serialization. 68 // serialization.
68 PassRefPtr<SharedBuffer> sharedBuffer() const { return m_sharedBuffer; } 69 PassRefPtr<SharedBuffer> sharedBuffer() const { return m_sharedBuffer; }
69 String title() const { return m_title; } 70 String title() const { return m_title; }
70 KURL baseURL() const { return m_baseURL; } 71 KURL baseURL() const { return m_baseURL; }
71 bool isFilename() const; 72 bool isFilename() const;
72 73
74 bool hasFileSystemId() const;
75 String fileSystemId() const;
76
73 DECLARE_TRACE(); 77 DECLARE_TRACE();
74 78
75 private: 79 private:
76 enum DataSource { 80 enum DataSource {
77 PasteboardSource, 81 PasteboardSource,
78 InternalSource, 82 InternalSource,
79 }; 83 };
80 84
81 DataObjectItem(ItemKind, const String& type); 85 DataObjectItem(ItemKind, const String& type);
82 DataObjectItem(ItemKind, const String& type, uint64_t sequenceNumber); 86 DataObjectItem(ItemKind, const String& type, uint64_t sequenceNumber);
83 87
84 DataSource m_source; 88 DataSource m_source;
85 ItemKind m_kind; 89 ItemKind m_kind;
86 String m_type; 90 String m_type;
87 91
88 String m_data; 92 String m_data;
89 Member<File> m_file; 93 Member<File> m_file;
90 RefPtr<SharedBuffer> m_sharedBuffer; 94 RefPtr<SharedBuffer> m_sharedBuffer;
91 // Optional metadata. Currently used for URL, HTML, and dragging files in. 95 // Optional metadata. Currently used for URL, HTML, and dragging files in.
92 String m_title; 96 String m_title;
93 KURL m_baseURL; 97 KURL m_baseURL;
94 98
95 uint64_t m_sequenceNumber; // Only valid when m_source == PasteboardSource 99 uint64_t m_sequenceNumber; // Only valid when m_source == PasteboardSource
100 String m_fileSystemId; // Only valid when m_file is backed by FileEntry.
96 }; 101 };
97 102
98 } // namespace blink 103 } // namespace blink
99 104
100 #endif // DataObjectItem_h 105 #endif // DataObjectItem_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698