Delete chrome.mediaGalleriesPrivate because the functionality unique to it has since...
[chromium-blink-merge.git] / chrome / renderer / extensions / chrome_v8_extension_handler.cc
blob0698dd498dfdf0e4f324650b47a708113dbe28a6
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.
5 #include "chrome/renderer/extensions/chrome_v8_extension_handler.h"
7 #include "base/logging.h"
8 #include "content/public/renderer/render_thread.h"
9 #include "extensions/renderer/script_context.h"
11 using content::RenderThread;
13 namespace extensions {
15 ChromeV8ExtensionHandler::ChromeV8ExtensionHandler(ScriptContext* context)
16 : context_(context), routing_id_(MSG_ROUTING_NONE) {
19 ChromeV8ExtensionHandler::~ChromeV8ExtensionHandler() {
20 if (routing_id_ != MSG_ROUTING_NONE)
21 RenderThread::Get()->RemoveRoute(routing_id_);
24 int ChromeV8ExtensionHandler::GetRoutingID() {
25 if (routing_id_ == MSG_ROUTING_NONE) {
26 routing_id_ = RenderThread::Get()->GenerateRoutingID();
27 RenderThread::Get()->AddRoute(routing_id_, this);
30 return routing_id_;
33 void ChromeV8ExtensionHandler::Send(IPC::Message* message) {
34 RenderThread::Get()->Send(message);
37 } // namespace extensions