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

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

Issue 170603003: Use nullptr_t for RefPtr, PassRefPtr and RawPtr. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Final rebase 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/clipboard/DataTransferItem.cpp ('k') | Source/core/css/BasicShapeFunctions.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) 2006, 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
3 * Copyright (C) 2008, 2009 Google Inc. 3 * Copyright (C) 2008, 2009 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 size_t DataTransferItemList::length() const 47 size_t DataTransferItemList::length() const
48 { 48 {
49 if (!m_clipboard->canReadTypes()) 49 if (!m_clipboard->canReadTypes())
50 return 0; 50 return 0;
51 return m_dataObject->length(); 51 return m_dataObject->length();
52 } 52 }
53 53
54 PassRefPtr<DataTransferItem> DataTransferItemList::item(unsigned long index) 54 PassRefPtr<DataTransferItem> DataTransferItemList::item(unsigned long index)
55 { 55 {
56 if (!m_clipboard->canReadTypes()) 56 if (!m_clipboard->canReadTypes())
57 return 0; 57 return nullptr;
58 RefPtr<DataObjectItem> item = m_dataObject->item(index); 58 RefPtr<DataObjectItem> item = m_dataObject->item(index);
59 if (!item) 59 if (!item)
60 return 0; 60 return nullptr;
61 61
62 return DataTransferItem::create(m_clipboard, item); 62 return DataTransferItem::create(m_clipboard, item);
63 } 63 }
64 64
65 void DataTransferItemList::deleteItem(unsigned long index, ExceptionState& excep tionState) 65 void DataTransferItemList::deleteItem(unsigned long index, ExceptionState& excep tionState)
66 { 66 {
67 if (!m_clipboard->canWriteData()) { 67 if (!m_clipboard->canWriteData()) {
68 exceptionState.throwDOMException(InvalidStateError, "The list is not wri table."); 68 exceptionState.throwDOMException(InvalidStateError, "The list is not wri table.");
69 return; 69 return;
70 } 70 }
71 m_dataObject->deleteItem(index); 71 m_dataObject->deleteItem(index);
72 } 72 }
73 73
74 void DataTransferItemList::clear() 74 void DataTransferItemList::clear()
75 { 75 {
76 if (!m_clipboard->canWriteData()) 76 if (!m_clipboard->canWriteData())
77 return; 77 return;
78 m_dataObject->clearAll(); 78 m_dataObject->clearAll();
79 } 79 }
80 80
81 PassRefPtr<DataTransferItem> DataTransferItemList::add(const String& data, const String& type, ExceptionState& exceptionState) 81 PassRefPtr<DataTransferItem> DataTransferItemList::add(const String& data, const String& type, ExceptionState& exceptionState)
82 { 82 {
83 if (!m_clipboard->canWriteData()) 83 if (!m_clipboard->canWriteData())
84 return 0; 84 return nullptr;
85 RefPtr<DataObjectItem> item = m_dataObject->add(data, type); 85 RefPtr<DataObjectItem> item = m_dataObject->add(data, type);
86 if (!item) { 86 if (!item) {
87 exceptionState.throwDOMException(NotSupportedError, "An item already exi sts for type '" + type + "'."); 87 exceptionState.throwDOMException(NotSupportedError, "An item already exi sts for type '" + type + "'.");
88 return 0; 88 return nullptr;
89 } 89 }
90 return DataTransferItem::create(m_clipboard, item); 90 return DataTransferItem::create(m_clipboard, item);
91 } 91 }
92 92
93 PassRefPtr<DataTransferItem> DataTransferItemList::add(PassRefPtr<File> file) 93 PassRefPtr<DataTransferItem> DataTransferItemList::add(PassRefPtr<File> file)
94 { 94 {
95 if (!m_clipboard->canWriteData()) 95 if (!m_clipboard->canWriteData())
96 return 0; 96 return nullptr;
97 RefPtr<DataObjectItem> item = m_dataObject->add(file); 97 RefPtr<DataObjectItem> item = m_dataObject->add(file);
98 if (!item) 98 if (!item)
99 return 0; 99 return nullptr;
100 return DataTransferItem::create(m_clipboard, item); 100 return DataTransferItem::create(m_clipboard, item);
101 } 101 }
102 102
103 DataTransferItemList::DataTransferItemList(PassRefPtr<Clipboard> clipboard, Pass RefPtr<DataObject> dataObject) 103 DataTransferItemList::DataTransferItemList(PassRefPtr<Clipboard> clipboard, Pass RefPtr<DataObject> dataObject)
104 : m_clipboard(clipboard) 104 : m_clipboard(clipboard)
105 , m_dataObject(dataObject) 105 , m_dataObject(dataObject)
106 { 106 {
107 ScriptWrappable::init(this); 107 ScriptWrappable::init(this);
108 } 108 }
109 109
110 } // namespace WebCore 110 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/clipboard/DataTransferItem.cpp ('k') | Source/core/css/BasicShapeFunctions.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698