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

Side by Side Diff: content/renderer/renderer_clipboard_delegate.cc

Issue 1873783003: Convert //content/renderer from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 | « content/renderer/renderer_blink_platform_impl.cc ('k') | content/renderer/renderer_main.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // This file provides the embedder's side of the Clipboard interface. 5 // This file provides the embedder's side of the Clipboard interface.
6 6
7 #include "content/renderer/renderer_clipboard_delegate.h" 7 #include "content/renderer/renderer_clipboard_delegate.h"
8 8
9 #include "base/memory/shared_memory.h" 9 #include "base/memory/shared_memory.h"
10 #include "base/numerics/safe_math.h" 10 #include "base/numerics/safe_math.h"
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 RenderThreadImpl::current()->Send( 120 RenderThreadImpl::current()->Send(
121 new ClipboardHostMsg_WriteBookmark(clipboard_type, url.spec(), title)); 121 new ClipboardHostMsg_WriteBookmark(clipboard_type, url.spec(), title));
122 } 122 }
123 123
124 bool RendererClipboardDelegate::WriteImage(ui::ClipboardType clipboard_type, 124 bool RendererClipboardDelegate::WriteImage(ui::ClipboardType clipboard_type,
125 const SkBitmap& bitmap) { 125 const SkBitmap& bitmap) {
126 // Only 32-bit bitmaps are supported. 126 // Only 32-bit bitmaps are supported.
127 DCHECK_EQ(bitmap.colorType(), kN32_SkColorType); 127 DCHECK_EQ(bitmap.colorType(), kN32_SkColorType);
128 128
129 const gfx::Size size(bitmap.width(), bitmap.height()); 129 const gfx::Size size(bitmap.width(), bitmap.height());
130 scoped_ptr<base::SharedMemory> shared_buf; 130 std::unique_ptr<base::SharedMemory> shared_buf;
131 { 131 {
132 SkAutoLockPixels locked(bitmap); 132 SkAutoLockPixels locked(bitmap);
133 void* pixels = bitmap.getPixels(); 133 void* pixels = bitmap.getPixels();
134 // TODO(piman): this should not be NULL, but it is. crbug.com/369621 134 // TODO(piman): this should not be NULL, but it is. crbug.com/369621
135 if (!pixels) 135 if (!pixels)
136 return false; 136 return false;
137 137
138 base::CheckedNumeric<uint32_t> checked_buf_size = 4; 138 base::CheckedNumeric<uint32_t> checked_buf_size = 4;
139 checked_buf_size *= size.width(); 139 checked_buf_size *= size.width();
140 checked_buf_size *= size.height(); 140 checked_buf_size *= size.height();
(...skipping 17 matching lines...) Expand all
158 clipboard_type, size, shared_buf->handle())); 158 clipboard_type, size, shared_buf->handle()));
159 return true; 159 return true;
160 } 160 }
161 161
162 void RendererClipboardDelegate::CommitWrite(ui::ClipboardType clipboard_type) { 162 void RendererClipboardDelegate::CommitWrite(ui::ClipboardType clipboard_type) {
163 RenderThreadImpl::current()->Send( 163 RenderThreadImpl::current()->Send(
164 new ClipboardHostMsg_CommitWrite(clipboard_type)); 164 new ClipboardHostMsg_CommitWrite(clipboard_type));
165 } 165 }
166 166
167 } // namespace content 167 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/renderer_blink_platform_impl.cc ('k') | content/renderer/renderer_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698