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

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

Issue 7648042: Change Chromoting logger to be setup in plugin's NP_Initialize. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updated patch set Created 9 years, 3 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
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
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 virtual void OnSignallingConnected(remoting::SignalStrategy* signal_strategy, 73 virtual void OnSignallingConnected(remoting::SignalStrategy* signal_strategy,
74 const std::string& full_jid) OVERRIDE; 74 const std::string& full_jid) OVERRIDE;
75 virtual void OnSignallingDisconnected() OVERRIDE; 75 virtual void OnSignallingDisconnected() OVERRIDE;
76 virtual void OnAccessDenied() OVERRIDE; 76 virtual void OnAccessDenied() OVERRIDE;
77 virtual void OnClientAuthenticated( 77 virtual void OnClientAuthenticated(
78 remoting::protocol::ConnectionToClient* client) OVERRIDE; 78 remoting::protocol::ConnectionToClient* client) OVERRIDE;
79 virtual void OnClientDisconnected( 79 virtual void OnClientDisconnected(
80 remoting::protocol::ConnectionToClient* client) OVERRIDE; 80 remoting::protocol::ConnectionToClient* client) OVERRIDE;
81 virtual void OnShutdown() OVERRIDE; 81 virtual void OnShutdown() OVERRIDE;
82 82
83 // A Log Message Handler that is called after each LOG message has been 83 // Post LogDebugInfo to the correct proxy (and thus, on the correct thread).
84 // processed. This must be of type LogMessageHandlerFunction defined in 84 // This should only be called by HostLogHandler. To log to the UI, use the
85 // base/logging.h. 85 // standard LOG(INFO) and it will be sent to this method.
86 static bool LogToUI(int severity, const char* file, int line, 86 void PostLogDebugInfo(const std::string& message);
87 size_t message_start, const std::string& str);
88 87
89 private: 88 private:
90 enum State { 89 enum State {
91 kDisconnected, 90 kDisconnected,
92 kRequestedAccessCode, 91 kRequestedAccessCode,
93 kReceivedAccessCode, 92 kReceivedAccessCode,
94 kConnected, 93 kConnected,
95 kAffirmingConnection, 94 kAffirmingConnection,
96 kError 95 kError
97 }; 96 };
98 97
99 // Start connection. args are: 98 // Start connection. args are:
100 // string uid, string auth_token 99 // string uid, string auth_token
101 // No result. 100 // No result.
102 bool Connect(const NPVariant* args, uint32_t argCount, NPVariant* result); 101 bool Connect(const NPVariant* args, uint32_t argCount, NPVariant* result);
103 102
104 // Disconnect. No arguments or result. 103 // Disconnect. No arguments or result.
105 bool Disconnect(const NPVariant* args, uint32_t argCount, NPVariant* result); 104 bool Disconnect(const NPVariant* args, uint32_t argCount, NPVariant* result);
106 105
107 // Localize strings. args are: 106 // Localize strings. args are:
108 // localize_func - a callback function which returns a localized string for 107 // localize_func - a callback function which returns a localized string for
109 // a given tag name. 108 // a given tag name.
110 // No result. 109 // No result.
111 bool Localize(const NPVariant* args, uint32_t argCount, NPVariant* result); 110 bool Localize(const NPVariant* args, uint32_t argCount, NPVariant* result);
112 111
113 // Call OnStateChanged handler if there is one. 112 // Call OnStateChanged handler if there is one.
114 void OnStateChanged(State state); 113 void OnStateChanged(State state);
115 114
116 // Call LogDebugInfo handler if there is one. 115 // Call LogDebugInfo handler if there is one.
116 // This must be called on the correct thread.
117 void LogDebugInfo(const std::string& message); 117 void LogDebugInfo(const std::string& message);
118 118
119 // Callbacks invoked during session setup. 119 // Callbacks invoked during session setup.
120 void OnReceivedSupportID(remoting::SupportAccessVerifier* access_verifier, 120 void OnReceivedSupportID(remoting::SupportAccessVerifier* access_verifier,
121 bool success, 121 bool success,
122 const std::string& support_id, 122 const std::string& support_id,
123 const base::TimeDelta& lifetime); 123 const base::TimeDelta& lifetime);
124 124
125 // Helper functions that run on main thread. Can be called on any 125 // Helper functions that run on main thread. Can be called on any
126 // other thread. 126 // other thread.
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 scoped_ptr<DesktopEnvironment> desktop_environment_; 173 scoped_ptr<DesktopEnvironment> desktop_environment_;
174 174
175 scoped_refptr<ChromotingHost> host_; 175 scoped_refptr<ChromotingHost> host_;
176 int failed_login_attempts_; 176 int failed_login_attempts_;
177 177
178 UiStrings ui_strings_; 178 UiStrings ui_strings_;
179 base::Lock ui_strings_lock_; 179 base::Lock ui_strings_lock_;
180 180
181 base::WaitableEvent disconnected_event_; 181 base::WaitableEvent disconnected_event_;
182 182
183 // True if we're in the middle of handling a log message.
184 bool currently_logging_;
Wez 2011/09/01 01:21:23 nit: Should technically be am_currently_logging_?
garykac 2011/09/01 01:30:55 Done.
185
183 scoped_ptr<policy_hack::NatPolicy> nat_policy_; 186 scoped_ptr<policy_hack::NatPolicy> nat_policy_;
184 187
185 // Host the current nat traversal policy setting. 188 // Host the current nat traversal policy setting.
186 bool nat_traversal_enabled_; 189 bool nat_traversal_enabled_;
187 190
188 // Indiciates whether or not a policy has ever been read. This is to ensure 191 // Indiciates whether or not a policy has ever been read. This is to ensure
189 // that on startup, we do not accidentally start a connection before we have 192 // that on startup, we do not accidentally start a connection before we have
190 // queried our policy restrictions. 193 // queried our policy restrictions.
191 bool policy_received_; 194 bool policy_received_;
192 195
193 // On startup, it is possible to have Connect() called before the policy read 196 // On startup, it is possible to have Connect() called before the policy read
194 // is completed. Rather than just failing, we thunk the connection call so 197 // is completed. Rather than just failing, we thunk the connection call so
195 // it can be executed after at least one successful policy read. This 198 // it can be executed after at least one successful policy read. This
196 // variable contains the thunk if it is necessary. 199 // variable contains the thunk if it is necessary.
197 base::Closure pending_connect_; 200 base::Closure pending_connect_;
198 }; 201 };
199 202
200 } // namespace remoting 203 } // namespace remoting
201 204
202 DISABLE_RUNNABLE_METHOD_REFCOUNT(remoting::HostNPScriptObject); 205 DISABLE_RUNNABLE_METHOD_REFCOUNT(remoting::HostNPScriptObject);
203 206
204 #endif // REMOTING_HOST_HOST_SCRIPT_OBJECT_H_ 207 #endif // REMOTING_HOST_PLUGIN_HOST_SCRIPT_OBJECT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698