OLD | NEW |
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 #include "remoting/client/plugin/chromoting_scriptable_object.h" | 5 #include "remoting/client/plugin/chromoting_scriptable_object.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/stringprintf.h" | 8 #include "base/stringprintf.h" |
9 #include "ppapi/cpp/var.h" | 9 #include "ppapi/cpp/var.h" |
10 #include "remoting/client/client_config.h" | 10 #include "remoting/client/client_config.h" |
11 #include "remoting/client/chromoting_stats.h" | 11 #include "remoting/client/chromoting_stats.h" |
12 #include "remoting/client/plugin/chromoting_instance.h" | 12 #include "remoting/client/plugin/chromoting_instance.h" |
13 #include "remoting/client/plugin/pepper_xmpp_proxy.h" | 13 #include "remoting/client/plugin/pepper_xmpp_proxy.h" |
14 | 14 |
15 using pp::Var; | 15 using pp::Var; |
16 | 16 |
17 namespace remoting { | 17 namespace remoting { |
18 | 18 |
19 namespace { | 19 namespace { |
20 | 20 |
| 21 const char kApiVersionAttribute[] = "apiVersion"; |
| 22 const char kApiMinVersionAttribute[] = "apiMinVersion"; |
21 const char kConnectionInfoUpdate[] = "connectionInfoUpdate"; | 23 const char kConnectionInfoUpdate[] = "connectionInfoUpdate"; |
22 const char kDebugInfo[] = "debugInfo"; | 24 const char kDebugInfo[] = "debugInfo"; |
23 const char kDesktopHeight[] = "desktopHeight"; | 25 const char kDesktopHeight[] = "desktopHeight"; |
24 const char kDesktopWidth[] = "desktopWidth"; | 26 const char kDesktopWidth[] = "desktopWidth"; |
25 const char kDesktopSizeUpdate[] = "desktopSizeUpdate"; | 27 const char kDesktopSizeUpdate[] = "desktopSizeUpdate"; |
26 const char kLoginChallenge[] = "loginChallenge"; | 28 const char kLoginChallenge[] = "loginChallenge"; |
27 const char kSendIq[] = "sendIq"; | 29 const char kSendIq[] = "sendIq"; |
28 const char kQualityAttribute[] = "quality"; | 30 const char kQualityAttribute[] = "quality"; |
29 const char kStatusAttribute[] = "status"; | 31 const char kStatusAttribute[] = "status"; |
30 const char kVideoBandwidthAttribute[] = "videoBandwidth"; | 32 const char kVideoBandwidthAttribute[] = "videoBandwidth"; |
(...skipping 10 matching lines...) Expand all Loading... |
41 : instance_(instance) { | 43 : instance_(instance) { |
42 } | 44 } |
43 | 45 |
44 ChromotingScriptableObject::~ChromotingScriptableObject() { | 46 ChromotingScriptableObject::~ChromotingScriptableObject() { |
45 } | 47 } |
46 | 48 |
47 void ChromotingScriptableObject::Init() { | 49 void ChromotingScriptableObject::Init() { |
48 // Property addition order should match the interface description at the | 50 // Property addition order should match the interface description at the |
49 // top of chromoting_scriptable_object.h. | 51 // top of chromoting_scriptable_object.h. |
50 | 52 |
| 53 // Plugin API version. |
| 54 // This should be incremented whenever the API interface changes. |
| 55 AddAttribute(kApiVersionAttribute, Var(1)); |
| 56 |
| 57 // This should be updated whenever we remove support for an older version |
| 58 // of the API. |
| 59 AddAttribute(kApiMinVersionAttribute, Var(1)); |
| 60 |
51 // Connection status. | 61 // Connection status. |
52 AddAttribute(kStatusAttribute, Var(STATUS_UNKNOWN)); | 62 AddAttribute(kStatusAttribute, Var(STATUS_UNKNOWN)); |
53 | 63 |
54 // Connection status values. | 64 // Connection status values. |
55 AddAttribute("STATUS_UNKNOWN", Var(STATUS_UNKNOWN)); | 65 AddAttribute("STATUS_UNKNOWN", Var(STATUS_UNKNOWN)); |
56 AddAttribute("STATUS_CONNECTING", Var(STATUS_CONNECTING)); | 66 AddAttribute("STATUS_CONNECTING", Var(STATUS_CONNECTING)); |
57 AddAttribute("STATUS_INITIALIZING", Var(STATUS_INITIALIZING)); | 67 AddAttribute("STATUS_INITIALIZING", Var(STATUS_INITIALIZING)); |
58 AddAttribute("STATUS_CONNECTED", Var(STATUS_CONNECTED)); | 68 AddAttribute("STATUS_CONNECTED", Var(STATUS_CONNECTED)); |
59 AddAttribute("STATUS_CLOSED", Var(STATUS_CLOSED)); | 69 AddAttribute("STATUS_CLOSED", Var(STATUS_CLOSED)); |
60 AddAttribute("STATUS_FAILED", Var(STATUS_FAILED)); | 70 AddAttribute("STATUS_FAILED", Var(STATUS_FAILED)); |
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
464 *exception = Var("response_xml must be a string."); | 474 *exception = Var("response_xml must be a string."); |
465 return Var(); | 475 return Var(); |
466 } | 476 } |
467 | 477 |
468 xmpp_proxy_->OnIq(args[0].AsString()); | 478 xmpp_proxy_->OnIq(args[0].AsString()); |
469 | 479 |
470 return Var(); | 480 return Var(); |
471 } | 481 } |
472 | 482 |
473 } // namespace remoting | 483 } // namespace remoting |
OLD | NEW |