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

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

Issue 2873293002: Replace ASSERT with DCHECK_EQ as appropriate (Closed)
Patch Set: rebase Created 3 years, 7 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 if (source_ == kInternalSource) { 118 if (source_ == kInternalSource) {
119 if (file_) 119 if (file_)
120 return file_.Get(); 120 return file_.Get();
121 DCHECK(shared_buffer_); 121 DCHECK(shared_buffer_);
122 // FIXME: This code is currently impossible--we never populate 122 // FIXME: This code is currently impossible--we never populate
123 // m_sharedBuffer when dragging in. At some point though, we may need to 123 // m_sharedBuffer when dragging in. At some point though, we may need to
124 // support correctly converting a shared buffer into a file. 124 // support correctly converting a shared buffer into a file.
125 return nullptr; 125 return nullptr;
126 } 126 }
127 127
128 ASSERT(source_ == kPasteboardSource); 128 DCHECK_EQ(source_, kPasteboardSource);
129 if (GetType() == kMimeTypeImagePng) { 129 if (GetType() == kMimeTypeImagePng) {
130 WebBlobInfo blob_info = Platform::Current()->Clipboard()->ReadImage( 130 WebBlobInfo blob_info = Platform::Current()->Clipboard()->ReadImage(
131 WebClipboard::kBufferStandard); 131 WebClipboard::kBufferStandard);
132 if (blob_info.size() < 0) 132 if (blob_info.size() < 0)
133 return nullptr; 133 return nullptr;
134 return File::Create( 134 return File::Create(
135 "image.png", CurrentTimeMS(), 135 "image.png", CurrentTimeMS(),
136 BlobDataHandle::Create(blob_info.Uuid(), blob_info.GetType(), 136 BlobDataHandle::Create(blob_info.Uuid(), blob_info.GetType(),
137 blob_info.size())); 137 blob_info.size()));
138 } 138 }
139 139
140 return nullptr; 140 return nullptr;
141 } 141 }
142 142
143 String DataObjectItem::GetAsString() const { 143 String DataObjectItem::GetAsString() const {
144 ASSERT(kind_ == kStringKind); 144 DCHECK_EQ(kind_, kStringKind);
145 145
146 if (source_ == kInternalSource) 146 if (source_ == kInternalSource)
147 return data_; 147 return data_;
148 148
149 ASSERT(source_ == kPasteboardSource); 149 DCHECK_EQ(source_, kPasteboardSource);
150 150
151 WebClipboard::Buffer buffer = Pasteboard::GeneralPasteboard()->GetBuffer(); 151 WebClipboard::Buffer buffer = Pasteboard::GeneralPasteboard()->GetBuffer();
152 String data; 152 String data;
153 // This is ugly but there's no real alternative. 153 // This is ugly but there's no real alternative.
154 if (type_ == kMimeTypeTextPlain) { 154 if (type_ == kMimeTypeTextPlain) {
155 data = Platform::Current()->Clipboard()->ReadPlainText(buffer); 155 data = Platform::Current()->Clipboard()->ReadPlainText(buffer);
156 } else if (type_ == kMimeTypeTextRTF) { 156 } else if (type_ == kMimeTypeTextRTF) {
157 data = Platform::Current()->Clipboard()->ReadRTF(buffer); 157 data = Platform::Current()->Clipboard()->ReadRTF(buffer);
158 } else if (type_ == kMimeTypeTextHTML) { 158 } else if (type_ == kMimeTypeTextHTML) {
159 WebURL ignored_source_url; 159 WebURL ignored_source_url;
(...skipping 23 matching lines...) Expand all
183 183
184 String DataObjectItem::FileSystemId() const { 184 String DataObjectItem::FileSystemId() const {
185 return file_system_id_; 185 return file_system_id_;
186 } 186 }
187 187
188 DEFINE_TRACE(DataObjectItem) { 188 DEFINE_TRACE(DataObjectItem) {
189 visitor->Trace(file_); 189 visitor->Trace(file_);
190 } 190 }
191 191
192 } // namespace blink 192 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/clipboard/DataObject.cpp ('k') | third_party/WebKit/Source/core/frame/DOMTimerCoordinator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698