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

Side by Side Diff: ui/views/mus/clipboard_mus.cc

Issue 2374883002: views/mus: Change 'reset(new' to base::MakeUnqiue. (Closed)
Patch Set: Created 4 years, 2 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 | ui/views/mus/input_method_mus.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/views/mus/clipboard_mus.h" 5 #include "ui/views/mus/clipboard_mus.h"
6 6
7 #include <string>
8 #include <utility>
9 #include <vector>
10
7 #include "base/logging.h" 11 #include "base/logging.h"
8 #include "base/stl_util.h" 12 #include "base/stl_util.h"
9 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
10 #include "mojo/common/common_type_converters.h" 14 #include "mojo/common/common_type_converters.h"
11 #include "mojo/public/cpp/bindings/sync_call_restrictions.h" 15 #include "mojo/public/cpp/bindings/sync_call_restrictions.h"
12 #include "services/shell/public/cpp/connector.h" 16 #include "services/shell/public/cpp/connector.h"
13 #include "third_party/skia/include/core/SkBitmap.h" 17 #include "third_party/skia/include/core/SkBitmap.h"
14 #include "ui/base/clipboard/custom_data_helper.h" 18 #include "ui/base/clipboard/custom_data_helper.h"
15 #include "ui/gfx/codec/png_codec.h" 19 #include "ui/gfx/codec/png_codec.h"
16 20
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 uint64_t sequence_number = 0; 253 uint64_t sequence_number = 0;
250 if (clipboard_->ReadClipboardData(ui::mojom::Clipboard::Type::COPY_PASTE, 254 if (clipboard_->ReadClipboardData(ui::mojom::Clipboard::Type::COPY_PASTE,
251 GetMimeTypeFor(format), &sequence_number, 255 GetMimeTypeFor(format), &sequence_number,
252 &data)) { 256 &data)) {
253 *result = data.To<std::string>(); 257 *result = data.To<std::string>();
254 } 258 }
255 } 259 }
256 260
257 void ClipboardMus::WriteObjects(ui::ClipboardType type, 261 void ClipboardMus::WriteObjects(ui::ClipboardType type,
258 const ObjectMap& objects) { 262 const ObjectMap& objects) {
259 current_clipboard_.reset(new mojo::Map<mojo::String, mojo::Array<uint8_t>>); 263 current_clipboard_ =
264 base::MakeUnique<mojo::Map<mojo::String, mojo::Array<uint8_t>>>();
260 for (const auto& p : objects) 265 for (const auto& p : objects)
261 DispatchObject(static_cast<ObjectType>(p.first), p.second); 266 DispatchObject(static_cast<ObjectType>(p.first), p.second);
262 267
263 // Sends the data to mus server. 268 // Sends the data to mus server.
264 uint64_t sequence_number = 0; 269 uint64_t sequence_number = 0;
265 mojo::SyncCallRestrictions::ScopedAllowSyncCall allow_sync_call; 270 mojo::SyncCallRestrictions::ScopedAllowSyncCall allow_sync_call;
266 clipboard_->WriteClipboardData(GetType(type), std::move(*current_clipboard_), 271 clipboard_->WriteClipboardData(GetType(type), std::move(*current_clipboard_),
267 &sequence_number); 272 &sequence_number);
268 current_clipboard_.reset(); 273 current_clipboard_.reset();
269 } 274 }
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 void ClipboardMus::WriteData(const FormatType& format, 335 void ClipboardMus::WriteData(const FormatType& format,
331 const char* data_data, 336 const char* data_data,
332 size_t data_len) { 337 size_t data_len) {
333 DCHECK(current_clipboard_); 338 DCHECK(current_clipboard_);
334 current_clipboard_->insert( 339 current_clipboard_->insert(
335 GetMimeTypeFor(format), 340 GetMimeTypeFor(format),
336 mojo::Array<uint8_t>::From(base::StringPiece(data_data, data_len))); 341 mojo::Array<uint8_t>::From(base::StringPiece(data_data, data_len)));
337 } 342 }
338 343
339 } // namespace views 344 } // namespace views
OLDNEW
« no previous file with comments | « no previous file | ui/views/mus/input_method_mus.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698