OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "extensions/renderer/chrome_setting.h" | 5 #include "extensions/renderer/chrome_setting.h" |
6 | 6 |
7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "extensions/renderer/api_event_handler.h" | 10 #include "extensions/renderer/api_event_handler.h" |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 v8::Local<v8::Private> key = v8::Private::ForApi( | 136 v8::Local<v8::Private> key = v8::Private::ForApi( |
137 isolate, gin::StringToSymbol(isolate, "onChangeEvent")); | 137 isolate, gin::StringToSymbol(isolate, "onChangeEvent")); |
138 v8::Local<v8::Value> event; | 138 v8::Local<v8::Value> event; |
139 if (!wrapper->GetPrivate(context, key).ToLocal(&event)) { | 139 if (!wrapper->GetPrivate(context, key).ToLocal(&event)) { |
140 NOTREACHED(); | 140 NOTREACHED(); |
141 return v8::Local<v8::Value>(); | 141 return v8::Local<v8::Value>(); |
142 } | 142 } |
143 | 143 |
144 DCHECK(!event.IsEmpty()); | 144 DCHECK(!event.IsEmpty()); |
145 if (event->IsUndefined()) { | 145 if (event->IsUndefined()) { |
| 146 bool supports_filters = false; |
146 event = event_handler_->CreateEventInstance( | 147 event = event_handler_->CreateEventInstance( |
147 base::StringPrintf("types.ChromeSetting.%s.onChange", | 148 base::StringPrintf("types.ChromeSetting.%s.onChange", |
148 pref_name_.c_str()), | 149 pref_name_.c_str()), |
149 context); | 150 supports_filters, context); |
150 v8::Maybe<bool> set_result = wrapper->SetPrivate(context, key, event); | 151 v8::Maybe<bool> set_result = wrapper->SetPrivate(context, key, event); |
151 if (!set_result.IsJust() || !set_result.FromJust()) { | 152 if (!set_result.IsJust() || !set_result.FromJust()) { |
152 NOTREACHED(); | 153 NOTREACHED(); |
153 return v8::Local<v8::Value>(); | 154 return v8::Local<v8::Value>(); |
154 } | 155 } |
155 } | 156 } |
156 return event; | 157 return event; |
157 } | 158 } |
158 | 159 |
159 void ChromeSetting::HandleFunction(const std::string& method_name, | 160 void ChromeSetting::HandleFunction(const std::string& method_name, |
(...skipping 21 matching lines...) Expand all Loading... |
181 return; | 182 return; |
182 } | 183 } |
183 | 184 |
184 converted_arguments->Insert(0u, base::MakeUnique<base::Value>(pref_name_)); | 185 converted_arguments->Insert(0u, base::MakeUnique<base::Value>(pref_name_)); |
185 request_handler_->StartRequest(context, full_name, | 186 request_handler_->StartRequest(context, full_name, |
186 std::move(converted_arguments), callback, | 187 std::move(converted_arguments), callback, |
187 v8::Local<v8::Function>()); | 188 v8::Local<v8::Function>()); |
188 } | 189 } |
189 | 190 |
190 } // namespace extensions | 191 } // namespace extensions |
OLD | NEW |