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

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

Issue 796913002: Use C++11 range-based loop for core/clipboard, core/dom and core/testing (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase Created 5 years, 11 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
« no previous file with comments | « no previous file | Source/core/dom/DocumentMarkerController.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2008, 2009, 2012 Google Inc. All rights reserved. 2 * Copyright (c) 2008, 2009, 2012 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 PassRefPtrWillBeRawPtr<DataObject> DataObject::createFromPasteboard(PasteMode pa steMode) 42 PassRefPtrWillBeRawPtr<DataObject> DataObject::createFromPasteboard(PasteMode pa steMode)
43 { 43 {
44 RefPtrWillBeRawPtr<DataObject> dataObject = create(); 44 RefPtrWillBeRawPtr<DataObject> dataObject = create();
45 blink::WebClipboard::Buffer buffer = Pasteboard::generalPasteboard()->buffer (); 45 blink::WebClipboard::Buffer buffer = Pasteboard::generalPasteboard()->buffer ();
46 uint64_t sequenceNumber = blink::Platform::current()->clipboard()->sequenceN umber(buffer); 46 uint64_t sequenceNumber = blink::Platform::current()->clipboard()->sequenceN umber(buffer);
47 bool ignored; 47 bool ignored;
48 blink::WebVector<blink::WebString> webTypes = blink::Platform::current()->cl ipboard()->readAvailableTypes(buffer, &ignored); 48 blink::WebVector<blink::WebString> webTypes = blink::Platform::current()->cl ipboard()->readAvailableTypes(buffer, &ignored);
49 ListHashSet<String> types; 49 ListHashSet<String> types;
50 for (size_t i = 0; i < webTypes.size(); ++i) 50 for (size_t i = 0; i < webTypes.size(); ++i)
51 types.add(webTypes[i]); 51 types.add(webTypes[i]);
52 for (ListHashSet<String>::const_iterator it = types.begin(); it != types.end (); ++it) { 52 for (const String& type : types) {
53 if (pasteMode == PlainTextOnly && *it != mimeTypeTextPlain) 53 if (pasteMode == PlainTextOnly && type != mimeTypeTextPlain)
54 continue; 54 continue;
55 dataObject->m_itemList.append(DataObjectItem::createFromPasteboard(*it, sequenceNumber)); 55 dataObject->m_itemList.append(DataObjectItem::createFromPasteboard(type, sequenceNumber));
56 } 56 }
57 return dataObject.release(); 57 return dataObject.release();
58 } 58 }
59 59
60 PassRefPtrWillBeRawPtr<DataObject> DataObject::create() 60 PassRefPtrWillBeRawPtr<DataObject> DataObject::create()
61 { 61 {
62 return adoptRefWillBeNoop(new DataObject()); 62 return adoptRefWillBeNoop(new DataObject());
63 } 63 }
64 64
65 PassRefPtrWillBeRawPtr<DataObject> DataObject::copy() const 65 PassRefPtrWillBeRawPtr<DataObject> DataObject::copy() const
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 259
260 void DataObject::trace(Visitor* visitor) 260 void DataObject::trace(Visitor* visitor)
261 { 261 {
262 #if ENABLE(OILPAN) 262 #if ENABLE(OILPAN)
263 visitor->trace(m_itemList); 263 visitor->trace(m_itemList);
264 HeapSupplementable<DataObject>::trace(visitor); 264 HeapSupplementable<DataObject>::trace(visitor);
265 #endif 265 #endif
266 } 266 }
267 267
268 } // namespace blink 268 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | Source/core/dom/DocumentMarkerController.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698