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

Side by Side Diff: device/bluetooth/bluetooth_uuid.cc

Issue 1659003003: IPC::Message -> base::Pickle (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: one more mac fix Created 4 years, 10 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 | « device/bluetooth/bluetooth_uuid.h ('k') | extensions/common/extension_messages.h » ('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 "device/bluetooth/bluetooth_uuid.h" 5 #include "device/bluetooth/bluetooth_uuid.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 bool BluetoothUUID::operator!=(const BluetoothUUID& uuid) const { 89 bool BluetoothUUID::operator!=(const BluetoothUUID& uuid) const {
90 return canonical_value_ != uuid.canonical_value_; 90 return canonical_value_ != uuid.canonical_value_;
91 } 91 }
92 92
93 void PrintTo(const BluetoothUUID& uuid, std::ostream* out) { 93 void PrintTo(const BluetoothUUID& uuid, std::ostream* out) {
94 *out << uuid.canonical_value(); 94 *out << uuid.canonical_value();
95 } 95 }
96 96
97 } // namespace device 97 } // namespace device
98 98
99 void IPC::ParamTraits<device::BluetoothUUID>::Write(Message* m, 99 void IPC::ParamTraits<device::BluetoothUUID>::Write(base::Pickle* m,
100 const param_type& p) { 100 const param_type& p) {
101 m->WriteString(p.canonical_value()); 101 m->WriteString(p.canonical_value());
102 } 102 }
103 103
104 bool IPC::ParamTraits<device::BluetoothUUID>::Read(const Message* m, 104 bool IPC::ParamTraits<device::BluetoothUUID>::Read(const base::Pickle* m,
105 base::PickleIterator* iter, 105 base::PickleIterator* iter,
106 param_type* r) { 106 param_type* r) {
107 std::string value; 107 std::string value;
108 if (!iter->ReadString(&value)) 108 if (!iter->ReadString(&value))
109 return false; 109 return false;
110 *r = device::BluetoothUUID(value); 110 *r = device::BluetoothUUID(value);
111 // If the format isn't 128-bit, .value() would return a different answer than 111 // If the format isn't 128-bit, .value() would return a different answer than
112 // .canonical_value(). Then if browser-side code accidentally checks .value() 112 // .canonical_value(). Then if browser-side code accidentally checks .value()
113 // against a 128-bit string literal, a hostile renderer could use the 16- or 113 // against a 128-bit string literal, a hostile renderer could use the 16- or
114 // 32-bit format and evade the check. 114 // 32-bit format and evade the check.
115 return r->format() == device::BluetoothUUID::kFormat128Bit; 115 return r->format() == device::BluetoothUUID::kFormat128Bit;
116 } 116 }
117 117
118 void IPC::ParamTraits<device::BluetoothUUID>::Log(const param_type& p, 118 void IPC::ParamTraits<device::BluetoothUUID>::Log(const param_type& p,
119 std::string* l) { 119 std::string* l) {
120 l->append(p.canonical_value()); 120 l->append(p.canonical_value());
121 } 121 }
OLDNEW
« no previous file with comments | « device/bluetooth/bluetooth_uuid.h ('k') | extensions/common/extension_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698