Index: components/proximity_auth/messenger_impl.cc |
diff --git a/components/proximity_auth/messenger_impl.cc b/components/proximity_auth/messenger_impl.cc |
index aab4adee94b075eb0c7d274a2d639fb1fa854058..13bfac7a4e36a1f1b707508fdd62690d4d7c3ed7 100644 |
--- a/components/proximity_auth/messenger_impl.cc |
+++ b/components/proximity_auth/messenger_impl.cc |
@@ -7,8 +7,6 @@ |
#include "base/bind.h" |
#include "base/json/json_reader.h" |
#include "base/json/json_writer.h" |
-#include "base/location.h" |
-#include "base/thread_task_runner_handle.h" |
#include "base/values.h" |
#include "components/proximity_auth/connection.h" |
#include "components/proximity_auth/cryptauth/base64url.h" |
@@ -38,15 +36,6 @@ |
// The name for an unlock event originating from the local device. |
const char kUnlockEventName[] = "easy_unlock"; |
-// Messages sent and received from the iOS app when polling for it's lock screen |
-// status. |
-// TODO(tengs): Unify the iOS status update protocol with the existing Android |
-// protocol, so we don't have this special case. |
-const char kPollScreenState[] = "PollScreenState"; |
-const char kScreenUnlocked[] = "Screen Unlocked"; |
-const char kScreenLocked[] = "Screen Locked"; |
-const int kIOSPollingIntervalSeconds = 5; |
- |
// Serializes the |value| to a JSON string and returns the result. |
std::string SerializeValueToJson(const base::Value& value) { |
std::string json; |
@@ -72,11 +61,6 @@ |
weak_ptr_factory_(this) { |
DCHECK(connection_->IsConnected()); |
connection_->AddObserver(this); |
- |
- // TODO(tengs): We need CryptAuth to report if the phone runs iOS or Android, |
- // rather than relying on this heuristic. |
- if (connection_->remote_device().bluetooth_type == RemoteDevice::BLUETOOTH_LE) |
- PollScreenStateForIOS(); |
} |
MessengerImpl::~MessengerImpl() { |
@@ -259,20 +243,6 @@ |
FOR_EACH_OBSERVER(MessengerObserver, observers_, OnUnlockResponse(true)); |
} |
-void MessengerImpl::PollScreenStateForIOS() { |
- if (!connection_->IsConnected()) |
- return; |
- |
- // Sends message requesting screen state. |
- connection_->SendMessage(make_scoped_ptr(new WireMessage(kPollScreenState))); |
- |
- // Schedules the next message in |kPollingIntervalSeconds|. |
- base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
- FROM_HERE, base::Bind(&MessengerImpl::PollScreenStateForIOS, |
- weak_ptr_factory_.GetWeakPtr()), |
- base::TimeDelta::FromSeconds(kIOSPollingIntervalSeconds)); |
-} |
- |
void MessengerImpl::OnConnectionStatusChanged(Connection* connection, |
Connection::Status old_status, |
Connection::Status new_status) { |
@@ -280,6 +250,7 @@ |
if (new_status == Connection::DISCONNECTED) { |
PA_LOG(INFO) << "Secure channel disconnected..."; |
connection_->RemoveObserver(this); |
+ connection_.reset(); |
FOR_EACH_OBSERVER(MessengerObserver, observers_, OnDisconnected()); |
// TODO(isherman): Determine whether it's also necessary/appropriate to fire |
// this notification from the destructor. |
@@ -288,20 +259,6 @@ |
void MessengerImpl::OnMessageReceived(const Connection& connection, |
const WireMessage& wire_message) { |
- // TODO(tengs): Unify the iOS status update protocol with the existing Android |
- // protocol, so we don't have this special case. |
- std::string payload = wire_message.payload(); |
- if (payload == kScreenUnlocked || payload == kScreenLocked) { |
- RemoteStatusUpdate update; |
- update.user_presence = |
- (payload == kScreenUnlocked ? USER_PRESENT : USER_ABSENT); |
- update.secure_screen_lock_state = SECURE_SCREEN_LOCK_ENABLED; |
- update.trust_agent_state = TRUST_AGENT_ENABLED; |
- FOR_EACH_OBSERVER(MessengerObserver, observers_, |
- OnRemoteStatusUpdate(update)); |
- return; |
- } |
- |
secure_context_->Decode(wire_message.payload(), |
base::Bind(&MessengerImpl::OnMessageDecoded, |
weak_ptr_factory_.GetWeakPtr())); |