Commit 8dc3862f authored by Thomas Anderson's avatar Thomas Anderson Committed by Commit Bot

Revert "components/proximity_auth: Make this component CrOS-only."

This reverts commit 375c6457.

Reason for revert: Breaks Google Chrome Linux x64:
https://ci.chromium.org/buildbot/chromium.chrome/Google%20Chrome%20Linux%20x64/28713

Original change's description:
> components/proximity_auth: Make this component CrOS-only.
> 
> This is true in practice.
> 
> R=​khorimoto@chromium.org, sky@chromium.org
> 
> Bug: none
> Test: none
> Change-Id: I14ec85e9b4c34bc0ee94ebae2ca9b9d782c8e5f4
> Reviewed-on: https://chromium-review.googlesource.com/962863
> Reviewed-by: Scott Violet <sky@chromium.org>
> Reviewed-by: Kyle Horimoto <khorimoto@chromium.org>
> Commit-Queue: James Hawkins <jhawkins@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#543214}

TBR=jhawkins@chromium.org,sky@chromium.org,khorimoto@chromium.org

Change-Id: Ie10b48da189c3a80900bac3693ed345c5df92258
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: none
Reviewed-on: https://chromium-review.googlesource.com/963584Reviewed-by: default avatarThomas Anderson <thomasanderson@chromium.org>
Commit-Queue: Thomas Anderson <thomasanderson@chromium.org>
Cr-Commit-Position: refs/heads/master@{#543217}
parent 9deedbdf
...@@ -374,7 +374,6 @@ group("gn_all") { ...@@ -374,7 +374,6 @@ group("gn_all") {
"//chromeos:chromeos_unittests", "//chromeos:chromeos_unittests",
"//chromeos/components:chromeos_components_unittests", "//chromeos/components:chromeos_components_unittests",
"//chromeos/services:chromeos_services_unittests", "//chromeos/services:chromeos_services_unittests",
"//components/proximity_auth:proximity_auth_unittests",
"//components/session_manager/core", "//components/session_manager/core",
"//ui/app_list:app_list_demo", "//ui/app_list:app_list_demo",
"//ui/app_list:app_list_unittests", "//ui/app_list:app_list_unittests",
...@@ -626,6 +625,10 @@ group("gn_all") { ...@@ -626,6 +625,10 @@ group("gn_all") {
deps += [ "//content/browser/bluetooth/tools:bluetooth_metrics_hash" ] deps += [ "//content/browser/bluetooth/tools:bluetooth_metrics_hash" ]
} }
if (!is_android && !is_ios && !is_chromeos && !is_fuchsia) {
deps += [ "//components/proximity_auth:proximity_auth_unittests" ]
}
if (is_win || is_linux) { if (is_win || is_linux) {
deps += [ deps += [
"//mash:all", "//mash:all",
......
...@@ -833,6 +833,8 @@ static_library("extensions") { ...@@ -833,6 +833,8 @@ static_library("extensions") {
"//components/policy:generated", "//components/policy:generated",
"//components/policy/core/browser", "//components/policy/core/browser",
"//components/pref_registry", "//components/pref_registry",
"//components/proximity_auth",
"//components/proximity_auth/logging",
"//components/proxy_config", "//components/proxy_config",
"//components/rappor", "//components/rappor",
"//components/resources", "//components/resources",
...@@ -990,8 +992,6 @@ static_library("extensions") { ...@@ -990,8 +992,6 @@ static_library("extensions") {
"//components/chrome_apps", "//components/chrome_apps",
"//components/constrained_window", "//components/constrained_window",
"//components/drive", "//components/drive",
"//components/proximity_auth",
"//components/proximity_auth/logging",
"//components/user_manager", "//components/user_manager",
"//remoting/base", "//remoting/base",
"//remoting/host", "//remoting/host",
......
...@@ -1000,6 +1000,7 @@ split_static_library("ui") { ...@@ -1000,6 +1000,7 @@ split_static_library("ui") {
"//components/pref_registry", "//components/pref_registry",
"//components/previews/content", "//components/previews/content",
"//components/previews/core", "//components/previews/core",
"//components/proximity_auth",
"//components/proxy_config", "//components/proxy_config",
"//components/query_parser", "//components/query_parser",
"//components/rappor", "//components/rappor",
...@@ -1737,6 +1738,7 @@ split_static_library("ui") { ...@@ -1737,6 +1738,7 @@ split_static_library("ui") {
"//components/feedback/proto", "//components/feedback/proto",
"//components/keep_alive_registry", "//components/keep_alive_registry",
"//components/network_session_configurator/common", "//components/network_session_configurator/common",
"//components/proximity_auth/webui",
"//components/ui_metrics", "//components/ui_metrics",
"//components/vector_icons", "//components/vector_icons",
"//components/vector_icons", "//components/vector_icons",
...@@ -2130,9 +2132,7 @@ split_static_library("ui") { ...@@ -2130,9 +2132,7 @@ split_static_library("ui") {
"//components/drive:drive_chromeos", "//components/drive:drive_chromeos",
"//components/exo", "//components/exo",
"//components/login", "//components/login",
"//components/proximity_auth",
"//components/proximity_auth/logging", "//components/proximity_auth/logging",
"//components/proximity_auth/webui",
"//components/session_manager/core", "//components/session_manager/core",
"//components/user_manager", "//components/user_manager",
"//services/data_decoder/public/cpp", "//services/data_decoder/public/cpp",
......
...@@ -295,6 +295,7 @@ test("components_unittests") { ...@@ -295,6 +295,7 @@ test("components_unittests") {
# guest_view is currently non-mobile. # guest_view is currently non-mobile.
"//components/guest_view/browser:unit_tests", "//components/guest_view/browser:unit_tests",
"//components/multidevice:unit_tests", "//components/multidevice:unit_tests",
"//components/proximity_auth:unit_tests",
"//components/storage_monitor:unit_tests", "//components/storage_monitor:unit_tests",
"//components/web_modal:unit_tests", "//components/web_modal:unit_tests",
"//components/zoom:unit_tests", "//components/zoom:unit_tests",
...@@ -310,7 +311,6 @@ test("components_unittests") { ...@@ -310,7 +311,6 @@ test("components_unittests") {
"//components/arc:unit_tests", "//components/arc:unit_tests",
"//components/ownership:unit_tests", "//components/ownership:unit_tests",
"//components/pairing:unit_tests", "//components/pairing:unit_tests",
"//components/proximity_auth:unit_tests",
"//components/sync_wifi:unit_tests", "//components/sync_wifi:unit_tests",
"//components/timers:unit_tests", "//components/timers:unit_tests",
"//components/user_manager:unit_tests", "//components/user_manager:unit_tests",
......
...@@ -4,8 +4,6 @@ ...@@ -4,8 +4,6 @@
import("//testing/test.gni") import("//testing/test.gni")
assert(is_chromeos, "ProximityAuth is Chrome OS only")
static_library("proximity_auth") { static_library("proximity_auth") {
sources = [ sources = [
"bluetooth_connection.cc", "bluetooth_connection.cc",
...@@ -59,7 +57,6 @@ static_library("proximity_auth") { ...@@ -59,7 +57,6 @@ static_library("proximity_auth") {
deps = [ deps = [
"//base", "//base",
"//chromeos",
"//components/cryptauth", "//components/cryptauth",
"//components/cryptauth/ble", "//components/cryptauth/ble",
"//components/pref_registry:pref_registry", "//components/pref_registry:pref_registry",
...@@ -70,6 +67,10 @@ static_library("proximity_auth") { ...@@ -70,6 +67,10 @@ static_library("proximity_auth") {
"//device/bluetooth", "//device/bluetooth",
"//net", "//net",
] ]
if (is_chromeos) {
deps += [ "//chromeos" ]
}
} }
static_library("test_support") { static_library("test_support") {
...@@ -120,7 +121,6 @@ source_set("unit_tests") { ...@@ -120,7 +121,6 @@ source_set("unit_tests") {
":test_support", ":test_support",
"//base", "//base",
"//base/test:test_support", "//base/test:test_support",
"//chromeos",
"//components/cryptauth:test_support", "//components/cryptauth:test_support",
"//components/cryptauth:unit_tests", "//components/cryptauth:unit_tests",
"//components/cryptauth/ble", "//components/cryptauth/ble",
...@@ -132,17 +132,23 @@ source_set("unit_tests") { ...@@ -132,17 +132,23 @@ source_set("unit_tests") {
"//testing/gmock", "//testing/gmock",
"//testing/gtest", "//testing/gtest",
] ]
if (is_chromeos) {
deps += [ "//chromeos" ]
}
} }
# Note: This is a convenience target for ease of rapid iteration during # Note: This is a convenience target for ease of rapid iteration during
# development. It is not executed on any try or build bots. # development. It is not executed on any try or build bots.
test("proximity_auth_unittests") { if (!is_chromeos) {
sources = [ test("proximity_auth_unittests") {
"run_all_unittests.cc", sources = [
] "run_all_unittests.cc",
deps = [ ]
":unit_tests", deps = [
"//base", ":unit_tests",
"//base/test:test_support", "//base",
] "//base/test:test_support",
]
}
} }
...@@ -10,9 +10,12 @@ ...@@ -10,9 +10,12 @@
#include "base/strings/string16.h" #include "base/strings/string16.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "components/proximity_auth/logging/logging.h"
#if defined(OS_CHROMEOS)
#include "chromeos/dbus/dbus_thread_manager.h" #include "chromeos/dbus/dbus_thread_manager.h"
#include "chromeos/dbus/session_manager_client.h" #include "chromeos/dbus/session_manager_client.h"
#include "components/proximity_auth/logging/logging.h" #endif
namespace proximity_auth { namespace proximity_auth {
namespace { namespace {
...@@ -160,9 +163,13 @@ bool ScreenlockBridge::IsLocked() const { ...@@ -160,9 +163,13 @@ bool ScreenlockBridge::IsLocked() const {
} }
void ScreenlockBridge::Lock() { void ScreenlockBridge::Lock() {
#if defined(OS_CHROMEOS)
chromeos::SessionManagerClient* session_manager = chromeos::SessionManagerClient* session_manager =
chromeos::DBusThreadManager::Get()->GetSessionManagerClient(); chromeos::DBusThreadManager::Get()->GetSessionManagerClient();
session_manager->RequestLockScreen(); session_manager->RequestLockScreen();
#else
NOTIMPLEMENTED();
#endif
} }
void ScreenlockBridge::Unlock(const AccountId& account_id) { void ScreenlockBridge::Unlock(const AccountId& account_id) {
......
...@@ -19,11 +19,10 @@ ...@@ -19,11 +19,10 @@
namespace proximity_auth { namespace proximity_auth {
// ScreenlockBridge brings together the screenLockPrivate API and underlying // ScreenlockBridge brings together the screenLockPrivate API and underlying
// support. It delegates calls to the ScreenLocker. // support. On ChromeOS, it delegates calls to the ScreenLocker. On other
// platforms, it delegates calls to UserManagerUI (and friends).
// TODO(tbarzic): Rename ScreenlockBridge to SignInScreenBridge, as this is not // TODO(tbarzic): Rename ScreenlockBridge to SignInScreenBridge, as this is not
// used solely for the lock screen anymore. // used solely for the lock screen anymore.
// TODO(jhawkins): Rationalize this class now that it is CrOS only and most of
// its functionality is not useful.
class ScreenlockBridge { class ScreenlockBridge {
public: public:
// User pod icons supported by lock screen / signin screen UI. // User pod icons supported by lock screen / signin screen UI.
......
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
#include "base/time/default_tick_clock.h" #include "base/time/default_tick_clock.h"
#include "base/time/time.h" #include "base/time/time.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "chromeos/dbus/dbus_thread_manager.h"
#include "components/cryptauth/remote_device.h" #include "components/cryptauth/remote_device.h"
#include "components/cryptauth/secure_context.h" #include "components/cryptauth/secure_context.h"
#include "components/proximity_auth/logging/logging.h" #include "components/proximity_auth/logging/logging.h"
...@@ -24,7 +23,11 @@ ...@@ -24,7 +23,11 @@
#include "components/proximity_auth/proximity_monitor_impl.h" #include "components/proximity_auth/proximity_monitor_impl.h"
#include "device/bluetooth/bluetooth_adapter_factory.h" #include "device/bluetooth/bluetooth_adapter_factory.h"
#if defined(OS_CHROMEOS)
#include "chromeos/dbus/dbus_thread_manager.h"
using chromeos::DBusThreadManager; using chromeos::DBusThreadManager;
#endif // defined(OS_CHROMEOS)
namespace proximity_auth { namespace proximity_auth {
namespace { namespace {
...@@ -100,8 +103,9 @@ UnlockManagerImpl::UnlockManagerImpl( ...@@ -100,8 +103,9 @@ UnlockManagerImpl::UnlockManagerImpl(
screenlock_bridge->AddObserver(this); screenlock_bridge->AddObserver(this);
OnScreenLockedOrUnlocked(screenlock_bridge->IsLocked()); OnScreenLockedOrUnlocked(screenlock_bridge->IsLocked());
#if defined(OS_CHROMEOS)
DBusThreadManager::Get()->GetPowerManagerClient()->AddObserver(this); DBusThreadManager::Get()->GetPowerManagerClient()->AddObserver(this);
#endif // defined(OS_CHROMEOS)
SetWakingUpState(true); SetWakingUpState(true);
if (device::BluetoothAdapterFactory::IsBluetoothSupported()) { if (device::BluetoothAdapterFactory::IsBluetoothSupported()) {
...@@ -117,7 +121,9 @@ UnlockManagerImpl::~UnlockManagerImpl() { ...@@ -117,7 +121,9 @@ UnlockManagerImpl::~UnlockManagerImpl() {
ScreenlockBridge::Get()->RemoveObserver(this); ScreenlockBridge::Get()->RemoveObserver(this);
#if defined(OS_CHROMEOS)
DBusThreadManager::Get()->GetPowerManagerClient()->RemoveObserver(this); DBusThreadManager::Get()->GetPowerManagerClient()->RemoveObserver(this);
#endif // defined(OS_CHROMEOS)
if (bluetooth_adapter_) if (bluetooth_adapter_)
bluetooth_adapter_->RemoveObserver(this); bluetooth_adapter_->RemoveObserver(this);
...@@ -277,9 +283,11 @@ void UnlockManagerImpl::AdapterPoweredChanged(device::BluetoothAdapter* adapter, ...@@ -277,9 +283,11 @@ void UnlockManagerImpl::AdapterPoweredChanged(device::BluetoothAdapter* adapter,
UpdateLockScreen(); UpdateLockScreen();
} }
#if defined(OS_CHROMEOS)
void UnlockManagerImpl::SuspendDone(const base::TimeDelta& sleep_duration) { void UnlockManagerImpl::SuspendDone(const base::TimeDelta& sleep_duration) {
SetWakingUpState(true); SetWakingUpState(true);
} }
#endif // defined(OS_CHROMEOS)
void UnlockManagerImpl::OnAuthAttempted(mojom::AuthType auth_type) { void UnlockManagerImpl::OnAuthAttempted(mojom::AuthType auth_type) {
if (is_attempting_auth_) { if (is_attempting_auth_) {
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
#include "base/memory/ref_counted.h" #include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "chromeos/dbus/power_manager_client.h"
#include "components/proximity_auth/messenger_observer.h" #include "components/proximity_auth/messenger_observer.h"
#include "components/proximity_auth/proximity_auth_system.h" #include "components/proximity_auth/proximity_auth_system.h"
#include "components/proximity_auth/proximity_monitor_observer.h" #include "components/proximity_auth/proximity_monitor_observer.h"
...@@ -20,6 +19,10 @@ ...@@ -20,6 +19,10 @@
#include "components/proximity_auth/unlock_manager.h" #include "components/proximity_auth/unlock_manager.h"
#include "device/bluetooth/bluetooth_adapter.h" #include "device/bluetooth/bluetooth_adapter.h"
#if defined(OS_CHROMEOS)
#include "chromeos/dbus/power_manager_client.h"
#endif
namespace proximity_auth { namespace proximity_auth {
class Messenger; class Messenger;
...@@ -33,7 +36,9 @@ class UnlockManagerImpl : public UnlockManager, ...@@ -33,7 +36,9 @@ class UnlockManagerImpl : public UnlockManager,
public MessengerObserver, public MessengerObserver,
public ProximityMonitorObserver, public ProximityMonitorObserver,
public ScreenlockBridge::Observer, public ScreenlockBridge::Observer,
#if defined(OS_CHROMEOS)
chromeos::PowerManagerClient::Observer, chromeos::PowerManagerClient::Observer,
#endif // defined(OS_CHROMEOS)
public device::BluetoothAdapter::Observer { public device::BluetoothAdapter::Observer {
public: public:
// The |proximity_auth_client| is not owned and should outlive the constructed // The |proximity_auth_client| is not owned and should outlive the constructed
...@@ -95,8 +100,10 @@ class UnlockManagerImpl : public UnlockManager, ...@@ -95,8 +100,10 @@ class UnlockManagerImpl : public UnlockManager,
void AdapterPoweredChanged(device::BluetoothAdapter* adapter, void AdapterPoweredChanged(device::BluetoothAdapter* adapter,
bool powered) override; bool powered) override;
#if defined(OS_CHROMEOS)
// chromeos::PowerManagerClient::Observer: // chromeos::PowerManagerClient::Observer:
void SuspendDone(const base::TimeDelta& sleep_duration) override; void SuspendDone(const base::TimeDelta& sleep_duration) override;
#endif // defined(OS_CHROMEOS)
// Called when auth is attempted to send the sign-in challenge to the remote // Called when auth is attempted to send the sign-in challenge to the remote
// device for decryption. // device for decryption.
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
#include "base/test/test_simple_task_runner.h" #include "base/test/test_simple_task_runner.h"
#include "base/threading/thread_task_runner_handle.h" #include "base/threading/thread_task_runner_handle.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "chromeos/dbus/dbus_thread_manager.h"
#include "components/cryptauth/cryptauth_test_util.h" #include "components/cryptauth/cryptauth_test_util.h"
#include "components/cryptauth/fake_connection.h" #include "components/cryptauth/fake_connection.h"
#include "components/cryptauth/fake_secure_context.h" #include "components/cryptauth/fake_secure_context.h"
...@@ -31,6 +30,10 @@ ...@@ -31,6 +30,10 @@
#include "testing/gmock/include/gmock/gmock.h" #include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#if defined(OS_CHROMEOS)
#include "chromeos/dbus/dbus_thread_manager.h"
#endif // defined(OS_CHROMEOS)
using testing::AtLeast; using testing::AtLeast;
using testing::Invoke; using testing::Invoke;
using testing::NiceMock; using testing::NiceMock;
...@@ -180,7 +183,9 @@ class ProximityAuthUnlockManagerImplTest : public testing::Test { ...@@ -180,7 +183,9 @@ class ProximityAuthUnlockManagerImplTest : public testing::Test {
life_cycle_.set_messenger(&messenger_); life_cycle_.set_messenger(&messenger_);
ScreenlockBridge::Get()->SetLockHandler(&lock_handler_); ScreenlockBridge::Get()->SetLockHandler(&lock_handler_);
#if defined(OS_CHROMEOS)
chromeos::DBusThreadManager::Initialize(); chromeos::DBusThreadManager::Initialize();
#endif
} }
~ProximityAuthUnlockManagerImplTest() override { ~ProximityAuthUnlockManagerImplTest() override {
...@@ -196,7 +201,9 @@ class ProximityAuthUnlockManagerImplTest : public testing::Test { ...@@ -196,7 +201,9 @@ class ProximityAuthUnlockManagerImplTest : public testing::Test {
// destructor references the DBusThreadManager. // destructor references the DBusThreadManager.
unlock_manager_.reset(); unlock_manager_.reset();
#if defined(OS_CHROMEOS)
chromeos::DBusThreadManager::Shutdown(); chromeos::DBusThreadManager::Shutdown();
#endif
ScreenlockBridge::Get()->SetLockHandler(nullptr); ScreenlockBridge::Get()->SetLockHandler(nullptr);
} }
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
assert(is_chromeos, "Proximity Auth is Chrome OS only")
static_library("webui") { static_library("webui") {
sources = [ sources = [
"proximity_auth_ui.cc", "proximity_auth_ui.cc",
......
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