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

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

Issue 2230183002: ui: Use stl utilities from the base namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 4 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/views/layout/grid_layout.cc ('k') | ui/views/view.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 "base/logging.h" 7 #include "base/logging.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "mojo/common/common_type_converters.h" 10 #include "mojo/common/common_type_converters.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 71
72 // TODO(erg): This isn't optimal, but it's the best we can do. On windows, 72 // TODO(erg): This isn't optimal, but it's the best we can do. On windows,
73 // this will return strings that aren't MIME types, though they'll be 73 // this will return strings that aren't MIME types, though they'll be
74 // unique and should be serializable on the other side of the mojo 74 // unique and should be serializable on the other side of the mojo
75 // connection. 75 // connection.
76 return format.Serialize(); 76 return format.Serialize();
77 } 77 }
78 78
79 bool ClipboardMus::HasMimeType(const mojo::Array<mojo::String>& available_types, 79 bool ClipboardMus::HasMimeType(const mojo::Array<mojo::String>& available_types,
80 const std::string& type) const { 80 const std::string& type) const {
81 return ContainsValue(available_types, type); 81 return base::ContainsValue(available_types, type);
82 } 82 }
83 83
84 uint64_t ClipboardMus::GetSequenceNumber(ui::ClipboardType type) const { 84 uint64_t ClipboardMus::GetSequenceNumber(ui::ClipboardType type) const {
85 mojo::SyncCallRestrictions::ScopedAllowSyncCall allow_sync_call; 85 mojo::SyncCallRestrictions::ScopedAllowSyncCall allow_sync_call;
86 uint64_t sequence_number = 0; 86 uint64_t sequence_number = 0;
87 clipboard_->GetSequenceNumber(GetType(type), &sequence_number); 87 clipboard_->GetSequenceNumber(GetType(type), &sequence_number);
88 return sequence_number; 88 return sequence_number;
89 } 89 }
90 90
91 bool ClipboardMus::IsFormatAvailable(const FormatType& format, 91 bool ClipboardMus::IsFormatAvailable(const FormatType& format,
92 ui::ClipboardType type) const { 92 ui::ClipboardType type) const {
93 mojo::SyncCallRestrictions::ScopedAllowSyncCall allow_sync_call; 93 mojo::SyncCallRestrictions::ScopedAllowSyncCall allow_sync_call;
94 94
95 uint64_t sequence_number = 0; 95 uint64_t sequence_number = 0;
96 mojo::Array<mojo::String> available_types; 96 mojo::Array<mojo::String> available_types;
97 clipboard_->GetAvailableMimeTypes(GetType(type), &sequence_number, 97 clipboard_->GetAvailableMimeTypes(GetType(type), &sequence_number,
98 &available_types); 98 &available_types);
99 99
100 mojo::String format_in_mime = GetMimeTypeFor(format); 100 mojo::String format_in_mime = GetMimeTypeFor(format);
101 return ContainsValue(available_types, format_in_mime); 101 return base::ContainsValue(available_types, format_in_mime);
102 } 102 }
103 103
104 void ClipboardMus::Clear(ui::ClipboardType type) { 104 void ClipboardMus::Clear(ui::ClipboardType type) {
105 // Sends the data to mus server. 105 // Sends the data to mus server.
106 uint64_t sequence_number = 0; 106 uint64_t sequence_number = 0;
107 mojo::SyncCallRestrictions::ScopedAllowSyncCall allow_sync_call; 107 mojo::SyncCallRestrictions::ScopedAllowSyncCall allow_sync_call;
108 clipboard_->WriteClipboardData(GetType(type), nullptr, 108 clipboard_->WriteClipboardData(GetType(type), nullptr,
109 &sequence_number); 109 &sequence_number);
110 } 110 }
111 111
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 void ClipboardMus::WriteData(const FormatType& format, 329 void ClipboardMus::WriteData(const FormatType& format,
330 const char* data_data, 330 const char* data_data,
331 size_t data_len) { 331 size_t data_len) {
332 DCHECK(current_clipboard_); 332 DCHECK(current_clipboard_);
333 current_clipboard_->insert( 333 current_clipboard_->insert(
334 GetMimeTypeFor(format), 334 GetMimeTypeFor(format),
335 mojo::Array<uint8_t>::From(base::StringPiece(data_data, data_len))); 335 mojo::Array<uint8_t>::From(base::StringPiece(data_data, data_len)));
336 } 336 }
337 337
338 } // namespace views 338 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/layout/grid_layout.cc ('k') | ui/views/view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698