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

Side by Side Diff: device/nfc/nfc_ndef_record.cc

Issue 1542163002: Switch to standard integer types in device/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: win Created 5 years 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/nfc/nfc_ndef_record.h ('k') | device/nfc/nfc_ndef_record_unittest.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/nfc/nfc_ndef_record.h" 5 #include "device/nfc/nfc_ndef_record.h"
6 6
7 #include <stddef.h>
8 #include <stdint.h>
9
7 #include <map> 10 #include <map>
8 11
9 #include "base/logging.h" 12 #include "base/logging.h"
10 #include "url/gurl.h" 13 #include "url/gurl.h"
11 14
12 using base::DictionaryValue; 15 using base::DictionaryValue;
13 using base::ListValue; 16 using base::ListValue;
14 17
15 namespace device { 18 namespace device {
16 19
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 // Verifies that the contents of |data| conform to the fields of NDEF type 113 // Verifies that the contents of |data| conform to the fields of NDEF type
111 // "SmartPoster". 114 // "SmartPoster".
112 bool HandleTypeSmartPoster(const DictionaryValue* data) { 115 bool HandleTypeSmartPoster(const DictionaryValue* data) {
113 VLOG(1) << "Populating record with type \"SmartPoster\"."; 116 VLOG(1) << "Populating record with type \"SmartPoster\".";
114 FieldValueMap required_fields; 117 FieldValueMap required_fields;
115 required_fields[NfcNdefRecord::kFieldURI] = base::Value::TYPE_STRING; 118 required_fields[NfcNdefRecord::kFieldURI] = base::Value::TYPE_STRING;
116 FieldValueMap optional_fields; 119 FieldValueMap optional_fields;
117 optional_fields[NfcNdefRecord::kFieldAction] = base::Value::TYPE_STRING; 120 optional_fields[NfcNdefRecord::kFieldAction] = base::Value::TYPE_STRING;
118 optional_fields[NfcNdefRecord::kFieldMimeType] = base::Value::TYPE_STRING; 121 optional_fields[NfcNdefRecord::kFieldMimeType] = base::Value::TYPE_STRING;
119 // base::Value restricts the number types to BOOL, INTEGER, and DOUBLE only. 122 // base::Value restricts the number types to BOOL, INTEGER, and DOUBLE only.
120 // uint32 will automatically get converted to a double. "target size" is 123 // uint32_t will automatically get converted to a double. "target size" is
121 // really a uint32 but we define it as a double for this reason. 124 // really a uint32_t but we define it as a double for this reason.
122 // (See dbus/values_util.h). 125 // (See dbus/values_util.h).
123 optional_fields[NfcNdefRecord::kFieldTargetSize] = base::Value::TYPE_DOUBLE; 126 optional_fields[NfcNdefRecord::kFieldTargetSize] = base::Value::TYPE_DOUBLE;
124 optional_fields[NfcNdefRecord::kFieldTitles] = base::Value::TYPE_LIST; 127 optional_fields[NfcNdefRecord::kFieldTitles] = base::Value::TYPE_LIST;
125 if (!CheckFieldsAreValid(required_fields, optional_fields, data)) { 128 if (!CheckFieldsAreValid(required_fields, optional_fields, data)) {
126 VLOG(1) << "Failed to populate record."; 129 VLOG(1) << "Failed to populate record.";
127 return false; 130 return false;
128 } 131 }
129 // Verify that the "titles" field was formatted correctly, if it exists. 132 // Verify that the "titles" field was formatted correctly, if it exists.
130 const ListValue* titles = NULL; 133 const ListValue* titles = NULL;
131 if (data->GetList(NfcNdefRecord::kFieldTitles, &titles)) { 134 if (data->GetList(NfcNdefRecord::kFieldTitles, &titles)) {
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 iter != records_.end(); ++iter) { 254 iter != records_.end(); ++iter) {
252 if (*iter == record) { 255 if (*iter == record) {
253 records_.erase(iter); 256 records_.erase(iter);
254 return true; 257 return true;
255 } 258 }
256 } 259 }
257 return false; 260 return false;
258 } 261 }
259 262
260 } // namespace device 263 } // namespace device
OLDNEW
« no previous file with comments | « device/nfc/nfc_ndef_record.h ('k') | device/nfc/nfc_ndef_record_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698