| 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 // TODO(ajwong): We need to come up with a better description of the | 5 // TODO(ajwong): We need to come up with a better description of the |
| 6 // responsibilities for each thread. | 6 // responsibilities for each thread. |
| 7 | 7 |
| 8 #ifndef REMOTING_CLIENT_PLUGIN_CHROMOTING_INSTANCE_H_ | 8 #ifndef REMOTING_CLIENT_PLUGIN_CHROMOTING_INSTANCE_H_ |
| 9 #define REMOTING_CLIENT_PLUGIN_CHROMOTING_INSTANCE_H_ | 9 #define REMOTING_CLIENT_PLUGIN_CHROMOTING_INSTANCE_H_ |
| 10 | 10 |
| 11 #include <string> | 11 #include <string> |
| 12 | 12 |
| 13 #include "base/gtest_prod_util.h" | 13 #include "base/gtest_prod_util.h" |
| 14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "ppapi/c/dev/ppp_policy_update_dev.h" | |
| 16 #include "ppapi/c/pp_instance.h" | 15 #include "ppapi/c/pp_instance.h" |
| 17 #include "ppapi/c/pp_rect.h" | 16 #include "ppapi/c/pp_rect.h" |
| 18 #include "ppapi/c/pp_resource.h" | 17 #include "ppapi/c/pp_resource.h" |
| 19 #include "ppapi/c/pp_var.h" | |
| 20 #include "ppapi/cpp/var.h" | 18 #include "ppapi/cpp/var.h" |
| 21 #include "ppapi/cpp/private/instance_private.h" | 19 #include "ppapi/cpp/private/instance_private.h" |
| 22 #include "remoting/base/scoped_thread_proxy.h" | 20 #include "remoting/base/scoped_thread_proxy.h" |
| 23 #include "remoting/client/client_context.h" | 21 #include "remoting/client/client_context.h" |
| 24 #include "remoting/client/plugin/chromoting_scriptable_object.h" | 22 #include "remoting/client/plugin/chromoting_scriptable_object.h" |
| 25 #include "remoting/client/plugin/pepper_plugin_thread_delegate.h" | 23 #include "remoting/client/plugin/pepper_plugin_thread_delegate.h" |
| 26 #include "remoting/protocol/connection_to_host.h" | 24 #include "remoting/protocol/connection_to_host.h" |
| 27 | 25 |
| 28 namespace base { | 26 namespace base { |
| 29 class Thread; | 27 class Thread; |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 void UnregisterLoggingInstance(); | 110 void UnregisterLoggingInstance(); |
| 113 | 111 |
| 114 // A Log Message Handler that is called after each LOG message has been | 112 // A Log Message Handler that is called after each LOG message has been |
| 115 // processed. This must be of type LogMessageHandlerFunction defined in | 113 // processed. This must be of type LogMessageHandlerFunction defined in |
| 116 // base/logging.h. | 114 // base/logging.h. |
| 117 static bool LogToUI(int severity, const char* file, int line, | 115 static bool LogToUI(int severity, const char* file, int line, |
| 118 size_t message_start, const std::string& str); | 116 size_t message_start, const std::string& str); |
| 119 private: | 117 private: |
| 120 FRIEND_TEST_ALL_PREFIXES(ChromotingInstanceTest, TestCaseSetup); | 118 FRIEND_TEST_ALL_PREFIXES(ChromotingInstanceTest, TestCaseSetup); |
| 121 | 119 |
| 122 static PPP_PolicyUpdate_Dev kPolicyUpdatedInterface; | |
| 123 static void PolicyUpdatedThunk(PP_Instance pp_instance, | |
| 124 PP_Var pp_policy_json); | |
| 125 void SubscribeToNatTraversalPolicy(); | |
| 126 bool IsNatTraversalAllowed(const std::string& policy_json); | |
| 127 void HandlePolicyUpdate(const std::string policy_json); | |
| 128 | |
| 129 void ProcessLogToUI(const std::string& message); | 120 void ProcessLogToUI(const std::string& message); |
| 130 | 121 |
| 131 bool initialized_; | 122 bool initialized_; |
| 132 | 123 |
| 133 PepperPluginThreadDelegate plugin_thread_delegate_; | 124 PepperPluginThreadDelegate plugin_thread_delegate_; |
| 134 scoped_refptr<PluginMessageLoopProxy> plugin_message_loop_; | 125 scoped_refptr<PluginMessageLoopProxy> plugin_message_loop_; |
| 135 ClientContext context_; | 126 ClientContext context_; |
| 136 scoped_ptr<protocol::ConnectionToHost> host_connection_; | 127 scoped_ptr<protocol::ConnectionToHost> host_connection_; |
| 137 scoped_ptr<PepperView> view_; | 128 scoped_ptr<PepperView> view_; |
| 138 | 129 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 154 // XmppProxy is a refcounted interface used to perform thread-switching and | 145 // XmppProxy is a refcounted interface used to perform thread-switching and |
| 155 // detaching between objects whose lifetimes are controlled by pepper, and | 146 // detaching between objects whose lifetimes are controlled by pepper, and |
| 156 // jingle_glue objects. This is used when if we start a sandboxed jingle | 147 // jingle_glue objects. This is used when if we start a sandboxed jingle |
| 157 // connection. | 148 // connection. |
| 158 scoped_refptr<PepperXmppProxy> xmpp_proxy_; | 149 scoped_refptr<PepperXmppProxy> xmpp_proxy_; |
| 159 | 150 |
| 160 // JavaScript interface to control this instance. | 151 // JavaScript interface to control this instance. |
| 161 // This wraps a ChromotingScriptableObject in a pp::Var. | 152 // This wraps a ChromotingScriptableObject in a pp::Var. |
| 162 pp::Var instance_object_; | 153 pp::Var instance_object_; |
| 163 | 154 |
| 164 // Controls if this instance of the plugin should attempt to bridge | |
| 165 // firewalls. | |
| 166 bool enable_client_nat_traversal_; | |
| 167 | |
| 168 // True when the initial policy is received. Used to avoid taking | |
| 169 // action before the browser has informed the plugin about its policy | |
| 170 // settings. | |
| 171 bool initial_policy_received_; | |
| 172 | |
| 173 scoped_ptr<ScopedThreadProxy> thread_proxy_; | 155 scoped_ptr<ScopedThreadProxy> thread_proxy_; |
| 174 base::Closure delayed_connect_; | |
| 175 | 156 |
| 176 DISALLOW_COPY_AND_ASSIGN(ChromotingInstance); | 157 DISALLOW_COPY_AND_ASSIGN(ChromotingInstance); |
| 177 }; | 158 }; |
| 178 | 159 |
| 179 } // namespace remoting | 160 } // namespace remoting |
| 180 | 161 |
| 181 #endif // REMOTING_CLIENT_PLUGIN_CHROMOTING_INSTANCE_H_ | 162 #endif // REMOTING_CLIENT_PLUGIN_CHROMOTING_INSTANCE_H_ |
| OLD | NEW |