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

Side by Side Diff: chrome/test/automation/value_conversion_traits.cc

Issue 7661009: base: Add Is* functions to Value class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix nat_policy.cc Created 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/test/automation/value_conversion_traits.h" 5 #include "chrome/test/automation/value_conversion_traits.h"
6 6
7 #include "base/values.h" 7 #include "base/values.h"
8 8
9 using base::DictionaryValue; 9 using base::DictionaryValue;
10 using base::ListValue; 10 using base::ListValue;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 bool ValueConversionTraits<Value*>::CanConvert(const Value* value) { 64 bool ValueConversionTraits<Value*>::CanConvert(const Value* value) {
65 return true; 65 return true;
66 } 66 }
67 67
68 Value* ValueConversionTraits<ListValue*>::CreateValueFrom(const ListValue* t) { 68 Value* ValueConversionTraits<ListValue*>::CreateValueFrom(const ListValue* t) {
69 return t->DeepCopy(); 69 return t->DeepCopy();
70 } 70 }
71 71
72 bool ValueConversionTraits<ListValue*>::SetFromValue(const Value* value, 72 bool ValueConversionTraits<ListValue*>::SetFromValue(const Value* value,
73 ListValue** t) { 73 ListValue** t) {
74 if (!value->IsType(Value::TYPE_LIST)) 74 if (!value->IsList())
75 return false; 75 return false;
76 *t = static_cast<const ListValue*>(value)->DeepCopy(); 76 *t = static_cast<const ListValue*>(value)->DeepCopy();
77 return true; 77 return true;
78 } 78 }
79 79
80 bool ValueConversionTraits<ListValue*>::CanConvert(const Value* value) { 80 bool ValueConversionTraits<ListValue*>::CanConvert(const Value* value) {
81 return value->IsType(Value::TYPE_LIST); 81 return value->IsList();
82 } 82 }
83 83
84 Value* ValueConversionTraits<DictionaryValue*>::CreateValueFrom( 84 Value* ValueConversionTraits<DictionaryValue*>::CreateValueFrom(
85 const DictionaryValue* t) { 85 const DictionaryValue* t) {
86 return t->DeepCopy(); 86 return t->DeepCopy();
87 } 87 }
88 88
89 bool ValueConversionTraits<DictionaryValue*>::SetFromValue( 89 bool ValueConversionTraits<DictionaryValue*>::SetFromValue(
90 const Value* value, DictionaryValue** t) { 90 const Value* value, DictionaryValue** t) {
91 if (!value->IsType(Value::TYPE_DICTIONARY)) 91 if (!value->IsDictionary())
92 return false; 92 return false;
93 *t = static_cast<const DictionaryValue*>(value)->DeepCopy(); 93 *t = static_cast<const DictionaryValue*>(value)->DeepCopy();
94 return true; 94 return true;
95 } 95 }
96 96
97 bool ValueConversionTraits<DictionaryValue*>::CanConvert(const Value* value) { 97 bool ValueConversionTraits<DictionaryValue*>::CanConvert(const Value* value) {
98 return value->IsType(Value::TYPE_DICTIONARY); 98 return value->IsDictionary();
99 } 99 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698