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 // 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). |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 101 #include <map> | 101 #include <map> |
| 102 #include <string> | 102 #include <string> |
| 103 #include <vector> | 103 #include <vector> |
| 104 | 104 |
| 105 #include "base/memory/weak_ptr.h" | 105 #include "base/memory/weak_ptr.h" |
| 106 #include "ppapi/cpp/dev/scriptable_object_deprecated.h" | 106 #include "ppapi/cpp/dev/scriptable_object_deprecated.h" |
| 107 #include "ppapi/cpp/var.h" | 107 #include "ppapi/cpp/var.h" |
| 108 #include "remoting/client/plugin/chromoting_instance.h" | 108 #include "remoting/client/plugin/chromoting_instance.h" |
| 109 | 109 |
| 110 namespace base { | 110 namespace base { |
| 111 class MessageLoopProxy; | 111 class SingleThreadTaskRunner; |
| 112 }; // namespace base | 112 }; // namespace base |
| 113 | 113 |
| 114 namespace remoting { | 114 namespace remoting { |
| 115 | 115 |
| 116 // TODO(sergeyu): Remove this class when migration to messaging | 116 // TODO(sergeyu): Remove this class when migration to messaging |
| 117 // interface is finished (crbug.com/86353). | 117 // interface is finished (crbug.com/86353). |
| 118 class ChromotingScriptableObject | 118 class ChromotingScriptableObject |
| 119 : public pp::deprecated::ScriptableObject, | 119 : public pp::deprecated::ScriptableObject, |
| 120 public base::SupportsWeakPtr<ChromotingScriptableObject> { | 120 public base::SupportsWeakPtr<ChromotingScriptableObject> { |
| 121 public: | 121 public: |
| 122 ChromotingScriptableObject( | 122 ChromotingScriptableObject( |
| 123 ChromotingInstance* instance, | 123 ChromotingInstance* instance, |
|
Wez
2012/05/26 00:18:40
nit: Add a comment explaining that the instance mu
Sergey Ulanov
2012/05/30 01:07:07
Done.
| |
| 124 base::MessageLoopProxy* plugin_message_loop); | 124 base::SingleThreadTaskRunner* plugin_task_runner); |
|
Wez
2012/05/26 00:18:40
nit: scoped_refptr<>?
Wez
2012/05/26 00:18:40
nit: Clarify that we only need to pass the plugin
Wez
2012/05/26 00:18:40
ChromotingScriptableObject doesn't actually need a
Sergey Ulanov
2012/05/30 01:07:07
It assumes that the task runner runs all tasks on
Sergey Ulanov
2012/05/30 01:07:07
It's really necessary in case, though still might
Sergey Ulanov
2012/05/30 01:07:07
Potentially we can set ThreadTaskRunnerHandle for
| |
| 125 virtual ~ChromotingScriptableObject(); | 125 virtual ~ChromotingScriptableObject(); |
| 126 | 126 |
| 127 virtual void Init(); | 127 virtual void Init(); |
| 128 | 128 |
| 129 // Override the ScriptableObject functions. | 129 // Override the ScriptableObject functions. |
| 130 virtual bool HasProperty(const pp::Var& name, pp::Var* exception) OVERRIDE; | 130 virtual bool HasProperty(const pp::Var& name, pp::Var* exception) OVERRIDE; |
| 131 virtual bool HasMethod(const pp::Var& name, pp::Var* exception) OVERRIDE; | 131 virtual bool HasMethod(const pp::Var& name, pp::Var* exception) OVERRIDE; |
| 132 virtual pp::Var GetProperty(const pp::Var& name, pp::Var* exception) OVERRIDE; | 132 virtual pp::Var GetProperty(const pp::Var& name, pp::Var* exception) OVERRIDE; |
| 133 virtual void GetAllPropertyNames(std::vector<pp::Var>* properties, | 133 virtual void GetAllPropertyNames(std::vector<pp::Var>* properties, |
| 134 pp::Var* exception) OVERRIDE; | 134 pp::Var* exception) OVERRIDE; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 199 // This method is called by Javascript when the plugin loses input focus to | 199 // This method is called by Javascript when the plugin loses input focus to |
| 200 // release all pressed keys. | 200 // release all pressed keys. |
| 201 pp::Var DoReleaseAllKeys(const std::vector<pp::Var>& args, | 201 pp::Var DoReleaseAllKeys(const std::vector<pp::Var>& args, |
| 202 pp::Var* exception); | 202 pp::Var* exception); |
| 203 | 203 |
| 204 PropertyNameMap property_names_; | 204 PropertyNameMap property_names_; |
| 205 std::vector<PropertyDescriptor> properties_; | 205 std::vector<PropertyDescriptor> properties_; |
| 206 | 206 |
| 207 ChromotingInstance* instance_; | 207 ChromotingInstance* instance_; |
| 208 | 208 |
| 209 scoped_refptr<base::MessageLoopProxy> plugin_message_loop_; | 209 scoped_refptr<base::SingleThreadTaskRunner> plugin_task_runner_; |
| 210 | 210 |
| 211 DISALLOW_COPY_AND_ASSIGN(ChromotingScriptableObject); | 211 DISALLOW_COPY_AND_ASSIGN(ChromotingScriptableObject); |
| 212 }; | 212 }; |
| 213 | 213 |
| 214 } // namespace remoting | 214 } // namespace remoting |
| 215 | 215 |
| 216 #endif // REMOTING_CLIENT_PLUGIN_CHROMOTING_SCRIPTABLE_OBJECT_H_ | 216 #endif // REMOTING_CLIENT_PLUGIN_CHROMOTING_SCRIPTABLE_OBJECT_H_ |
| OLD | NEW |