Commit a72d9769 authored by tengs's avatar tengs Committed by Commit bot

Introduce proximity_auth component.

This component handles the protocol between Chrome and an associated phone for
the Easy Unlock and Easy Sign-in features.

The system is currently implemented as a Chrome packaged app, and this is the
first step in migrating this functionality to native code. We will gradually
reimplement the system and switch from the app to this component once the
refactoring is complete.

BUG=385719

Review URL: https://codereview.chromium.org/505373004

Cr-Commit-Position: refs/heads/master@{#292704}
parent 81db36ae
......@@ -67,6 +67,7 @@ group("all_components") {
"//components/precache/core",
"//components/precache/content",
"//components/pref_registry",
"//components/proximity_auth",
"//components/query_parser",
"//components/rappor",
"//components/renderer_context_menu",
......@@ -214,6 +215,7 @@ test("components_unittests") {
"//components/domain_reliability:unit_tests",
"//components/omnibox:unit_tests",
"//components/ownership:unit_tests",
"//components/proximity_auth:unit_tests",
]
# TODO(GYP) need this target.
......
......@@ -138,6 +138,11 @@ per-file policy*=atwilson@chromium.org
per-file policy*=pneubeck@chromium.org
per-file policy*=dconnelly@chromium.org
per-file proximity_auth*=isherman@chromium.org
per-file proximity_auth*=tbarzic@chromium.org
per-file proximity_auth*=tengs@chromium.org
per-file proximity_auth*=xiyuan@chromium.org
per-file query_parser.gypi=brettw@chromium.org
per-file query_parser.gypi=sky@chromium.org
......
......@@ -44,6 +44,7 @@
'policy.gypi',
'precache.gypi',
'pref_registry.gypi',
'proximity_auth.gypi',
'query_parser.gypi',
'rappor.gypi',
'search.gypi',
......
......@@ -171,6 +171,7 @@
'precache/core/precache_database_unittest.cc',
'precache/core/precache_fetcher_unittest.cc',
'precache/core/precache_url_table_unittest.cc',
'proximity_auth/proximity_auth_system_unittest.cc',
'query_parser/query_parser_unittest.cc',
'query_parser/snippet_unittest.cc',
'rappor/bloom_filter_unittest.cc',
......@@ -371,6 +372,9 @@
'components.gyp:password_manager_core_browser',
'components.gyp:password_manager_core_browser_test_support',
# Dependencies of proxmity_auth
'components.gyp:proximity_auth',
# Dependencies of precache/core
'components.gyp:password_manager_core_browser',
'components.gyp:precache_core',
......
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'targets': [
{
'target_name': 'proximity_auth',
'type': 'static_library',
'include_dirs': [
'..',
],
'dependencies': [
'../base/base.gyp:base',
],
'sources': [
"proximity_auth/proximity_auth_system.cc",
"proximity_auth/proximity_auth_system.h",
"proximity_auth/remote_device.h",
],
},
],
}
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
static_library("proximity_auth") {
sources = [
"proximity_auth_system.cc",
"proximity_auth_system.h",
"remote_device.h",
]
deps = [
"//base",
]
}
source_set("unit_tests") {
sources = [
"proximity_auth_system_unittest.cc",
]
deps = [
":proximity_auth",
"//base/test:test_support",
"//testing/gtest",
]
}
isherman@chromium.org
tbarzic@chromium.org
tengs@chromium.org
xiyuan@chromium.org
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "components/proximity_auth/proximity_auth_system.h"
namespace proximity_auth {
ProximityAuthSystem::ProximityAuthSystem(
const std::vector<RemoteDevice>& remote_devices)
: remote_devices_(remote_devices) {
}
ProximityAuthSystem::~ProximityAuthSystem() {
}
const std::vector<RemoteDevice>& ProximityAuthSystem::GetRemoteDevices() {
return remote_devices_;
}
} // proximity_auth
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef COMPONENTS_PROXIMITY_AUTH_PROXIMITY_AUTH_SYSTEM_H
#define COMPONENTS_PROXIMITY_AUTH_PROXIMITY_AUTH_SYSTEM_H
#include "base/macros.h"
#include "components/proximity_auth/remote_device.h"
namespace proximity_auth {
// This is the main entry point to start Proximity Auth, the underlying system
// for the Easy Unlock and Easy Sign-in features. Given a list of registered
// remote devices (i.e. phones), this object will handle the connection,
// authentication, and protocol for all the devices.
class ProximityAuthSystem {
public:
ProximityAuthSystem(const std::vector<RemoteDevice>& remote_devices);
virtual ~ProximityAuthSystem();
const std::vector<RemoteDevice>& GetRemoteDevices();
private:
std::vector<RemoteDevice> remote_devices_;
DISALLOW_COPY_AND_ASSIGN(ProximityAuthSystem);
};
} // namespace proximity_auth
#endif // COMPONENTS_PROXIMITY_AUTH_PROXIMITY_AUTH_SYSTEM_H
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "components/proximity_auth/proximity_auth_system.h"
#include "components/proximity_auth/remote_device.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace proximity_auth {
TEST(ProximityAuthSystemTest, GetRemoteDevices) {
RemoteDevice device1 = { "device 1" };
RemoteDevice device2 = { "device 2" };
std::vector<RemoteDevice> device_list;
device_list.push_back(device1);
device_list.push_back(device2);
ProximityAuthSystem system(device_list);
const std::vector<RemoteDevice>& returned_list = system.GetRemoteDevices();
ASSERT_EQ(2u, returned_list.size());
EXPECT_EQ(device1.name, returned_list[0].name);
EXPECT_EQ(device2.name, returned_list[1].name);
}
} // namespace proximity_auth
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef COMPONENTS_PROXIMITY_AUTH_REMOTE_DEVICE_H
#define COMPONENTS_PROXIMITY_AUTH_REMOTE_DEVICE_H
#include <string>
#include <vector>
namespace proximity_auth {
struct RemoteDevice {
std::string name;
};
} // namespace proximity_auth
#endif // COMPONENTS_PROXIMITY_AUTH_REMOTE_DEVICE_H
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment