Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 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 // This file contains the definition for CppBindingExample, which is used in | 5 // This file contains the definition for CppBindingExample, which is used in |
| 6 // cpp_bound_class_unittest. | 6 // cpp_bound_class_unittest. |
| 7 | 7 |
| 8 #include "cpp_binding_example.h" | 8 #include "cpp_binding_example.h" |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
| 12 | 12 |
| 13 namespace webkit_glue { | |
|
tony
2012/05/08 20:52:26
Nit: Please move this after the anonymous namespac
Xianzhu
2012/05/09 16:38:24
I put it here to avoid webkit_glue:: prefixes in t
| |
| 14 | |
| 13 namespace { | 15 namespace { |
| 14 | 16 |
| 15 class PropertyCallbackExample : public CppBoundClass::PropertyCallback { | 17 class PropertyCallbackExample : public CppBoundClass::PropertyCallback { |
| 16 public: | 18 public: |
| 17 virtual bool GetValue(CppVariant* value) { | 19 virtual bool GetValue(CppVariant* value) { |
| 18 value->Set(value_); | 20 value->Set(value_); |
| 19 return true; | 21 return true; |
| 20 } | 22 } |
| 21 | 23 |
| 22 virtual bool SetValue(const CppVariant& value) { | 24 virtual bool SetValue(const CppVariant& value) { |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 122 } | 124 } |
| 123 | 125 |
| 124 void CppBindingExample::same(CppVariant* result) { | 126 void CppBindingExample::same(CppVariant* result) { |
| 125 result->Set(42); | 127 result->Set(42); |
| 126 } | 128 } |
| 127 | 129 |
| 128 void CppBindingExample::fallbackMethod(const CppArgumentList& args, | 130 void CppBindingExample::fallbackMethod(const CppArgumentList& args, |
| 129 CppVariant* result) { | 131 CppVariant* result) { |
| 130 printf("Error: unknown JavaScript method invoked.\n"); | 132 printf("Error: unknown JavaScript method invoked.\n"); |
| 131 } | 133 } |
| 134 | |
| 135 } // namespace webkit_glue | |
| OLD | NEW |