Revert "Revert of Revert of Revert of ChromeOS NetworkScreenHandler should not call...
[chromium-blink-merge.git] / extensions / renderer / context_menus_custom_bindings.cc
blob3f9d4ffa47b75ab6b6742e94ea07b1545765e402
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "extensions/renderer/context_menus_custom_bindings.h"
7 #include "base/bind.h"
8 #include "content/public/renderer/render_thread.h"
9 #include "extensions/common/extension_messages.h"
10 #include "v8/include/v8.h"
12 namespace {
14 void GetNextContextMenuId(const v8::FunctionCallbackInfo<v8::Value>& args) {
15 int context_menu_id = -1;
16 content::RenderThread::Get()->Send(
17 new ExtensionHostMsg_GenerateUniqueID(&context_menu_id));
18 args.GetReturnValue().Set(static_cast<int32_t>(context_menu_id));
21 } // namespace
23 namespace extensions {
25 ContextMenusCustomBindings::ContextMenusCustomBindings(ScriptContext* context)
26 : ObjectBackedNativeHandler(context) {
27 RouteFunction("GetNextContextMenuId", base::Bind(&GetNextContextMenuId));
30 } // extensions