OLD | NEW |
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 "chrome/browser/devtools/devtools_embedder_message_dispatcher.h" | 5 #include "chrome/browser/devtools/devtools_embedder_message_dispatcher.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 | 9 |
10 namespace { | 10 namespace { |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 template <typename H, typename... As> | 60 template <typename H, typename... As> |
61 void Apply(const H& handler, As... args) { | 61 void Apply(const H& handler, As... args) { |
62 handler.Run(args...); | 62 handler.Run(args...); |
63 } | 63 } |
64 }; | 64 }; |
65 | 65 |
66 template <typename T, typename... Ts> | 66 template <typename T, typename... Ts> |
67 struct ParamTuple<T, Ts...> { | 67 struct ParamTuple<T, Ts...> { |
68 bool Parse(const base::ListValue& list, | 68 bool Parse(const base::ListValue& list, |
69 const base::ListValue::const_iterator& it) { | 69 const base::ListValue::const_iterator& it) { |
70 return it != list.end() && GetValue(**it, &head) && | 70 return it != list.end() && GetValue(*it, &head) && tail.Parse(list, it + 1); |
71 tail.Parse(list, it + 1); | |
72 } | 71 } |
73 | 72 |
74 template <typename H, typename... As> | 73 template <typename H, typename... As> |
75 void Apply(const H& handler, As... args) { | 74 void Apply(const H& handler, As... args) { |
76 tail.template Apply<H, As..., T>(handler, args..., head); | 75 tail.template Apply<H, As..., T>(handler, args..., head); |
77 } | 76 } |
78 | 77 |
79 typename StorageTraits<T>::StorageType head; | 78 typename StorageTraits<T>::StorageType head; |
80 ParamTuple<Ts...> tail; | 79 ParamTuple<Ts...> tail; |
81 }; | 80 }; |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 d->RegisterHandler("removePreference", | 210 d->RegisterHandler("removePreference", |
212 &Delegate::RemovePreference, delegate); | 211 &Delegate::RemovePreference, delegate); |
213 d->RegisterHandler("clearPreferences", | 212 d->RegisterHandler("clearPreferences", |
214 &Delegate::ClearPreferences, delegate); | 213 &Delegate::ClearPreferences, delegate); |
215 d->RegisterHandlerWithCallback("reattach", | 214 d->RegisterHandlerWithCallback("reattach", |
216 &Delegate::Reattach, delegate); | 215 &Delegate::Reattach, delegate); |
217 d->RegisterHandler("readyForTest", | 216 d->RegisterHandler("readyForTest", |
218 &Delegate::ReadyForTest, delegate); | 217 &Delegate::ReadyForTest, delegate); |
219 return d; | 218 return d; |
220 } | 219 } |
OLD | NEW |