| 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 CONTENT_RENDERER_DOM_AUTOMATION_CONTROLLER_H_ | 5 #ifndef CONTENT_RENDERER_DOM_AUTOMATION_CONTROLLER_H_ |
| 6 #define CONTENT_RENDERER_DOM_AUTOMATION_CONTROLLER_H_ | 6 #define CONTENT_RENDERER_DOM_AUTOMATION_CONTROLLER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "ipc/ipc_message.h" | 9 #include "ipc/ipc_message.h" |
| 10 #include "webkit/glue/cpp_bound_class.h" | 10 #include "webkit/glue/cpp_bound_class.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 (6) The value and the automation_id_ is extracted out of the message received | 67 (6) The value and the automation_id_ is extracted out of the message received |
| 68 in (5). This value is relayed to AProxy using another IPC message. | 68 in (5). This value is relayed to AProxy using another IPC message. |
| 69 automation_id_ is used to route the message. | 69 automation_id_ is used to route the message. |
| 70 (IPC messages, AutomationMsg_Dom*Response) | 70 (IPC messages, AutomationMsg_Dom*Response) |
| 71 | 71 |
| 72 */ | 72 */ |
| 73 | 73 |
| 74 // TODO(vibhor): Add another method-pair like sendLater() and sendNow() | 74 // TODO(vibhor): Add another method-pair like sendLater() and sendNow() |
| 75 // sendLater() should keep building a json serializer | 75 // sendLater() should keep building a json serializer |
| 76 // sendNow() should send the above serializer as a string. | 76 // sendNow() should send the above serializer as a string. |
| 77 class DomAutomationController : public CppBoundClass { | 77 class DomAutomationController : public webkit_glue::CppBoundClass { |
| 78 public: | 78 public: |
| 79 DomAutomationController(); | 79 DomAutomationController(); |
| 80 | 80 |
| 81 // Makes the renderer send a javascript value to the app. | 81 // Makes the renderer send a javascript value to the app. |
| 82 // The value to be sent can be either of type NPString, | 82 // The value to be sent can be either of type NPString, |
| 83 // Number (double casted to int32) or boolean. | 83 // Number (double casted to int32) or boolean. |
| 84 // The function returns true/false based on the result of actual send over | 84 // The function returns true/false based on the result of actual send over |
| 85 // IPC. It sets the return value to null on unexpected errors or arguments. | 85 // IPC. It sets the return value to null on unexpected errors or arguments. |
| 86 void Send(const CppArgumentList& args, CppVariant* result); | 86 void Send(const webkit_glue::CppArgumentList& args, |
| 87 webkit_glue::CppVariant* result); |
| 87 | 88 |
| 88 // Makes the renderer send a javascript value to the app. | 89 // Makes the renderer send a javascript value to the app. |
| 89 // The value must be a NPString and should be properly formed JSON. | 90 // The value must be a NPString and should be properly formed JSON. |
| 90 // This function does not modify/escape the returned string in any way. | 91 // This function does not modify/escape the returned string in any way. |
| 91 void SendJSON(const CppArgumentList& args, CppVariant* result); | 92 void SendJSON(const webkit_glue::CppArgumentList& args, |
| 93 webkit_glue::CppVariant* result); |
| 92 | 94 |
| 93 // Sends a string with a provided Automation Id. | 95 // Sends a string with a provided Automation Id. |
| 94 // Expects two javascript values; the first must be a number type and will be | 96 // Expects two javascript values; the first must be a number type and will be |
| 95 // used as the Automation Id, the second must be of type NPString. | 97 // used as the Automation Id, the second must be of type NPString. |
| 96 // The function returns true/false to the javascript based on the success | 98 // The function returns true/false to the javascript based on the success |
| 97 // of the send over IPC. It sets the javascript return value to null on | 99 // of the send over IPC. It sets the javascript return value to null on |
| 98 // unexpected errors or arguments. | 100 // unexpected errors or arguments. |
| 99 void SendWithId(const CppArgumentList& args, CppVariant* result); | 101 void SendWithId(const webkit_glue::CppArgumentList& args, |
| 102 webkit_glue::CppVariant* result); |
| 100 | 103 |
| 101 void SetAutomationId(const CppArgumentList& args, CppVariant* result); | 104 void SetAutomationId(const webkit_glue::CppArgumentList& args, |
| 105 webkit_glue::CppVariant* result); |
| 102 | 106 |
| 103 // TODO(vibhor): Implement later | 107 // TODO(vibhor): Implement later |
| 104 // static CppBindingObjectMethod sendLater; | 108 // static CppBindingObjectMethod sendLater; |
| 105 // static CppBindingObjectMethod sendNow; | 109 // static CppBindingObjectMethod sendNow; |
| 106 | 110 |
| 107 void set_routing_id(int routing_id) { routing_id_ = routing_id; } | 111 void set_routing_id(int routing_id) { routing_id_ = routing_id; } |
| 108 | 112 |
| 109 void set_message_sender(IPC::Message::Sender* sender) { | 113 void set_message_sender(IPC::Message::Sender* sender) { |
| 110 sender_ = sender; | 114 sender_ = sender; |
| 111 } | 115 } |
| 112 | 116 |
| 113 private: | 117 private: |
| 114 IPC::Message::Sender* sender_; | 118 IPC::Message::Sender* sender_; |
| 115 | 119 |
| 116 // Refer to the comments at the top of the file for more details. | 120 // Refer to the comments at the top of the file for more details. |
| 117 int routing_id_; // routing id to be used by first channel. | 121 int routing_id_; // routing id to be used by first channel. |
| 118 int automation_id_; // routing id to be used by the next channel. | 122 int automation_id_; // routing id to be used by the next channel. |
| 119 }; | 123 }; |
| 120 | 124 |
| 121 #endif // CONTENT_RENDERER_DOM_AUTOMATION_CONTROLLER_H_ | 125 #endif // CONTENT_RENDERER_DOM_AUTOMATION_CONTROLLER_H_ |
| OLD | NEW |