Guarantee CleanUpAfterPage gets run even if CloseConnection fails.
[chromium-blink-merge.git] / extensions / renderer / send_request_natives.h
blobcc0e6a058df9c531c78aedc231b6932fdb3471f0
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 #ifndef EXTENSIONS_RENDERER_SEND_REQUEST_NATIVES_H_
6 #define EXTENSIONS_RENDERER_SEND_REQUEST_NATIVES_H_
8 #include "extensions/renderer/object_backed_native_handler.h"
9 #include "v8/include/v8.h"
11 namespace extensions {
12 class RequestSender;
13 class ScriptContext;
15 // Native functions exposed to extensions via JS for calling API functions in
16 // the browser.
17 class SendRequestNatives : public ObjectBackedNativeHandler {
18 public:
19 SendRequestNatives(RequestSender* request_sender, ScriptContext* context);
21 private:
22 void GetNextRequestId(const v8::FunctionCallbackInfo<v8::Value>& args);
24 // Starts an API request to the browser, with an optional callback. The
25 // callback will be dispatched to EventBindings::HandleResponse.
26 void StartRequest(const v8::FunctionCallbackInfo<v8::Value>& args);
28 // Gets a reference to an object's global object.
29 void GetGlobal(const v8::FunctionCallbackInfo<v8::Value>& args);
31 RequestSender* request_sender_;
33 DISALLOW_COPY_AND_ASSIGN(SendRequestNatives);
36 } // namespace extensions
38 #endif // EXTENSIONS_RENDERER_SEND_REQUEST_NATIVES_H_