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

Side by Side Diff: ui/base/test/test_clipboard.cc

Issue 2855503003: Replace uses of legacy SkBitmap::copyTo() API (Closed)
Patch Set: Remove braces 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
« no previous file with comments | « ui/base/clipboard/clipboard_aura.cc ('k') | ui/native_theme/native_theme_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "ui/base/test/test_clipboard.h" 5 #include "ui/base/test/test_clipboard.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "base/numerics/safe_conversions.h" 9 #include "base/numerics/safe_conversions.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 } 178 }
179 179
180 void TestClipboard::WriteWebSmartPaste() { 180 void TestClipboard::WriteWebSmartPaste() {
181 // Create a dummy entry. 181 // Create a dummy entry.
182 GetDefaultStore().data[GetWebKitSmartPasteFormatType()]; 182 GetDefaultStore().data[GetWebKitSmartPasteFormatType()];
183 } 183 }
184 184
185 void TestClipboard::WriteBitmap(const SkBitmap& bitmap) { 185 void TestClipboard::WriteBitmap(const SkBitmap& bitmap) {
186 // Create a dummy entry. 186 // Create a dummy entry.
187 GetDefaultStore().data[GetBitmapFormatType()]; 187 GetDefaultStore().data[GetBitmapFormatType()];
188 bitmap.copyTo(&GetDefaultStore().image); 188 SkBitmap& dst = GetDefaultStore().image;
189 if (dst.tryAllocPixels(bitmap.info())) {
190 bitmap.readPixels(dst.info(), dst.getPixels(), dst.rowBytes(), 0, 0);
191 }
189 } 192 }
190 193
191 void TestClipboard::WriteData(const FormatType& format, 194 void TestClipboard::WriteData(const FormatType& format,
192 const char* data_data, 195 const char* data_data,
193 size_t data_len) { 196 size_t data_len) {
194 GetDefaultStore().data[format] = std::string(data_data, data_len); 197 GetDefaultStore().data[format] = std::string(data_data, data_len);
195 } 198 }
196 199
197 TestClipboard::DataStore::DataStore() : sequence_number(0) { 200 TestClipboard::DataStore::DataStore() : sequence_number(0) {
198 } 201 }
(...skipping 25 matching lines...) Expand all
224 227
225 const TestClipboard::DataStore& TestClipboard::GetDefaultStore() const { 228 const TestClipboard::DataStore& TestClipboard::GetDefaultStore() const {
226 return GetStore(default_store_type_); 229 return GetStore(default_store_type_);
227 } 230 }
228 231
229 TestClipboard::DataStore& TestClipboard::GetDefaultStore() { 232 TestClipboard::DataStore& TestClipboard::GetDefaultStore() {
230 return GetStore(default_store_type_); 233 return GetStore(default_store_type_);
231 } 234 }
232 235
233 } // namespace ui 236 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/clipboard/clipboard_aura.cc ('k') | ui/native_theme/native_theme_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698