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

Side by Side Diff: content/common/indexed_db/indexed_db_struct_traits.cc

Issue 2642973006: Include AIDL files in the presubmit check for IPC security. (Closed)
Patch Set: Fix build/finish migrating an _enum_traits; fix OWNERS files. Created 3 years, 11 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/common/indexed_db/indexed_db_struct_traits.h ('k') | ui/base/mojo/OWNERS » ('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 "content/common/indexed_db/indexed_db_struct_traits.h" 5 #include "content/common/indexed_db/indexed_db_struct_traits.h"
6 #include "mojo/common/common_custom_types_struct_traits.h" 6 #include "mojo/common/common_custom_types_struct_traits.h"
7 7
8 using content::IndexedDBKey; 8 using content::IndexedDBKey;
9 using content::IndexedDBKeyPath; 9 using content::IndexedDBKeyPath;
10 using content::IndexedDBKeyRange; 10 using content::IndexedDBKeyRange;
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 object_stores.GetDataView(i, &object_store); 230 object_stores.GetDataView(i, &object_store);
231 DCHECK(!base::ContainsKey(out->object_stores, object_store.id())); 231 DCHECK(!base::ContainsKey(out->object_stores, object_store.id()));
232 if (!StructTraits<indexed_db::mojom::ObjectStoreMetadataDataView, 232 if (!StructTraits<indexed_db::mojom::ObjectStoreMetadataDataView,
233 content::IndexedDBObjectStoreMetadata>:: 233 content::IndexedDBObjectStoreMetadata>::
234 Read(object_store, &out->object_stores[object_store.id()])) 234 Read(object_store, &out->object_stores[object_store.id()]))
235 return false; 235 return false;
236 } 236 }
237 return true; 237 return true;
238 } 238 }
239 239
240 using indexed_db::mojom::CursorDirection;
jsbell 2017/01/20 23:12:28 It's a little unusual to see these usings way down
palmer 2017/01/21 00:02:17 Done.
241 using indexed_db::mojom::DataLoss;
242 using indexed_db::mojom::OperationType;
243 using indexed_db::mojom::PutMode;
244 using indexed_db::mojom::TaskType;
245 using indexed_db::mojom::TransactionMode;
246
247 // static
248 CursorDirection
249 EnumTraits<CursorDirection, blink::WebIDBCursorDirection>::ToMojom(
250 blink::WebIDBCursorDirection input) {
251 switch (input) {
252 case blink::WebIDBCursorDirectionNext:
253 return CursorDirection::Next;
254 case blink::WebIDBCursorDirectionNextNoDuplicate:
255 return CursorDirection::NextNoDuplicate;
256 case blink::WebIDBCursorDirectionPrev:
257 return CursorDirection::Prev;
258 case blink::WebIDBCursorDirectionPrevNoDuplicate:
259 return CursorDirection::PrevNoDuplicate;
260 }
261 NOTREACHED();
262 return CursorDirection::Next;
263 }
264
265 // static
266 bool EnumTraits<CursorDirection, blink::WebIDBCursorDirection>::FromMojom(
267 CursorDirection input,
268 blink::WebIDBCursorDirection* output) {
269 switch (input) {
270 case CursorDirection::Next:
271 *output = blink::WebIDBCursorDirectionNext;
272 return true;
273 case CursorDirection::NextNoDuplicate:
274 *output = blink::WebIDBCursorDirectionNextNoDuplicate;
275 return true;
276 case CursorDirection::Prev:
277 *output = blink::WebIDBCursorDirectionPrev;
278 return true;
279 case CursorDirection::PrevNoDuplicate:
280 *output = blink::WebIDBCursorDirectionPrevNoDuplicate;
281 return true;
282 }
283 return false;
284 }
285
286 // static
287 DataLoss EnumTraits<DataLoss, blink::WebIDBDataLoss>::ToMojom(
288 blink::WebIDBDataLoss input) {
289 switch (input) {
290 case blink::WebIDBDataLossNone:
291 return DataLoss::None;
292 case blink::WebIDBDataLossTotal:
293 return DataLoss::Total;
294 }
295 NOTREACHED();
296 return DataLoss::None;
297 }
298
299 // static
300 bool EnumTraits<DataLoss, blink::WebIDBDataLoss>::FromMojom(
301 DataLoss input,
302 blink::WebIDBDataLoss* output) {
303 switch (input) {
304 case DataLoss::None:
305 *output = blink::WebIDBDataLossNone;
306 return true;
307 case DataLoss::Total:
308 *output = blink::WebIDBDataLossTotal;
309 return true;
310 }
311 return false;
312 }
313
314 // static
315 OperationType EnumTraits<OperationType, blink::WebIDBOperationType>::ToMojom(
316 blink::WebIDBOperationType input) {
317 switch (input) {
318 case blink::WebIDBAdd:
319 return OperationType::Add;
320 case blink::WebIDBPut:
321 return OperationType::Put;
322 case blink::WebIDBDelete:
323 return OperationType::Delete;
324 case blink::WebIDBClear:
325 return OperationType::Clear;
326 case blink::WebIDBOperationTypeCount:
327 // WebIDBOperationTypeCount is not a valid option.
328 break;
329 }
330 NOTREACHED();
331 return OperationType::Add;
332 }
333
334 // static
335 bool EnumTraits<OperationType, blink::WebIDBOperationType>::FromMojom(
336 OperationType input,
337 blink::WebIDBOperationType* output) {
338 switch (input) {
339 case OperationType::Add:
340 *output = blink::WebIDBAdd;
341 return true;
342 case OperationType::Put:
343 *output = blink::WebIDBPut;
344 return true;
345 case OperationType::Delete:
346 *output = blink::WebIDBDelete;
347 return true;
348 case OperationType::Clear:
349 *output = blink::WebIDBClear;
350 return true;
351 }
352 return false;
353 }
354
355 // static
356 PutMode EnumTraits<PutMode, blink::WebIDBPutMode>::ToMojom(
357 blink::WebIDBPutMode input) {
358 switch (input) {
359 case blink::WebIDBPutModeAddOrUpdate:
360 return PutMode::AddOrUpdate;
361 case blink::WebIDBPutModeAddOnly:
362 return PutMode::AddOnly;
363 case blink::WebIDBPutModeCursorUpdate:
364 return PutMode::CursorUpdate;
365 }
366 NOTREACHED();
367 return PutMode::AddOrUpdate;
368 }
369
370 // static
371 bool EnumTraits<PutMode, blink::WebIDBPutMode>::FromMojom(
372 PutMode input,
373 blink::WebIDBPutMode* output) {
374 switch (input) {
375 case PutMode::AddOrUpdate:
376 *output = blink::WebIDBPutModeAddOrUpdate;
377 return true;
378 case PutMode::AddOnly:
379 *output = blink::WebIDBPutModeAddOnly;
380 return true;
381 case PutMode::CursorUpdate:
382 *output = blink::WebIDBPutModeCursorUpdate;
383 return true;
384 }
385 return false;
386 }
387
388 // static
389 TaskType EnumTraits<TaskType, blink::WebIDBTaskType>::ToMojom(
390 blink::WebIDBTaskType input) {
391 switch (input) {
392 case blink::WebIDBTaskTypeNormal:
393 return TaskType::Normal;
394 case blink::WebIDBTaskTypePreemptive:
395 return TaskType::Preemptive;
396 }
397 NOTREACHED();
398 return TaskType::Normal;
399 }
400
401 // static
402 bool EnumTraits<TaskType, blink::WebIDBTaskType>::FromMojom(
403 TaskType input,
404 blink::WebIDBTaskType* output) {
405 switch (input) {
406 case TaskType::Normal:
407 *output = blink::WebIDBTaskTypeNormal;
408 return true;
409 case TaskType::Preemptive:
410 *output = blink::WebIDBTaskTypePreemptive;
411 return true;
412 }
413 return false;
414 }
415
416 // static
417 TransactionMode
418 EnumTraits<TransactionMode, blink::WebIDBTransactionMode>::ToMojom(
419 blink::WebIDBTransactionMode input) {
420 switch (input) {
421 case blink::WebIDBTransactionModeReadOnly:
422 return TransactionMode::ReadOnly;
423 case blink::WebIDBTransactionModeReadWrite:
424 return TransactionMode::ReadWrite;
425 case blink::WebIDBTransactionModeVersionChange:
426 return TransactionMode::VersionChange;
427 }
428 NOTREACHED();
429 return TransactionMode::ReadOnly;
430 }
431
432 // static
433 bool EnumTraits<TransactionMode, blink::WebIDBTransactionMode>::FromMojom(
434 TransactionMode input,
435 blink::WebIDBTransactionMode* output) {
436 switch (input) {
437 case TransactionMode::ReadOnly:
438 *output = blink::WebIDBTransactionModeReadOnly;
439 return true;
440 case TransactionMode::ReadWrite:
441 *output = blink::WebIDBTransactionModeReadWrite;
442 return true;
443 case TransactionMode::VersionChange:
444 *output = blink::WebIDBTransactionModeVersionChange;
445 return true;
446 }
447 return false;
448 }
240 } // namespace mojo 449 } // namespace mojo
OLDNEW
« no previous file with comments | « content/common/indexed_db/indexed_db_struct_traits.h ('k') | ui/base/mojo/OWNERS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698