Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_RENDERER_EXTENSIONS_SCHEMA_GENERATED_BINDINGS_H_ | 5 #ifndef CHROME_RENDERER_EXTENSIONS_SCHEMA_GENERATED_BINDINGS_H_ |
| 6 #define CHROME_RENDERER_EXTENSIONS_SCHEMA_GENERATED_BINDINGS_H_ | 6 #define CHROME_RENDERER_EXTENSIONS_SCHEMA_GENERATED_BINDINGS_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "chrome/renderer/extensions/chrome_v8_extension.h" | 11 #include "chrome/renderer/extensions/chrome_v8_extension.h" |
| 12 | 12 |
| 13 class ExtensionDispatcher; | 13 class ExtensionDispatcher; |
| 14 class ExtensionRequestSender; | |
| 14 class ChromeV8ContextSet; | 15 class ChromeV8ContextSet; |
| 15 class ChromeV8Extension; | 16 class ChromeV8Extension; |
|
not at google - send to devlin
2012/03/30 03:14:31
nit that has nothing to do with your change: :sort
koz (OOO until 15th September)
2012/04/03 00:15:17
This class gets deleted in the follow-up, so I'll
| |
| 16 | 17 |
| 17 namespace base { | 18 namespace base { |
| 18 class ListValue; | 19 class ListValue; |
| 19 class Value; | 20 class Value; |
| 20 } | 21 } |
| 21 | 22 |
| 22 namespace v8 { | 23 namespace v8 { |
| 23 class Extension; | 24 class Extension; |
| 24 } | 25 } |
| 25 | 26 |
| 26 namespace extensions { | 27 namespace extensions { |
| 27 | 28 |
| 28 // Generates JavaScript bindings for the extension system from the JSON | 29 // Generates JavaScript bindings for the extension system from the JSON |
| 29 // declarations in chrome/common/extensions/api/. | 30 // declarations in chrome/common/extensions/api/. |
| 30 // TODO(koz): Split this up so that GetNextRequestId/StartRequest and | 31 // TODO(koz): Split this up so that GetNextRequestId/StartRequest and |
| 31 // SetIconCommon are in separate classes. | 32 // SetIconCommon are in separate classes. |
| 32 class SchemaGeneratedBindings : public ChromeV8Extension { | 33 class SchemaGeneratedBindings : public ChromeV8Extension { |
| 33 public: | 34 public: |
| 34 explicit SchemaGeneratedBindings(ExtensionDispatcher* extension_dispatcher); | 35 explicit SchemaGeneratedBindings(ExtensionDispatcher* extension_dispatcher, |
|
not at google - send to devlin
2012/03/30 03:14:31
doesn't need to be "explicit" anymore
koz (OOO until 15th September)
2012/04/03 00:15:17
ditto
| |
| 35 | 36 ExtensionRequestSender* request_sender); |
| 36 // Handles a response to an API request. Sets |extension_id|. | |
| 37 static void HandleResponse(const ChromeV8ContextSet& contexts, | |
| 38 int request_id, | |
| 39 bool success, | |
| 40 const std::string& response, | |
| 41 const std::string& error, | |
| 42 std::string* extension_id); | |
| 43 | 37 |
| 44 private: | 38 private: |
| 45 v8::Handle<v8::Value> GetExtensionAPIDefinition(const v8::Arguments& args); | 39 v8::Handle<v8::Value> GetExtensionAPIDefinition(const v8::Arguments& args); |
| 46 v8::Handle<v8::Value> GetNextRequestId(const v8::Arguments& args); | 40 v8::Handle<v8::Value> GetNextRequestId(const v8::Arguments& args); |
| 47 | 41 |
| 48 // Common code for starting an API request to the browser. |value_args| | 42 // Common code for starting an API request to the browser. |value_args| |
| 49 // contains the request's arguments. | 43 // contains the request's arguments. |
| 50 // Steals value_args contents for efficiency. | 44 // Steals value_args contents for efficiency. |
| 51 v8::Handle<v8::Value> StartRequestCommon(const v8::Arguments& args, | 45 v8::Handle<v8::Value> StartRequestCommon(const v8::Arguments& args, |
| 52 base::ListValue* value_args); | 46 base::ListValue* value_args); |
| 53 | 47 |
| 54 // Starts an API request to the browser, with an optional callback. The | 48 // Starts an API request to the browser, with an optional callback. The |
| 55 // callback will be dispatched to EventBindings::HandleResponse. | 49 // callback will be dispatched to EventBindings::HandleResponse. |
| 56 v8::Handle<v8::Value> StartRequest(const v8::Arguments& args); | 50 v8::Handle<v8::Value> StartRequest(const v8::Arguments& args); |
| 57 | 51 |
| 58 bool ConvertImageDataToBitmapValue(const v8::Arguments& args, | 52 bool ConvertImageDataToBitmapValue(const v8::Arguments& args, |
| 59 base::Value** bitmap_value); | 53 base::Value** bitmap_value); |
| 60 | 54 |
| 61 // A special request for setting the extension action icon. This function | 55 // A special request for setting the extension action icon. This function |
| 62 // accepts a canvas ImageData object, so it needs to do extra processing | 56 // accepts a canvas ImageData object, so it needs to do extra processing |
| 63 // before sending the request to the browser. | 57 // before sending the request to the browser. |
| 64 v8::Handle<v8::Value> SetIconCommon(const v8::Arguments& args); | 58 v8::Handle<v8::Value> SetIconCommon(const v8::Arguments& args); |
| 65 | 59 |
| 60 ExtensionRequestSender* request_sender_; | |
| 61 | |
| 66 DISALLOW_COPY_AND_ASSIGN(SchemaGeneratedBindings); | 62 DISALLOW_COPY_AND_ASSIGN(SchemaGeneratedBindings); |
| 67 }; | 63 }; |
| 68 | 64 |
| 69 } // namespace extensions | 65 } // namespace extensions |
| 70 | 66 |
| 71 #endif // CHROME_RENDERER_EXTENSIONS_SCHEMA_GENERATED_BINDINGS_H_ | 67 #endif // CHROME_RENDERER_EXTENSIONS_SCHEMA_GENERATED_BINDINGS_H_ |
| OLD | NEW |