OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 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 from code import Code | 5 from code import Code |
6 from model import PropertyType | 6 from model import PropertyType |
7 import cpp_util | 7 import cpp_util |
8 import schema_util | 8 import schema_util |
9 import util_cc_helper | 9 import util_cc_helper |
10 from cpp_namespace_environment import CppNamespaceEnvironment | 10 from cpp_namespace_environment import CppNamespaceEnvironment |
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
643 elif underlying_type.property_type == PropertyType.ARRAY: | 643 elif underlying_type.property_type == PropertyType.ARRAY: |
644 return '%s' % self._util_cc_helper.CreateValueFromArray( | 644 return '%s' % self._util_cc_helper.CreateValueFromArray( |
645 var, | 645 var, |
646 is_ptr) | 646 is_ptr) |
647 elif underlying_type.property_type.is_fundamental: | 647 elif underlying_type.property_type.is_fundamental: |
648 if is_ptr: | 648 if is_ptr: |
649 var = '*%s' % var | 649 var = '*%s' % var |
650 if underlying_type.property_type == PropertyType.STRING: | 650 if underlying_type.property_type == PropertyType.STRING: |
651 return 'base::MakeUnique<base::StringValue>(%s)' % var | 651 return 'base::MakeUnique<base::StringValue>(%s)' % var |
652 else: | 652 else: |
653 return 'base::MakeUnique<base::FundamentalValue>(%s)' % var | 653 return 'base::MakeUnique<base::Value>(%s)' % var |
654 else: | 654 else: |
655 raise NotImplementedError('Conversion of %s to base::Value not ' | 655 raise NotImplementedError('Conversion of %s to base::Value not ' |
656 'implemented' % repr(type_.type_)) | 656 'implemented' % repr(type_.type_)) |
657 | 657 |
658 def _GenerateParamsCheck(self, function, var): | 658 def _GenerateParamsCheck(self, function, var): |
659 """Generates a check for the correct number of arguments when creating | 659 """Generates a check for the correct number of arguments when creating |
660 Params. | 660 Params. |
661 """ | 661 """ |
662 c = Code() | 662 c = Code() |
663 num_required = 0 | 663 num_required = 0 |
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1150 if self._generate_error_messages: | 1150 if self._generate_error_messages: |
1151 params = list(params) + ['base::string16* error'] | 1151 params = list(params) + ['base::string16* error'] |
1152 return ', '.join(str(p) for p in params) | 1152 return ', '.join(str(p) for p in params) |
1153 | 1153 |
1154 def _GenerateArgs(self, args): | 1154 def _GenerateArgs(self, args): |
1155 """Builds the argument list for a function, given an array of arguments. | 1155 """Builds the argument list for a function, given an array of arguments. |
1156 """ | 1156 """ |
1157 if self._generate_error_messages: | 1157 if self._generate_error_messages: |
1158 args = list(args) + ['error'] | 1158 args = list(args) + ['error'] |
1159 return ', '.join(str(a) for a in args) | 1159 return ', '.join(str(a) for a in args) |
OLD | NEW |