summaryrefslogtreecommitdiffstats
path: root/remoting
diff options
context:
space:
mode:
authorwez@chromium.org <wez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-20 17:56:49 +0000
committerwez@chromium.org <wez@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-20 17:56:49 +0000
commit5bc5c15301e555c7d22b27d2b30c56b6ca1770ac (patch)
tree3224de17fcacd84b3e723922b9911d1f73a33c50 /remoting
parente50540ec88e9a2102a028336335fc8eb4ee026ee (diff)
downloadchromium_src-5bc5c15301e555c7d22b27d2b30c56b6ca1770ac.zip
chromium_src-5bc5c15301e555c7d22b27d2b30c56b6ca1770ac.tar.gz
chromium_src-5bc5c15301e555c7d22b27d2b30c56b6ca1770ac.tar.bz2
Remove RemoteAccessClientFirewallTraversal policy and code paths.
BUG=96318 TEST= Review URL: http://codereview.chromium.org/8275012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@106521 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting')
-rw-r--r--remoting/client/plugin/chromoting_instance.cc106
-rw-r--r--remoting/client/plugin/chromoting_instance.h19
2 files changed, 1 insertions, 124 deletions
diff --git a/remoting/client/plugin/chromoting_instance.cc b/remoting/client/plugin/chromoting_instance.cc
index 7eb70a9..eec8b39 100644
--- a/remoting/client/plugin/chromoting_instance.cc
+++ b/remoting/client/plugin/chromoting_instance.cc
@@ -8,7 +8,6 @@
#include <vector>
#include "base/bind.h"
-#include "base/json/json_reader.h"
#include "base/logging.h"
#include "base/message_loop.h"
#include "base/stringprintf.h"
@@ -16,9 +15,7 @@
#include "base/synchronization/waitable_event.h"
#include "base/task.h"
#include "base/threading/thread.h"
-#include "base/values.h"
#include "media/base/media.h"
-#include "ppapi/c/dev/ppb_query_policy_dev.h"
#include "ppapi/cpp/completion_callback.h"
#include "ppapi/cpp/input_event.h"
#include "ppapi/cpp/rect.h"
@@ -39,17 +36,6 @@
namespace remoting {
-namespace {
-
-const char kClientFirewallTraversalPolicyName[] =
- "remote_access.client_firewall_traversal";
-
-} // namespace
-
-PPP_PolicyUpdate_Dev ChromotingInstance::kPolicyUpdatedInterface = {
- &ChromotingInstance::PolicyUpdatedThunk,
-};
-
// This flag blocks LOGs to the UI if we're already in the middle of logging
// to the UI. This prevents a potential infinite loop if we encounter an error
// while sending the log message to the UI.
@@ -68,8 +54,6 @@ ChromotingInstance::ChromotingInstance(PP_Instance pp_instance)
new PluginMessageLoopProxy(&plugin_thread_delegate_)),
context_(plugin_message_loop_),
scale_to_fit_(false),
- enable_client_nat_traversal_(false),
- initial_policy_received_(false),
thread_proxy_(new ScopedThreadProxy(plugin_message_loop_)) {
RequestInputEvents(PP_INPUTEVENT_CLASS_MOUSE | PP_INPUTEVENT_CLASS_WHEEL);
RequestFilteringInputEvents(PP_INPUTEVENT_CLASS_KEYBOARD);
@@ -129,8 +113,6 @@ bool ChromotingInstance::Init(uint32_t argc,
// Start all the threads.
context_.Start();
- SubscribeToNatTraversalPolicy();
-
// Create the chromoting objects that don't depend on the network connection.
view_.reset(new PepperView(this, &context_));
view_proxy_ = new PepperViewProxy(this, view_.get(), plugin_message_loop_);
@@ -146,20 +128,8 @@ bool ChromotingInstance::Init(uint32_t argc,
void ChromotingInstance::Connect(const ClientConfig& config) {
DCHECK(plugin_message_loop_->BelongsToCurrentThread());
- // This can only happen at initialization if the Javascript connect call
- // occurs before the enterprise policy is read. We are guaranteed that the
- // enterprise policy is pushed at least once, we we delay the connect call.
- if (!initial_policy_received_) {
- VLOG(1) << "Delaying connect until initial policy is read.";
- // base::Unretained() is safe here because |delayed_connect_| is
- // used only with |thread_proxy_|.
- delayed_connect_ = base::Bind(&ChromotingInstance::Connect,
- base::Unretained(this), config);
- return;
- }
-
host_connection_.reset(new protocol::ConnectionToHost(
- context_.network_message_loop(), this, enable_client_nat_traversal_));
+ context_.network_message_loop(), this, true));
input_handler_.reset(new PepperInputHandler(&context_,
host_connection_.get(),
@@ -456,78 +426,4 @@ void ChromotingInstance::ReleaseAllKeys() {
input_handler_->ReleaseAllKeys();
}
-// static
-void ChromotingInstance::PolicyUpdatedThunk(PP_Instance pp_instance,
- PP_Var pp_policy_json) {
- ChromotingInstance* instance = static_cast<ChromotingInstance*>(
- pp::Module::Get()->InstanceForPPInstance(pp_instance));
- std::string policy_json =
- pp::Var(pp::Var::DontManage(), pp_policy_json).AsString();
- instance->HandlePolicyUpdate(policy_json);
-}
-
-void ChromotingInstance::SubscribeToNatTraversalPolicy() {
- pp::Module::Get()->AddPluginInterface(PPP_POLICYUPDATE_DEV_INTERFACE,
- &kPolicyUpdatedInterface);
- const PPB_QueryPolicy_Dev* query_policy_interface =
- static_cast<PPB_QueryPolicy_Dev const*>(
- pp::Module::Get()->GetBrowserInterface(
- PPB_QUERYPOLICY_DEV_INTERFACE));
- query_policy_interface->SubscribeToPolicyUpdates(pp_instance());
-}
-
-bool ChromotingInstance::IsNatTraversalAllowed(
- const std::string& policy_json) {
- int error_code = base::JSONReader::JSON_NO_ERROR;
- std::string error_message;
- scoped_ptr<base::Value> policy(base::JSONReader::ReadAndReturnError(
- policy_json, true, &error_code, &error_message));
-
- if (!policy.get()) {
- LOG(ERROR) << "Error " << error_code << " parsing policy: "
- << error_message << ".";
- return false;
- }
-
- if (!policy->IsType(base::Value::TYPE_DICTIONARY)) {
- LOG(ERROR) << "Policy must be a dictionary";
- return false;
- }
-
- base::DictionaryValue* dictionary =
- static_cast<base::DictionaryValue*>(policy.get());
- bool traversal_policy = false;
- if (!dictionary->GetBoolean(kClientFirewallTraversalPolicyName,
- &traversal_policy)) {
- // Disable NAT traversal on any failure of reading the policy.
- return false;
- }
-
- return traversal_policy;
-}
-
-void ChromotingInstance::HandlePolicyUpdate(const std::string policy_json) {
- DCHECK(plugin_message_loop_->BelongsToCurrentThread());
- bool traversal_policy = IsNatTraversalAllowed(policy_json);
-
- // If the policy changes from traversal allowed, to traversal denied, we
- // need to immediately drop all connections and redo the conneciton
- // preparation.
- if (traversal_policy == false &&
- traversal_policy != enable_client_nat_traversal_) {
- if (client_.get()) {
- // This will delete the client and network related objects.
- Disconnect();
- }
- }
-
- initial_policy_received_ = true;
- enable_client_nat_traversal_ = traversal_policy;
-
- if (!delayed_connect_.is_null()) {
- thread_proxy_->PostTask(FROM_HERE, delayed_connect_);
- delayed_connect_.Reset();
- }
-}
-
} // namespace remoting
diff --git a/remoting/client/plugin/chromoting_instance.h b/remoting/client/plugin/chromoting_instance.h
index d17f371..fd3d386 100644
--- a/remoting/client/plugin/chromoting_instance.h
+++ b/remoting/client/plugin/chromoting_instance.h
@@ -12,11 +12,9 @@
#include "base/gtest_prod_util.h"
#include "base/memory/scoped_ptr.h"
-#include "ppapi/c/dev/ppp_policy_update_dev.h"
#include "ppapi/c/pp_instance.h"
#include "ppapi/c/pp_rect.h"
#include "ppapi/c/pp_resource.h"
-#include "ppapi/c/pp_var.h"
#include "ppapi/cpp/var.h"
#include "ppapi/cpp/private/instance_private.h"
#include "remoting/base/scoped_thread_proxy.h"
@@ -119,13 +117,6 @@ class ChromotingInstance : public pp::InstancePrivate {
private:
FRIEND_TEST_ALL_PREFIXES(ChromotingInstanceTest, TestCaseSetup);
- static PPP_PolicyUpdate_Dev kPolicyUpdatedInterface;
- static void PolicyUpdatedThunk(PP_Instance pp_instance,
- PP_Var pp_policy_json);
- void SubscribeToNatTraversalPolicy();
- bool IsNatTraversalAllowed(const std::string& policy_json);
- void HandlePolicyUpdate(const std::string policy_json);
-
void ProcessLogToUI(const std::string& message);
bool initialized_;
@@ -161,17 +152,7 @@ class ChromotingInstance : public pp::InstancePrivate {
// This wraps a ChromotingScriptableObject in a pp::Var.
pp::Var instance_object_;
- // Controls if this instance of the plugin should attempt to bridge
- // firewalls.
- bool enable_client_nat_traversal_;
-
- // True when the initial policy is received. Used to avoid taking
- // action before the browser has informed the plugin about its policy
- // settings.
- bool initial_policy_received_;
-
scoped_ptr<ScopedThreadProxy> thread_proxy_;
- base::Closure delayed_connect_;
DISALLOW_COPY_AND_ASSIGN(ChromotingInstance);
};