Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(108)

Side by Side Diff: extensions/renderer/chrome_setting.cc

Issue 2901383008: [Extenisons Bindings] Support `unmanaged` property for events (Closed)
Patch Set: rebase Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 NOTREACHED(); 109 NOTREACHED();
110 return v8::Local<v8::Value>(); 110 return v8::Local<v8::Value>();
111 } 111 }
112 112
113 DCHECK(!event.IsEmpty()); 113 DCHECK(!event.IsEmpty());
114 if (event->IsUndefined()) { 114 if (event->IsUndefined()) {
115 bool supports_filters = false; 115 bool supports_filters = false;
116 event = event_handler_->CreateEventInstance( 116 event = event_handler_->CreateEventInstance(
117 base::StringPrintf("types.ChromeSetting.%s.onChange", 117 base::StringPrintf("types.ChromeSetting.%s.onChange",
118 pref_name_.c_str()), 118 pref_name_.c_str()),
119 supports_filters, binding::kNoListenerMax, context); 119 supports_filters, binding::kNoListenerMax, true, context);
120 v8::Maybe<bool> set_result = wrapper->SetPrivate(context, key, event); 120 v8::Maybe<bool> set_result = wrapper->SetPrivate(context, key, event);
121 if (!set_result.IsJust() || !set_result.FromJust()) { 121 if (!set_result.IsJust() || !set_result.FromJust()) {
122 NOTREACHED(); 122 NOTREACHED();
123 return v8::Local<v8::Value>(); 123 return v8::Local<v8::Value>();
124 } 124 }
125 } 125 }
126 return event; 126 return event;
127 } 127 }
128 128
129 void ChromeSetting::HandleFunction(const std::string& method_name, 129 void ChromeSetting::HandleFunction(const std::string& method_name,
(...skipping 15 matching lines...) Expand all
145 return; 145 return;
146 } 146 }
147 147
148 converted_arguments->Insert(0u, base::MakeUnique<base::Value>(pref_name_)); 148 converted_arguments->Insert(0u, base::MakeUnique<base::Value>(pref_name_));
149 request_handler_->StartRequest( 149 request_handler_->StartRequest(
150 context, full_name, std::move(converted_arguments), callback, 150 context, full_name, std::move(converted_arguments), callback,
151 v8::Local<v8::Function>(), binding::RequestThread::UI); 151 v8::Local<v8::Function>(), binding::RequestThread::UI);
152 } 152 }
153 153
154 } // namespace extensions 154 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/renderer/api_event_handler_unittest.cc ('k') | extensions/renderer/native_extension_bindings_system_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698