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

Side by Side Diff: Source/core/clipboard/DataObjectItem.cpp

Issue 176853004: Oilpan: move core/fileapi to oilpan's heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 10 months 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 30 matching lines...) Expand all
41 41
42 DEFINE_GC_INFO(DataObjectItem); 42 DEFINE_GC_INFO(DataObjectItem);
43 43
44 PassRefPtrWillBeRawPtr<DataObjectItem> DataObjectItem::createFromString(const St ring& type, const String& data) 44 PassRefPtrWillBeRawPtr<DataObjectItem> DataObjectItem::createFromString(const St ring& type, const String& data)
45 { 45 {
46 RefPtrWillBeRawPtr<DataObjectItem> item = adoptRefWillBeNoop(new DataObjectI tem(StringKind, type)); 46 RefPtrWillBeRawPtr<DataObjectItem> item = adoptRefWillBeNoop(new DataObjectI tem(StringKind, type));
47 item->m_data = data; 47 item->m_data = data;
48 return item.release(); 48 return item.release();
49 } 49 }
50 50
51 PassRefPtrWillBeRawPtr<DataObjectItem> DataObjectItem::createFromFile(PassRefPtr <File> file) 51 PassRefPtrWillBeRawPtr<DataObjectItem> DataObjectItem::createFromFile(PassRefPtr WillBeRawPtr<File> file)
52 { 52 {
53 RefPtrWillBeRawPtr<DataObjectItem> item = adoptRefWillBeNoop(new DataObjectI tem(FileKind, file->type())); 53 RefPtrWillBeRawPtr<DataObjectItem> item = adoptRefWillBeNoop(new DataObjectI tem(FileKind, file->type()));
54 item->m_file = file; 54 item->m_file = file;
55 return item.release(); 55 return item.release();
56 } 56 }
57 57
58 PassRefPtrWillBeRawPtr<DataObjectItem> DataObjectItem::createFromURL(const Strin g& url, const String& title) 58 PassRefPtrWillBeRawPtr<DataObjectItem> DataObjectItem::createFromURL(const Strin g& url, const String& title)
59 { 59 {
60 RefPtrWillBeRawPtr<DataObjectItem> item = adoptRefWillBeNoop(new DataObjectI tem(StringKind, mimeTypeTextURIList)); 60 RefPtrWillBeRawPtr<DataObjectItem> item = adoptRefWillBeNoop(new DataObjectI tem(StringKind, mimeTypeTextURIList));
61 item->m_data = url; 61 item->m_data = url;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 } 95 }
96 96
97 DataObjectItem::DataObjectItem(Kind kind, const String& type, uint64_t sequenceN umber) 97 DataObjectItem::DataObjectItem(Kind kind, const String& type, uint64_t sequenceN umber)
98 : m_source(PasteboardSource) 98 : m_source(PasteboardSource)
99 , m_kind(kind) 99 , m_kind(kind)
100 , m_type(type) 100 , m_type(type)
101 , m_sequenceNumber(sequenceNumber) 101 , m_sequenceNumber(sequenceNumber)
102 { 102 {
103 } 103 }
104 104
105 PassRefPtr<Blob> DataObjectItem::getAsFile() const 105 PassRefPtrWillBeRawPtr<Blob> DataObjectItem::getAsFile() const
106 { 106 {
107 if (kind() != FileKind) 107 if (kind() != FileKind)
108 return nullptr; 108 return nullptr;
109 109
110 if (m_source == InternalSource) { 110 if (m_source == InternalSource) {
111 if (m_file) 111 if (m_file)
112 return m_file; 112 return m_file.get();
113 ASSERT(m_sharedBuffer); 113 ASSERT(m_sharedBuffer);
114 // FIXME: This code is currently impossible--we never populate m_sharedB uffer when dragging 114 // FIXME: This code is currently impossible--we never populate m_sharedB uffer when dragging
115 // in. At some point though, we may need to support correctly converting a shared buffer 115 // in. At some point though, we may need to support correctly converting a shared buffer
116 // into a file. 116 // into a file.
117 return nullptr; 117 return nullptr;
118 } 118 }
119 119
120 ASSERT(m_source == PasteboardSource); 120 ASSERT(m_source == PasteboardSource);
121 if (type() == mimeTypeImagePng) { 121 if (type() == mimeTypeImagePng) {
122 // FIXME: This is pretty inefficient. We copy the data from the browser 122 // FIXME: This is pretty inefficient. We copy the data from the browser
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 return blink::Platform::current()->clipboard()->sequenceNumber(buffer) == m_ sequenceNumber ? data : String(); 165 return blink::Platform::current()->clipboard()->sequenceNumber(buffer) == m_ sequenceNumber ? data : String();
166 } 166 }
167 167
168 bool DataObjectItem::isFilename() const 168 bool DataObjectItem::isFilename() const
169 { 169 {
170 // FIXME: https://bugs.webkit.org/show_bug.cgi?id=81261: When we properly su pport File dragout, 170 // FIXME: https://bugs.webkit.org/show_bug.cgi?id=81261: When we properly su pport File dragout,
171 // we'll need to make sure this works as expected for DragDataChromium. 171 // we'll need to make sure this works as expected for DragDataChromium.
172 return m_kind == FileKind && m_file; 172 return m_kind == FileKind && m_file;
173 } 173 }
174 174
175 void DataObjectItem::trace(Visitor* visitor)
176 {
177 visitor->trace(m_file);
178 }
179
175 } // namespace WebCore 180 } // namespace WebCore
176 181
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698