Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Side by Side Diff: remoting/client/plugin/chromoting_scriptable_object.h

Issue 8573024: Clean up client state callback. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed unused error code. Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 // This implements the JavaScript class entrypoint for the plugin instance. 5 // This implements the JavaScript class entrypoint for the plugin instance.
6 // The Javascript API is defined as follows. 6 // The Javascript API is defined as follows.
7 // 7 //
8 // interface ChromotingScriptableObject { 8 // interface ChromotingScriptableObject {
9 // 9 //
10 // // Chromoting session API version (for this plugin). 10 // // Chromoting session API version (for this plugin).
11 // // This is compared with the javascript API version to verify that they are 11 // // This is compared with the javascript API version to verify that they are
12 // // compatible. 12 // // compatible.
13 // readonly attribute unsigned short apiVersion; 13 // readonly attribute unsigned short apiVersion;
14 // 14 //
15 // // The oldest API version that we support. 15 // // The oldest API version that we support.
16 // // This will differ from |apiVersion| if we decide to maintain backward 16 // // This will differ from |apiVersion| if we decide to maintain backward
17 // // compatibility with older API versions. 17 // // compatibility with older API versions.
18 // readonly attribute unsigned short apiMinVersion; 18 // readonly attribute unsigned short apiMinVersion;
19 // 19 //
20 // // Connection status. 20 // // Connection status.
21 // readonly attribute unsigned short status; 21 // readonly attribute unsigned short status;
22 // 22 //
23 // // Constants for connection status. 23 // // Constants for connection status.
24 // const unsigned short STATUS_UNKNOWN; 24 // const unsigned short STATUS_UNKNOWN;
Sergey Ulanov 2011/11/16 23:08:12 Since these values are not used anymore can we rem
Jamie 2011/11/17 22:06:18 Done.
25 // const unsigned short STATUS_CONNECTING; 25 // const unsigned short STATUS_CONNECTING;
26 // const unsigned short STATUS_INITIALIZING; 26 // const unsigned short STATUS_INITIALIZING;
27 // const unsigned short STATUS_CONNECTED; 27 // const unsigned short STATUS_CONNECTED;
28 // const unsigned short STATUS_CLOSED; 28 // const unsigned short STATUS_CLOSED;
29 // const unsigned short STATUS_FAILED; 29 // const unsigned short STATUS_FAILED;
30 // 30 //
31 // // Constants for connection errors. 31 // // Constants for connection errors.
32 // const unsigned short ERROR_NONE; 32 // const unsigned short ERROR_NONE;
33 // const unsigned short ERROR_HOST_IS_OFFLINE; 33 // const unsigned short ERROR_HOST_IS_OFFLINE;
34 // const unsigned short ERROR_SESSION_REJECTED; 34 // const unsigned short ERROR_SESSION_REJECTED;
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 113
114 namespace remoting { 114 namespace remoting {
115 115
116 class ChromotingInstance; 116 class ChromotingInstance;
117 class PepperXmppProxy; 117 class PepperXmppProxy;
118 118
119 class ChromotingScriptableObject 119 class ChromotingScriptableObject
120 : public pp::deprecated::ScriptableObject, 120 : public pp::deprecated::ScriptableObject,
121 public base::SupportsWeakPtr<ChromotingScriptableObject> { 121 public base::SupportsWeakPtr<ChromotingScriptableObject> {
122 public: 122 public:
123 // These state values are duplicated in the JS code. Remember to update both
124 // copies when making changes.
123 enum ConnectionStatus { 125 enum ConnectionStatus {
124 STATUS_UNKNOWN = 0, 126 STATUS_UNKNOWN = 0,
125 STATUS_CONNECTING, 127 STATUS_CONNECTING,
126 STATUS_INITIALIZING, 128 STATUS_INITIALIZING,
127 STATUS_CONNECTED, 129 STATUS_CONNECTED,
128 STATUS_CLOSED, 130 STATUS_CLOSED,
129 STATUS_FAILED, 131 STATUS_FAILED,
130 }; 132 };
131 133
134 // These state values are duplicated in the JS code. Remember to update both
135 // copies when making changes.
132 enum ConnectionError { 136 enum ConnectionError {
133 ERROR_NONE = 0, 137 ERROR_NONE = 0,
134 ERROR_HOST_IS_OFFLINE, 138 ERROR_HOST_IS_OFFLINE,
135 ERROR_SESSION_REJECTED, 139 ERROR_SESSION_REJECTED,
136 ERROR_INCOMPATIBLE_PROTOCOL, 140 ERROR_INCOMPATIBLE_PROTOCOL,
137 ERROR_NETWORK_FAILURE, 141 ERROR_NETWORK_FAILURE,
138 }; 142 };
139 143
140 ChromotingScriptableObject( 144 ChromotingScriptableObject(
141 ChromotingInstance* instance, 145 ChromotingInstance* instance,
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 194
191 std::string name; 195 std::string name;
192 pp::Var attribute; 196 pp::Var attribute;
193 MethodHandler method; 197 MethodHandler method;
194 }; 198 };
195 199
196 // Routines to add new attribute, method properties. 200 // Routines to add new attribute, method properties.
197 void AddAttribute(const std::string& name, pp::Var attribute); 201 void AddAttribute(const std::string& name, pp::Var attribute);
198 void AddMethod(const std::string& name, MethodHandler handler); 202 void AddMethod(const std::string& name, MethodHandler handler);
199 203
200 void SignalConnectionInfoChange(); 204 void SignalConnectionInfoChange(int status, int error);
201 void SignalDesktopSizeChange(); 205 void SignalDesktopSizeChange();
202 206
203 // Calls to these methods are posted to the plugin thread so that we 207 // Calls to these methods are posted to the plugin thread so that we
204 // call JavaScript with clean stack. This is necessary because 208 // call JavaScript with clean stack. This is necessary because
205 // JavaScript event handlers may destroy the plugin. 209 // JavaScript event handlers may destroy the plugin.
206 void DoSignalConnectionInfoChange(); 210 void DoSignalConnectionInfoChange(int status, int error);
207 void DoSignalDesktopSizeChange(); 211 void DoSignalDesktopSizeChange();
208 void DoSendIq(const std::string& message_xml); 212 void DoSendIq(const std::string& message_xml);
209 213
210 pp::Var DoConnect(const std::vector<pp::Var>& args, pp::Var* exception); 214 pp::Var DoConnect(const std::vector<pp::Var>& args, pp::Var* exception);
211 pp::Var DoDisconnect(const std::vector<pp::Var>& args, pp::Var* exception); 215 pp::Var DoDisconnect(const std::vector<pp::Var>& args, pp::Var* exception);
212 216
213 // This method is called by JS to set scale-to-fit. 217 // This method is called by JS to set scale-to-fit.
214 pp::Var DoSetScaleToFit(const std::vector<pp::Var>& args, pp::Var* exception); 218 pp::Var DoSetScaleToFit(const std::vector<pp::Var>& args, pp::Var* exception);
215 219
216 // This method is called by Javascript to provide responses to sendIq() 220 // This method is called by Javascript to provide responses to sendIq()
(...skipping 13 matching lines...) Expand all
230 234
231 scoped_refptr<base::MessageLoopProxy> plugin_message_loop_; 235 scoped_refptr<base::MessageLoopProxy> plugin_message_loop_;
232 ScopedRunnableMethodFactory<ChromotingScriptableObject> task_factory_; 236 ScopedRunnableMethodFactory<ChromotingScriptableObject> task_factory_;
233 237
234 DISALLOW_COPY_AND_ASSIGN(ChromotingScriptableObject); 238 DISALLOW_COPY_AND_ASSIGN(ChromotingScriptableObject);
235 }; 239 };
236 240
237 } // namespace remoting 241 } // namespace remoting
238 242
239 #endif // REMOTING_CLIENT_PLUGIN_CHROMOTING_SCRIPTABLE_OBJECT_H_ 243 #endif // REMOTING_CLIENT_PLUGIN_CHROMOTING_SCRIPTABLE_OBJECT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698