| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/test/mock_webclipboard_impl.h" | 5 #include "content/test/mock_webclipboard_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 | 169 |
| 170 void MockWebClipboardImpl::writeDataObject(const WebDragData& data) { | 170 void MockWebClipboardImpl::writeDataObject(const WebDragData& data) { |
| 171 clear(); | 171 clear(); |
| 172 | 172 |
| 173 const WebVector<WebDragData::Item>& itemList = data.items(); | 173 const WebVector<WebDragData::Item>& itemList = data.items(); |
| 174 for (size_t i = 0; i < itemList.size(); ++i) { | 174 for (size_t i = 0; i < itemList.size(); ++i) { |
| 175 const WebDragData::Item& item = itemList[i]; | 175 const WebDragData::Item& item = itemList[i]; |
| 176 switch (item.storageType) { | 176 switch (item.storageType) { |
| 177 case WebDragData::Item::StorageTypeString: { | 177 case WebDragData::Item::StorageTypeString: { |
| 178 ++m_sequenceNumber; | 178 ++m_sequenceNumber; |
| 179 if (EqualsASCII(item.stringType, ui::Clipboard::kMimeTypeText)) { | 179 if (base::EqualsASCII(item.stringType, ui::Clipboard::kMimeTypeText)) { |
| 180 m_plainText = item.stringData; | 180 m_plainText = item.stringData; |
| 181 continue; | 181 continue; |
| 182 } | 182 } |
| 183 if (EqualsASCII(item.stringType, ui::Clipboard::kMimeTypeHTML)) { | 183 if (base::EqualsASCII(item.stringType, ui::Clipboard::kMimeTypeHTML)) { |
| 184 m_htmlText = item.stringData; | 184 m_htmlText = item.stringData; |
| 185 continue; | 185 continue; |
| 186 } | 186 } |
| 187 m_customData.insert(std::make_pair(item.stringType, item.stringData)); | 187 m_customData.insert(std::make_pair(item.stringType, item.stringData)); |
| 188 continue; | 188 continue; |
| 189 } | 189 } |
| 190 default: | 190 default: |
| 191 // Currently other types are unused by the clipboard implementation. | 191 // Currently other types are unused by the clipboard implementation. |
| 192 NOTREACHED(); | 192 NOTREACHED(); |
| 193 } | 193 } |
| 194 } | 194 } |
| 195 } | 195 } |
| 196 | 196 |
| 197 void MockWebClipboardImpl::clear() { | 197 void MockWebClipboardImpl::clear() { |
| 198 m_plainText = base::NullableString16(); | 198 m_plainText = base::NullableString16(); |
| 199 m_htmlText = base::NullableString16(); | 199 m_htmlText = base::NullableString16(); |
| 200 m_image.reset(); | 200 m_image.reset(); |
| 201 m_customData.clear(); | 201 m_customData.clear(); |
| 202 m_writeSmartPaste = false; | 202 m_writeSmartPaste = false; |
| 203 } | 203 } |
| 204 | 204 |
| 205 } // namespace content | 205 } // namespace content |
| OLD | NEW |