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

Unified Diff: components/proximity_auth/messenger_impl.cc

Issue 1377313002: Revert of Hook up ProximityAuthSystem in EasyUnlockService. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bluetooth_connection
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/proximity_auth/messenger_impl.h ('k') | components/proximity_auth/messenger_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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()));
« no previous file with comments | « components/proximity_auth/messenger_impl.h ('k') | components/proximity_auth/messenger_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698