Home | History | Annotate | Download | only in extensions
      1 // Copyright (c) 2012 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.
      4 
      5 #include "chrome/renderer/extensions/context_menus_custom_bindings.h"
      6 
      7 #include "base/bind.h"
      8 #include "chrome/common/extensions/extension_messages.h"
      9 #include "content/public/renderer/render_thread.h"
     10 #include "grit/renderer_resources.h"
     11 #include "v8/include/v8.h"
     12 
     13 namespace {
     14 
     15 void GetNextContextMenuId(const v8::FunctionCallbackInfo<v8::Value>& args) {
     16   int context_menu_id = -1;
     17   content::RenderThread::Get()->Send(
     18       new ExtensionHostMsg_GenerateUniqueID(&context_menu_id));
     19   args.GetReturnValue().Set(static_cast<int32_t>(context_menu_id));
     20 }
     21 
     22 }  // namespace
     23 
     24 namespace extensions {
     25 
     26 ContextMenusCustomBindings::ContextMenusCustomBindings(
     27     Dispatcher* dispatcher, ChromeV8Context* context)
     28     : ChromeV8Extension(dispatcher, context) {
     29   RouteFunction("GetNextContextMenuId", base::Bind(&GetNextContextMenuId));
     30 }
     31 
     32 }  // extensions
     33