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

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

Issue 7262015: Conenct Chromoting plugin debug log to JS UI. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge Created 9 years, 5 months 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
« no previous file with comments | « remoting/host/plugin/host_plugin_logger.cc ('k') | remoting/host/plugin/host_script_object.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #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/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "base/synchronization/cancellation_flag.h" 14 #include "base/synchronization/cancellation_flag.h"
15 #include "base/synchronization/waitable_event.h" 15 #include "base/synchronization/waitable_event.h"
16 #include "base/threading/platform_thread.h" 16 #include "base/threading/platform_thread.h"
17 #include "remoting/host/chromoting_host_context.h" 17 #include "remoting/host/chromoting_host_context.h"
18 #include "remoting/host/host_status_observer.h" 18 #include "remoting/host/host_status_observer.h"
19 #include "remoting/host/plugin/host_plugin_logger.h"
19 #include "third_party/npapi/bindings/npapi.h" 20 #include "third_party/npapi/bindings/npapi.h"
20 #include "third_party/npapi/bindings/npfunctions.h" 21 #include "third_party/npapi/bindings/npfunctions.h"
21 #include "third_party/npapi/bindings/npruntime.h" 22 #include "third_party/npapi/bindings/npruntime.h"
22 23
23 class Task; 24 class Task;
24 25
25 namespace tracked_objects { 26 namespace tracked_objects {
26 class Location; 27 class Location;
27 } // namespace tracked_objects 28 } // namespace tracked_objects
28 29
(...skipping 23 matching lines...) Expand all
52 bool Invoke(const std::string& method_name, 53 bool Invoke(const std::string& method_name,
53 const NPVariant* args, 54 const NPVariant* args,
54 uint32_t argCount, 55 uint32_t argCount,
55 NPVariant* result); 56 NPVariant* result);
56 bool HasProperty(const std::string& property_name); 57 bool HasProperty(const std::string& property_name);
57 bool GetProperty(const std::string& property_name, NPVariant* result); 58 bool GetProperty(const std::string& property_name, NPVariant* result);
58 bool SetProperty(const std::string& property_name, const NPVariant* value); 59 bool SetProperty(const std::string& property_name, const NPVariant* value);
59 bool RemoveProperty(const std::string& property_name); 60 bool RemoveProperty(const std::string& property_name);
60 bool Enumerate(std::vector<std::string>* values); 61 bool Enumerate(std::vector<std::string>* values);
61 62
63 // Call LogDebugInfo handler if there is one.
64 void LogDebugInfo(const std::string& message);
65
62 // remoting::HostStatusObserver implementation. 66 // remoting::HostStatusObserver implementation.
63 virtual void OnSignallingConnected(remoting::SignalStrategy* signal_strategy, 67 virtual void OnSignallingConnected(remoting::SignalStrategy* signal_strategy,
64 const std::string& full_jid) OVERRIDE; 68 const std::string& full_jid) OVERRIDE;
65 virtual void OnSignallingDisconnected() OVERRIDE; 69 virtual void OnSignallingDisconnected() OVERRIDE;
66 virtual void OnAccessDenied() OVERRIDE; 70 virtual void OnAccessDenied() OVERRIDE;
67 virtual void OnAuthenticatedClientsChanged(int clients_connected) OVERRIDE; 71 virtual void OnAuthenticatedClientsChanged(int clients_connected) OVERRIDE;
68 virtual void OnShutdown() OVERRIDE; 72 virtual void OnShutdown() OVERRIDE;
69 73
70 private: 74 private:
71 enum State { 75 enum State {
72 kDisconnected, 76 kDisconnected,
73 kRequestedAccessCode, 77 kRequestedAccessCode,
74 kReceivedAccessCode, 78 kReceivedAccessCode,
75 kConnected, 79 kConnected,
76 kAffirmingConnection, 80 kAffirmingConnection,
77 kError 81 kError
78 }; 82 };
79 83
80 // Start connection. args are: 84 // Start connection. args are:
81 // string uid, string auth_token 85 // string uid, string auth_token
82 // No result. 86 // No result.
83 bool Connect(const NPVariant* args, uint32_t argCount, NPVariant* result); 87 bool Connect(const NPVariant* args, uint32_t argCount, NPVariant* result);
84 88
85 // Disconnect. No arguments or result. 89 // Disconnect. No arguments or result.
86 bool Disconnect(const NPVariant* args, uint32_t argCount, NPVariant* result); 90 bool Disconnect(const NPVariant* args, uint32_t argCount, NPVariant* result);
87 91
88 // Call LogDebugInfo handler if there is one.
89 void LogDebugInfo(const std::string& message);
90
91 // Call OnStateChanged handler if there is one. 92 // Call OnStateChanged handler if there is one.
92 void OnStateChanged(State state); 93 void OnStateChanged(State state);
93 94
94 // Callbacks invoked during session setup. 95 // Callbacks invoked during session setup.
95 void OnReceivedSupportID(remoting::SupportAccessVerifier* access_verifier, 96 void OnReceivedSupportID(remoting::SupportAccessVerifier* access_verifier,
96 bool success, 97 bool success,
97 const std::string& support_id); 98 const std::string& support_id);
98 99
99 // Helper functions that run on main thread. Can be called on any 100 // Helper functions that run on main thread. Can be called on any
100 // other thread. 101 // other thread.
(...skipping 22 matching lines...) Expand all
123 void SetException(const std::string& exception_string); 124 void SetException(const std::string& exception_string);
124 125
125 NPP plugin_; 126 NPP plugin_;
126 NPObject* parent_; 127 NPObject* parent_;
127 int state_; 128 int state_;
128 std::string access_code_; 129 std::string access_code_;
129 NPObject* log_debug_info_func_; 130 NPObject* log_debug_info_func_;
130 NPObject* on_state_changed_func_; 131 NPObject* on_state_changed_func_;
131 base::PlatformThreadId np_thread_id_; 132 base::PlatformThreadId np_thread_id_;
132 133
134 scoped_ptr<HostPluginLogger> logger_;
135
133 scoped_ptr<RegisterSupportHostRequest> register_request_; 136 scoped_ptr<RegisterSupportHostRequest> register_request_;
134 scoped_refptr<ChromotingHost> host_; 137 scoped_refptr<ChromotingHost> host_;
135 scoped_refptr<MutableHostConfig> host_config_; 138 scoped_refptr<MutableHostConfig> host_config_;
136 ChromotingHostContext host_context_; 139 ChromotingHostContext host_context_;
137 int failed_login_attempts_; 140 int failed_login_attempts_;
138 141
139 base::WaitableEvent disconnected_event_; 142 base::WaitableEvent disconnected_event_;
140 base::CancellationFlag destructing_; 143 base::CancellationFlag destructing_;
141 }; 144 };
142 145
143 } // namespace remoting 146 } // namespace remoting
144 147
145 DISABLE_RUNNABLE_METHOD_REFCOUNT(remoting::HostNPScriptObject); 148 DISABLE_RUNNABLE_METHOD_REFCOUNT(remoting::HostNPScriptObject);
146 149
147 #endif // REMOTING_HOST_HOST_SCRIPT_OBJECT_H_ 150 #endif // REMOTING_HOST_HOST_SCRIPT_OBJECT_H_
OLDNEW
« no previous file with comments | « remoting/host/plugin/host_plugin_logger.cc ('k') | remoting/host/plugin/host_script_object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698