| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/api_binding_js_util.h" | 5 #include "extensions/renderer/api_binding_js_util.h" |
| 6 | 6 |
| 7 #include "base/values.h" | 7 #include "base/values.h" |
| 8 #include "extensions/renderer/api_event_handler.h" | 8 #include "extensions/renderer/api_event_handler.h" |
| 9 #include "extensions/renderer/api_request_handler.h" | 9 #include "extensions/renderer/api_request_handler.h" |
| 10 #include "extensions/renderer/api_signature.h" | 10 #include "extensions/renderer/api_signature.h" |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 event_name = gin::V8ToString(v8_event_name); | 121 event_name = gin::V8ToString(v8_event_name); |
| 122 } | 122 } |
| 123 | 123 |
| 124 DCHECK(!supports_filters || !event_name.empty()) | 124 DCHECK(!supports_filters || !event_name.empty()) |
| 125 << "Events that support filters cannot be anonymous."; | 125 << "Events that support filters cannot be anonymous."; |
| 126 | 126 |
| 127 v8::Local<v8::Value> event; | 127 v8::Local<v8::Value> event; |
| 128 if (event_name.empty()) { | 128 if (event_name.empty()) { |
| 129 event = event_handler_->CreateAnonymousEventInstance(context); | 129 event = event_handler_->CreateAnonymousEventInstance(context); |
| 130 } else { | 130 } else { |
| 131 event = event_handler_->CreateEventInstance( | 131 bool notify_on_change = true; |
| 132 event_name, supports_filters, binding::kNoListenerMax, context); | 132 event = event_handler_->CreateEventInstance(event_name, supports_filters, |
| 133 binding::kNoListenerMax, |
| 134 notify_on_change, context); |
| 133 } | 135 } |
| 134 | 136 |
| 135 arguments->Return(event); | 137 arguments->Return(event); |
| 136 } | 138 } |
| 137 | 139 |
| 138 void APIBindingJSUtil::InvalidateEvent(gin::Arguments* arguments, | 140 void APIBindingJSUtil::InvalidateEvent(gin::Arguments* arguments, |
| 139 v8::Local<v8::Object> event) { | 141 v8::Local<v8::Object> event) { |
| 140 v8::Isolate* isolate = arguments->isolate(); | 142 v8::Isolate* isolate = arguments->isolate(); |
| 141 v8::HandleScope handle_scope(isolate); | 143 v8::HandleScope handle_scope(isolate); |
| 142 event_handler_->InvalidateCustomEvent(arguments->GetHolderCreationContext(), | 144 event_handler_->InvalidateCustomEvent(arguments->GetHolderCreationContext(), |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 v8::Local<v8::Context> context = arguments->GetHolderCreationContext(); | 179 v8::Local<v8::Context> context = arguments->GetHolderCreationContext(); |
| 178 | 180 |
| 179 request_handler_->last_error()->SetError(context, error); | 181 request_handler_->last_error()->SetError(context, error); |
| 180 run_js_.Run(callback, context, 0, nullptr); | 182 run_js_.Run(callback, context, 0, nullptr); |
| 181 | 183 |
| 182 bool report_if_unchecked = true; | 184 bool report_if_unchecked = true; |
| 183 request_handler_->last_error()->ClearError(context, report_if_unchecked); | 185 request_handler_->last_error()->ClearError(context, report_if_unchecked); |
| 184 } | 186 } |
| 185 | 187 |
| 186 } // namespace extensions | 188 } // namespace extensions |
| OLD | NEW |