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

Side by Side Diff: remoting/host/plugin/host_script_object.h

Issue 49113003: It2Me native messaging: GYP and source refactoring (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Max/Linux build break: remoting_native_messaging_host Created 7 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) 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 REMOTING_HOST_PLUGIN_HOST_SCRIPT_OBJECT_H_ 5 #ifndef REMOTING_HOST_PLUGIN_HOST_SCRIPT_OBJECT_H_
6 #define REMOTING_HOST_PLUGIN_HOST_SCRIPT_OBJECT_H_ 6 #define REMOTING_HOST_PLUGIN_HOST_SCRIPT_OBJECT_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
13 #include "base/thread_task_runner_handle.h" 13 #include "base/thread_task_runner_handle.h"
14 #include "base/time/time.h" 14 #include "base/time/time.h"
15 #include "remoting/base/auto_thread_task_runner.h" 15 #include "remoting/base/auto_thread_task_runner.h"
16 #include "remoting/host/it2me/it2me_impl.h" 16 #include "remoting/host/it2me/it2me_host.h"
17 #include "remoting/host/plugin/host_plugin_utils.h" 17 #include "remoting/host/plugin/host_plugin_utils.h"
18 #include "remoting/host/setup/daemon_controller.h" 18 #include "remoting/host/setup/daemon_controller.h"
19 #include "remoting/jingle_glue/xmpp_signal_strategy.h" 19 #include "remoting/jingle_glue/xmpp_signal_strategy.h"
20 #include "remoting/protocol/pairing_registry.h" 20 #include "remoting/protocol/pairing_registry.h"
21 21
22 namespace remoting { 22 namespace remoting {
23 23
24 // NPAPI plugin implementation for remoting host script object. 24 // NPAPI plugin implementation for remoting host script object.
25 // HostNPScriptObject creates threads that are required to run 25 // HostNPScriptObject creates threads that are required to run
26 // ChromotingHost and starts/stops the host on those threads. When 26 // ChromotingHost and starts/stops the host on those threads. When
27 // destroyed it synchronously shuts down the host and all threads. 27 // destroyed it synchronously shuts down the host and all threads.
28 class HostNPScriptObject : public It2MeImpl::Observer { 28 class HostNPScriptObject : public It2MeHost::Observer {
29 public: 29 public:
30 HostNPScriptObject(NPP plugin, 30 HostNPScriptObject(NPP plugin,
31 NPObject* parent, 31 NPObject* parent,
32 scoped_refptr<AutoThreadTaskRunner> plugin_task_runner); 32 scoped_refptr<AutoThreadTaskRunner> plugin_task_runner);
33 virtual ~HostNPScriptObject(); 33 virtual ~HostNPScriptObject();
34 34
35 // Implementations used to implement the NPObject interface. 35 // Implementations used to implement the NPObject interface.
36 bool HasMethod(const std::string& method_name); 36 bool HasMethod(const std::string& method_name);
37 bool InvokeDefault(const NPVariant* args, 37 bool InvokeDefault(const NPVariant* args,
38 uint32_t arg_count, 38 uint32_t arg_count,
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 // function(number) done_callback 150 // function(number) done_callback
151 bool StartDaemon(const NPVariant* args, 151 bool StartDaemon(const NPVariant* args,
152 uint32_t arg_count, 152 uint32_t arg_count,
153 NPVariant* result); 153 NPVariant* result);
154 154
155 // Stop the daemon process. Args are: 155 // Stop the daemon process. Args are:
156 // function(number) done_callback 156 // function(number) done_callback
157 bool StopDaemon(const NPVariant* args, uint32_t arg_count, NPVariant* result); 157 bool StopDaemon(const NPVariant* args, uint32_t arg_count, NPVariant* result);
158 158
159 ////////////////////////////////////////////////////////// 159 //////////////////////////////////////////////////////////
160 // Implementation of It2MeImpl::Observer methods. 160 // Implementation of It2MeHost::Observer methods.
161 161
162 // Notifies OnStateChanged handler of a state change. 162 // Notifies OnStateChanged handler of a state change.
163 virtual void OnStateChanged(It2MeHostState state) OVERRIDE; 163 virtual void OnStateChanged(It2MeHostState state) OVERRIDE;
164 164
165 // If the web-app has registered a callback to be notified of changes to the 165 // If the web-app has registered a callback to be notified of changes to the
166 // NAT traversal policy, notify it. 166 // NAT traversal policy, notify it.
167 virtual void OnNatPolicyChanged(bool nat_traversal_enabled) OVERRIDE; 167 virtual void OnNatPolicyChanged(bool nat_traversal_enabled) OVERRIDE;
168 168
169 // Stores the Access Code for the web-app to query. 169 // Stores the Access Code for the web-app to query.
170 virtual void OnStoreAccessCode(const std::string& access_code, 170 virtual void OnStoreAccessCode(const std::string& access_code,
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 259
260 // True if we're in the middle of handling a log message. 260 // True if we're in the middle of handling a log message.
261 bool am_currently_logging_; 261 bool am_currently_logging_;
262 262
263 ScopedRefNPObject log_debug_info_func_; 263 ScopedRefNPObject log_debug_info_func_;
264 264
265 ////////////////////////////////////////////////////////// 265 //////////////////////////////////////////////////////////
266 // It2Me host state. 266 // It2Me host state.
267 267
268 // Internal implementation of the It2Me host function. 268 // Internal implementation of the It2Me host function.
269 scoped_refptr<It2MeImpl> it2me_impl_; 269 scoped_refptr<It2MeHost> it2me_host_;
270 270
271 // Cached, read-only copies of |it2me_impl_| session state. 271 // Cached, read-only copies of |it2me_host_| session state.
272 It2MeHostState state_; 272 It2MeHostState state_;
273 std::string access_code_; 273 std::string access_code_;
274 base::TimeDelta access_code_lifetime_; 274 base::TimeDelta access_code_lifetime_;
275 std::string client_username_; 275 std::string client_username_;
276 276
277 // IT2Me Talk server configuration used by |it2me_impl_| to connect. 277 // IT2Me Talk server configuration used by |it2me_host_| to connect.
278 XmppSignalStrategy::XmppServerConfig xmpp_server_config_; 278 XmppSignalStrategy::XmppServerConfig xmpp_server_config_;
279 279
280 // Chromoting Bot JID used by |it2me_impl_| to register the host. 280 // Chromoting Bot JID used by |it2me_host_| to register the host.
281 std::string directory_bot_jid_; 281 std::string directory_bot_jid_;
282 282
283 // Callbacks to notify in response to |it2me_impl_| events. 283 // Callbacks to notify in response to |it2me_host_| events.
284 ScopedRefNPObject on_nat_traversal_policy_changed_func_; 284 ScopedRefNPObject on_nat_traversal_policy_changed_func_;
285 ScopedRefNPObject on_state_changed_func_; 285 ScopedRefNPObject on_state_changed_func_;
286 286
287 ////////////////////////////////////////////////////////// 287 //////////////////////////////////////////////////////////
288 // Me2Me host state. 288 // Me2Me host state.
289 289
290 // Platform-specific installation & configuration implementation. 290 // Platform-specific installation & configuration implementation.
291 scoped_refptr<DaemonController> daemon_controller_; 291 scoped_refptr<DaemonController> daemon_controller_;
292 292
293 // TODO(sergeyu): Replace this thread with 293 // TODO(sergeyu): Replace this thread with
(...skipping 10 matching lines...) Expand all
304 // Used to cancel pending tasks for this object when it is destroyed. 304 // Used to cancel pending tasks for this object when it is destroyed.
305 base::WeakPtr<HostNPScriptObject> weak_ptr_; 305 base::WeakPtr<HostNPScriptObject> weak_ptr_;
306 base::WeakPtrFactory<HostNPScriptObject> weak_factory_; 306 base::WeakPtrFactory<HostNPScriptObject> weak_factory_;
307 307
308 DISALLOW_COPY_AND_ASSIGN(HostNPScriptObject); 308 DISALLOW_COPY_AND_ASSIGN(HostNPScriptObject);
309 }; 309 };
310 310
311 } // namespace remoting 311 } // namespace remoting
312 312
313 #endif // REMOTING_HOST_PLUGIN_HOST_SCRIPT_OBJECT_H_ 313 #endif // REMOTING_HOST_PLUGIN_HOST_SCRIPT_OBJECT_H_
OLDNEW
« no previous file with comments | « remoting/host/native_messaging/native_messaging_writer_unittest.cc ('k') | remoting/host/plugin/host_script_object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698