Skip to content

Commit

Permalink
Remove old Authentication code that we don't use or need.
Browse files Browse the repository at this point in the history
Also removed some auth-related protobufs that we don't currenly use.

BUG=None
TEST=IT2Me still works.


Review URL: http://codereview.chromium.org/8351084

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@108759 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
sergeyu@chromium.org committed Nov 5, 2011
1 parent e37a725 commit 5a5fdc0
Show file tree
Hide file tree
Showing 36 changed files with 80 additions and 479 deletions.
26 changes: 2 additions & 24 deletions remoting/client/chromoting_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,8 @@ void ChromotingClient::OnConnectionState(
protocol::ConnectionToHost::Error error) {
DCHECK(message_loop()->BelongsToCurrentThread());
VLOG(1) << "ChromotingClient::OnConnectionState(" << state << ")";
if (state == protocol::ConnectionToHost::CONNECTED)
if (state == protocol::ConnectionToHost::CONNECTED ||
state == protocol::ConnectionToHost::AUTHENTICATED)
Initialize();
view_->SetConnectionState(state, error);
}
Expand Down Expand Up @@ -203,27 +204,4 @@ void ChromotingClient::Initialize() {
input_handler_->Initialize();
}

////////////////////////////////////////////////////////////////////////////
// ClientStub control channel interface.
void ChromotingClient::BeginSessionResponse(
const protocol::LocalLoginStatus* msg, const base::Closure& done) {
if (!message_loop()->BelongsToCurrentThread()) {
thread_proxy_.PostTask(FROM_HERE, base::Bind(
&ChromotingClient::BeginSessionResponse, base::Unretained(this),
msg, done));
return;
}

VLOG(1) << "BeginSessionResponse received";

// Inform the connection that the client has been authenticated. This will
// enable the communication channels.
if (msg->success()) {
connection_->OnClientAuthenticated();
}

view_->UpdateLoginStatus(msg->success(), msg->error_info());
done.Run();
}

} // namespace remoting
4 changes: 0 additions & 4 deletions remoting/client/chromoting_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,6 @@ class ChromotingClient : public protocol::ConnectionToHost::HostEventCallback,
protocol::ConnectionToHost::State state,
protocol::ConnectionToHost::Error error) OVERRIDE;

// ClientStub implementation.
virtual void BeginSessionResponse(const protocol::LocalLoginStatus* msg,
const base::Closure& done) OVERRIDE;

// VideoStub implementation.
virtual void ProcessVideoPacket(const VideoPacket* packet,
const base::Closure& done) OVERRIDE;
Expand Down
5 changes: 0 additions & 5 deletions remoting/client/chromoting_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,6 @@ class ChromotingView {
virtual void SetConnectionState(protocol::ConnectionToHost::State state,
protocol::ConnectionToHost::Error error) = 0;

// Update the status of the last login attempt. Updating the UI as needed.
// |success| is set to true if the last login successful otherwise false.
// |info| contains the error information if available.
virtual void UpdateLoginStatus(bool success, const std::string& info) = 0;

// Return the horizontal scale factor of this view.
virtual double GetHorizontalScaleRatio() const = 0;

Expand Down
19 changes: 0 additions & 19 deletions remoting/client/plugin/chromoting_instance.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
#include "remoting/client/plugin/pepper_view_proxy.h"
#include "remoting/client/plugin/pepper_xmpp_proxy.h"
#include "remoting/client/rectangle_update_decoder.h"
#include "remoting/proto/auth.pb.h"
#include "remoting/protocol/connection_to_host.h"
#include "remoting/protocol/host_stub.h"

Expand Down Expand Up @@ -278,24 +277,6 @@ ChromotingScriptableObject* ChromotingInstance::GetScriptableObject() {
return NULL;
}

void ChromotingInstance::SubmitLoginInfo(const std::string& username,
const std::string& password) {
if (host_connection_->state() != protocol::ConnectionToHost::CONNECTED) {
LOG(INFO) << "Client not connected or already authenticated.";
return;
}

protocol::LocalLoginCredentials* credentials =
new protocol::LocalLoginCredentials();
credentials->set_type(protocol::PASSWORD);
credentials->set_username(username);
credentials->set_credential(password.data(), password.length());

host_connection_->host_stub()->BeginSessionRequest(
credentials,
base::Bind(&DeletePointer<protocol::LocalLoginCredentials>, credentials));
}

void ChromotingInstance::SetScaleToFit(bool scale_to_fit) {
DCHECK(plugin_message_loop_->BelongsToCurrentThread());

Expand Down
4 changes: 0 additions & 4 deletions remoting/client/plugin/chromoting_instance.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,6 @@ class ChromotingInstance : public pp::InstancePrivate {
void Connect(const ClientConfig& config);
void Disconnect();

// Called by ChromotingScriptableObject to provide username and password.
void SubmitLoginInfo(const std::string& username,
const std::string& password);

// Called by ChromotingScriptableObject to set scale-to-fit.
void SetScaleToFit(bool scale_to_fit);

Expand Down
48 changes: 1 addition & 47 deletions remoting/client/plugin/chromoting_scriptable_object.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ const char kDebugInfo[] = "debugInfo";
const char kDesktopHeight[] = "desktopHeight";
const char kDesktopWidth[] = "desktopWidth";
const char kDesktopSizeUpdate[] = "desktopSizeUpdate";
const char kLoginChallenge[] = "loginChallenge";
const char kSendIq[] = "sendIq";
const char kStatusAttribute[] = "status";
const char kErrorAttribute[] = "error";
Expand Down Expand Up @@ -89,7 +88,6 @@ void ChromotingScriptableObject::Init() {
AddAttribute(kConnectionInfoUpdate, Var());
AddAttribute(kDebugInfo, Var());
AddAttribute(kDesktopSizeUpdate, Var());
AddAttribute(kLoginChallenge, Var());
AddAttribute(kSendIq, Var());
AddAttribute(kDesktopWidth, Var(0));
AddAttribute(kDesktopHeight, Var(0));
Expand All @@ -105,7 +103,6 @@ void ChromotingScriptableObject::Init() {

AddMethod("connect", &ChromotingScriptableObject::DoConnect);
AddMethod("disconnect", &ChromotingScriptableObject::DoDisconnect);
AddMethod("submitLoginInfo", &ChromotingScriptableObject::DoSubmitLogin);
AddMethod("setScaleToFit", &ChromotingScriptableObject::DoSetScaleToFit);
AddMethod("onIq", &ChromotingScriptableObject::DoOnIq);
AddMethod("releaseAllKeys", &ChromotingScriptableObject::DoReleaseAllKeys);
Expand Down Expand Up @@ -200,13 +197,11 @@ void ChromotingScriptableObject::SetProperty(const Var& name,
return;
}

// Allow writing to connectionInfoUpdate or loginChallenge. See top of
// chromoting_scriptable_object.h for the object interface definition.
// Not all properties are mutable.
std::string property_name = name.AsString();
if (property_name != kConnectionInfoUpdate &&
property_name != kDebugInfo &&
property_name != kDesktopSizeUpdate &&
property_name != kLoginChallenge &&
property_name != kSendIq &&
property_name != kDesktopWidth &&
property_name != kDesktopHeight) {
Expand Down Expand Up @@ -282,12 +277,6 @@ void ChromotingScriptableObject::SetDesktopSize(int width, int height) {
VLOG(1) << "Update desktop size to: " << width << " x " << height;
}

void ChromotingScriptableObject::SignalLoginChallenge() {
plugin_message_loop_->PostTask(
FROM_HERE, task_factory_.NewRunnableMethod(
&ChromotingScriptableObject::DoSignalLoginChallenge));
}

void ChromotingScriptableObject::AttachXmppProxy(PepperXmppProxy* xmpp_proxy) {
xmpp_proxy_ = xmpp_proxy;
}
Expand Down Expand Up @@ -346,17 +335,6 @@ void ChromotingScriptableObject::DoSignalDesktopSizeChange() {
}
}

void ChromotingScriptableObject::DoSignalLoginChallenge() {
Var exception;
VarPrivate cb = GetProperty(Var(kLoginChallenge), &exception);

// |this| must not be touched after Call() returns.
cb.Call(Var(), &exception);

if (!exception.is_undefined())
LOG(ERROR) << "Exception when invoking loginChallenge JS callback.";
}

void ChromotingScriptableObject::DoSendIq(const std::string& message_xml) {
Var exception;
VarPrivate cb = GetProperty(Var(kSendIq), &exception);
Expand Down Expand Up @@ -428,30 +406,6 @@ Var ChromotingScriptableObject::DoDisconnect(const std::vector<Var>& args,
return Var();
}

Var ChromotingScriptableObject::DoSubmitLogin(const std::vector<Var>& args,
Var* exception) {
if (args.size() != 2) {
*exception = Var("Usage: login(username, password)");
return Var();
}

if (!args[0].is_string()) {
*exception = Var("Username must be a string.");
return Var();
}
std::string username = args[0].AsString();

if (!args[1].is_string()) {
*exception = Var("Password must be a string.");
return Var();
}
std::string password = args[1].AsString();

VLOG(1) << "Submitting login info to host.";
instance_->SubmitLoginInfo(username, password);
return Var();
}

Var ChromotingScriptableObject::DoSetScaleToFit(const std::vector<Var>& args,
Var* exception) {
if (args.size() != 1) {
Expand Down
21 changes: 0 additions & 21 deletions remoting/client/plugin/chromoting_scriptable_object.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,6 @@
//
// attribute Function desktopSizeUpdate;
//
// // This function is called when login information for the host machine is
// // needed.
// //
// // User of this object should respond with calling submitLoginInfo() when
// // username and password is available.
// //
// // This function will be called multiple times until login was successful
// // or the maximum number of login attempts has been reached. In the
// // later case |connection_status| is changed to STATUS_FAILED.
// attribute Function loginChallenge;
//
// // JS callback function to send an XMPP IQ stanza for performing the
// // signaling in a jingle connection. The callback function should be
// // of type void(string request_xml).
Expand Down Expand Up @@ -97,9 +86,6 @@
// // Terminating a Chromoting connection.
// void disconnect();
//
// // Method for submitting login information.
// void submitLoginInfo(string username, string password);
//
// // Method for setting scale-to-fit.
// void setScaleToFit(bool scale_to_fit);
//
Expand Down Expand Up @@ -177,9 +163,6 @@ class ChromotingScriptableObject
void LogDebugInfo(const std::string& info);
void SetDesktopSize(int width, int height);

// This should be called to signal JS code to provide login information.
void SignalLoginChallenge();

// Attaches the XmppProxy used for issuing and receivng IQ stanzas for
// initializing a jingle connection from within the sandbox.
void AttachXmppProxy(PepperXmppProxy* xmpp_proxy);
Expand Down Expand Up @@ -224,15 +207,11 @@ class ChromotingScriptableObject
// JavaScript event handlers may destroy the plugin.
void DoSignalConnectionInfoChange();
void DoSignalDesktopSizeChange();
void DoSignalLoginChallenge();
void DoSendIq(const std::string& message_xml);

pp::Var DoConnect(const std::vector<pp::Var>& args, pp::Var* exception);
pp::Var DoDisconnect(const std::vector<pp::Var>& args, pp::Var* exception);

// This method is called by JS to provide login information.
pp::Var DoSubmitLogin(const std::vector<pp::Var>& args, pp::Var* exception);

// This method is called by JS to set scale-to-fit.
pp::Var DoSetScaleToFit(const std::vector<pp::Var>& args, pp::Var* exception);

Expand Down
18 changes: 3 additions & 15 deletions remoting/client/plugin/pepper_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -237,11 +237,13 @@ void PepperView::SetConnectionState(protocol::ConnectionToHost::State state,
break;

case protocol::ConnectionToHost::CONNECTED:
scriptable_obj->SignalLoginChallenge();
break;

case protocol::ConnectionToHost::AUTHENTICATED:
UnsetSolidFill();
scriptable_obj->SetConnectionStatus(
ChromotingScriptableObject::STATUS_CONNECTED,
ConvertConnectionError(error));
break;

case protocol::ConnectionToHost::CLOSED:
Expand All @@ -260,20 +262,6 @@ void PepperView::SetConnectionState(protocol::ConnectionToHost::State state,
}
}

void PepperView::UpdateLoginStatus(bool success, const std::string& info) {
DCHECK(context_->main_message_loop()->BelongsToCurrentThread());

// TODO(hclam): Re-consider the way we communicate with Javascript.
ChromotingScriptableObject* scriptable_obj = instance_->GetScriptableObject();
if (success) {
scriptable_obj->SetConnectionStatus(
ChromotingScriptableObject::STATUS_CONNECTED,
ChromotingScriptableObject::ERROR_NONE);
} else {
scriptable_obj->SignalLoginChallenge();
}
}

bool PepperView::SetPluginSize(const SkISize& plugin_size) {
if (plugin_size_ == plugin_size)
return false;
Expand Down
2 changes: 0 additions & 2 deletions remoting/client/plugin/pepper_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ class PepperView : public ChromotingView,
virtual void SetConnectionState(
protocol::ConnectionToHost::State state,
protocol::ConnectionToHost::Error error) OVERRIDE;
virtual void UpdateLoginStatus(bool success,
const std::string& info) OVERRIDE;
virtual double GetHorizontalScaleRatio() const OVERRIDE;
virtual double GetVerticalScaleRatio() const OVERRIDE;

Expand Down
11 changes: 0 additions & 11 deletions remoting/client/plugin/pepper_view_proxy.cc
Original file line number Diff line number Diff line change
Expand Up @@ -84,17 +84,6 @@ void PepperViewProxy::SetConnectionState(
view_->SetConnectionState(state, error);
}

void PepperViewProxy::UpdateLoginStatus(bool success, const std::string& info) {
if (instance_ && !plugin_message_loop_->BelongsToCurrentThread()) {
plugin_message_loop_->PostTask(FROM_HERE, NewRunnableMethod(
this, &PepperViewProxy::UpdateLoginStatus, success, info));
return;
}

if (view_)
view_->UpdateLoginStatus(success, info);
}

double PepperViewProxy::GetHorizontalScaleRatio() const {
// This method returns a value, so must run synchronously, so must be
// called only on the pepper thread.
Expand Down
2 changes: 0 additions & 2 deletions remoting/client/plugin/pepper_view_proxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ class PepperViewProxy : public base::RefCountedThreadSafe<PepperViewProxy>,
virtual void SetConnectionState(
protocol::ConnectionToHost::State state,
protocol::ConnectionToHost::Error error) OVERRIDE;
virtual void UpdateLoginStatus(bool success, const std::string& info)
OVERRIDE;

// This method returns a value, so must run synchronously, so must be
// called only on the pepper thread.
Expand Down
Loading

0 comments on commit 5a5fdc0

Please sign in to comment.