| OLD | NEW |
| (Empty) |
| 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 #ifndef CHROME_RENDERER_EXTENSIONS_SCHEMA_GENERATED_BINDINGS_H_ | |
| 6 #define CHROME_RENDERER_EXTENSIONS_SCHEMA_GENERATED_BINDINGS_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include <string> | |
| 10 | |
| 11 #include "chrome/renderer/extensions/chrome_v8_extension.h" | |
| 12 | |
| 13 class ExtensionDispatcher; | |
| 14 class ExtensionRequestSender; | |
| 15 class ChromeV8ContextSet; | |
| 16 class ChromeV8Extension; | |
| 17 | |
| 18 namespace base { | |
| 19 class ListValue; | |
| 20 class Value; | |
| 21 } | |
| 22 | |
| 23 namespace v8 { | |
| 24 class Extension; | |
| 25 } | |
| 26 | |
| 27 namespace extensions { | |
| 28 | |
| 29 // Generates JavaScript bindings for the extension system from the JSON | |
| 30 // declarations in chrome/common/extensions/api/. | |
| 31 // TODO(koz): Split this up so that GetNextRequestId/StartRequest and | |
| 32 // SetIconCommon are in separate classes. | |
| 33 class SchemaGeneratedBindings : public ChromeV8Extension { | |
| 34 public: | |
| 35 explicit SchemaGeneratedBindings(ExtensionDispatcher* extension_dispatcher, | |
| 36 ExtensionRequestSender* request_sender); | |
| 37 | |
| 38 private: | |
| 39 v8::Handle<v8::Value> GetExtensionAPIDefinition(const v8::Arguments& args); | |
| 40 v8::Handle<v8::Value> GetNextRequestId(const v8::Arguments& args); | |
| 41 | |
| 42 // Common code for starting an API request to the browser. |value_args| | |
| 43 // contains the request's arguments. | |
| 44 // Steals value_args contents for efficiency. | |
| 45 v8::Handle<v8::Value> StartRequestCommon(const v8::Arguments& args, | |
| 46 base::ListValue* value_args); | |
| 47 | |
| 48 // Starts an API request to the browser, with an optional callback. The | |
| 49 // callback will be dispatched to EventBindings::HandleResponse. | |
| 50 v8::Handle<v8::Value> StartRequest(const v8::Arguments& args); | |
| 51 | |
| 52 bool ConvertImageDataToBitmapValue(const v8::Arguments& args, | |
| 53 base::Value** bitmap_value); | |
| 54 | |
| 55 // A special request for setting the extension action icon. This function | |
| 56 // accepts a canvas ImageData object, so it needs to do extra processing | |
| 57 // before sending the request to the browser. | |
| 58 v8::Handle<v8::Value> SetIconCommon(const v8::Arguments& args); | |
| 59 | |
| 60 ExtensionRequestSender* request_sender_; | |
| 61 | |
| 62 DISALLOW_COPY_AND_ASSIGN(SchemaGeneratedBindings); | |
| 63 }; | |
| 64 | |
| 65 } // namespace extensions | |
| 66 | |
| 67 #endif // CHROME_RENDERER_EXTENSIONS_SCHEMA_GENERATED_BINDINGS_H_ | |
| OLD | NEW |