Skip to content

Commit

Permalink
Add experimental flag to start the Smart Lock over BLE support.
Browse files Browse the repository at this point in the history
This CL adds the experimental flag "Enable Smart Lock
Bluetooth Low Energy Discovery.". When enabled, the EasyUnlock
service will start the proximity auth BLE system wich will
be in charge of discovering Bluetooth Low Energy devices
and unlocking the Chromebook.

BUG=479654

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

Cr-Commit-Position: refs/heads/master@{#326292}
  • Loading branch information
msarda authored and Commit bot committed Apr 22, 2015
1 parent 6273d88 commit 4c408ff
Show file tree
Hide file tree
Showing 13 changed files with 109 additions and 2 deletions.
10 changes: 8 additions & 2 deletions chrome/app/generated_resources.grd
Original file line number Diff line number Diff line change
Expand Up @@ -6787,6 +6787,12 @@ Keep your key file in a safe place. You will need it to create new versions of y
<message name="IDS_FLAGS_ENABLE_TAB_AUDIO_MUTING_DESCRIPTION" desc="Description of the flag that enables the tab audio muting UI experiment in chrome://extensions.">
When enabled, the audio indicators in the tab strip double as tab audio mute controls. This also adds commands in the tab context menu for quickly muting multiple selected tabs.
</message>
<message name="IDS_FLAGS_ENABLE_EASY_UNLOCK_BLUETOOTH_LOW_ENERGY_DISCOVERY_NAME" desc="Title for the flag to enable Smart Lock to discover phones over Bluetooth Low Energy in order to unlock the Chromebook.">
Enable Smart Lock Bluetooth Low Energy Discovery.
</message>
<message name="IDS_FLAGS_ENABLE_EASY_UNLOCK_BLUETOOTH_LOW_ENERGY_DISCOVERY_DESCRIPTION" desc="Description for the flag to enable Smart Lock to discover phones over Bluetooth Low Energy in order to unlock the Chromebook.">
Enables a Smart Lock setting that allows Chromebook to discover phones over Bleutooth Low Energy in order to unlock the Chromebook when the phone is in its proximity.
</message>
<message name="IDS_FLAGS_ENABLE_EASY_UNLOCK_PROXIMITY_DETECTION_NAME" desc="Title for the flag to enable Smart Lock to require close proximity between the phone and the Chromebook in order to unlock the Chromebook.">
Enable Smart Lock proximity detection.
</message>
Expand Down Expand Up @@ -9199,9 +9205,9 @@ I don't think this site should be blocked!
from accessing the network.
</message>
<message name="IDS_ERRORPAGES_SUMMARY_ICANN_NAME_COLLISION" desc="Summary in the error page when a dns look up fails due to having contained 127.0.53.53.">
This site is using a
This site is using a
<ph name="BEGIN_LINK">&lt;a href="https://support.google.com/chrome/?p=top_level_domain&amp;hl=[GRITLANGCODE]"&gt;</ph>new generic top-level domain<ph name="END_LINK">&lt;/a&gt;<ex>&lt;/a&gt;</ex></ph>
(gTLD). If you have used
(gTLD). If you have used
<ph name="HOST_NAME">&lt;strong jscontent="hostName"&gt;&lt;/strong&gt;<ex>www.whatever.com</ex></ph>
to access an internal site in the past, contact your network
administrator.
Expand Down
1 change: 1 addition & 0 deletions chrome/browser/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,7 @@ source_set("browser") {
"//chrome/browser/sync_file_system/drive_backend:sync_file_system_drive_proto",
"//chrome/common/extensions/api",
"//chrome/common/extensions/api:api_registration",
"//components/proximity_auth/ble",
"//components/proximity_auth/cryptauth",
"//extensions/components/javascript_dialog_extensions_client",
"//media/cast:net",
Expand Down
8 changes: 8 additions & 0 deletions chrome/browser/about_flags.cc
Original file line number Diff line number Diff line change
Expand Up @@ -955,6 +955,14 @@ const Experiment kExperiments[] = {
kOsCrOS,
SINGLE_VALUE_TYPE(proximity_auth::switches::kEnableProximityDetection)
},
{
"enable-easy-unlock-bluetooth-low-energy-detection",
IDS_FLAGS_ENABLE_EASY_UNLOCK_BLUETOOTH_LOW_ENERGY_DISCOVERY_NAME,
IDS_FLAGS_ENABLE_EASY_UNLOCK_BLUETOOTH_LOW_ENERGY_DISCOVERY_DESCRIPTION,
kOsCrOS,
SINGLE_VALUE_TYPE(
proximity_auth::switches::kEnableBluetoothLowEnergyDiscovery)
},
#endif
#if defined(USE_ASH)
{
Expand Down
9 changes: 9 additions & 0 deletions chrome/browser/signin/easy_unlock_service.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "chrome/common/extensions/extension_constants.h"
#include "chrome/common/pref_names.h"
#include "components/pref_registry/pref_registry_syncable.h"
#include "components/proximity_auth/ble/proximity_auth_ble_system.h"
#include "components/proximity_auth/switches.h"
#include "components/user_manager/user.h"
#include "device/bluetooth/bluetooth_adapter.h"
Expand Down Expand Up @@ -646,6 +647,13 @@ void EasyUnlockService::UpdateAppState() {
app_manager_->LoadApp();
NotifyUserUpdated();

if (base::CommandLine::ForCurrentProcess()->HasSwitch(
proximity_auth::switches::kEnableBluetoothLowEnergyDiscovery) &&
!proximity_auth_ble_system_) {
proximity_auth_ble_system_.reset(
new proximity_auth::ProximityAuthBleSystem());
}

#if defined(OS_CHROMEOS)
if (!power_monitor_)
power_monitor_.reset(new PowerMonitor(this));
Expand All @@ -664,6 +672,7 @@ void EasyUnlockService::UpdateAppState() {
if (!bluetooth_waking_up) {
app_manager_->DisableAppIfLoaded();
ResetScreenlockState();
proximity_auth_ble_system_.reset();
#if defined(OS_CHROMEOS)
power_monitor_.reset();
#endif
Expand Down
9 changes: 9 additions & 0 deletions chrome/browser/signin/easy_unlock_service.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ namespace user_prefs {
class PrefRegistrySyncable;
}

namespace proximity_auth {
class ProximityAuthBleSystem;
}

class EasyUnlockAppManager;
class EasyUnlockServiceObserver;
class Profile;
Expand Down Expand Up @@ -329,6 +333,11 @@ class EasyUnlockService : public KeyedService {

scoped_ptr<BluetoothDetector> bluetooth_detector_;

// The proximity auth over Bluetooth Low Energy system. This is main entry
// point to bootstap Smart Lock to discover phones over Bluetooth Low
// Energy.
scoped_ptr<proximity_auth::ProximityAuthBleSystem> proximity_auth_ble_system_;

#if defined(OS_CHROMEOS)
// Monitors suspend and wake state of ChromeOS.
class PowerMonitor;
Expand Down
2 changes: 2 additions & 0 deletions components/proximity_auth.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
"proximity_auth/bluetooth_util.cc",
"proximity_auth/bluetooth_util.h",
"proximity_auth/bluetooth_util_chromeos.cc",
"proximity_auth/ble/proximity_auth_ble_system.cc",
"proximity_auth/ble/proximity_auth_ble_system.h",
"proximity_auth/client.cc",
"proximity_auth/client.h",
"proximity_auth/client_observer.h",
Expand Down
17 changes: 17 additions & 0 deletions components/proximity_auth/ble/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# 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.

source_set("ble") {
sources = [
"proximity_auth_ble_system.cc",
"proximity_auth_ble_system.h",
]

deps = [
"//base",
"//components/proximity_auth",
"//device/bluetooth",
"//net",
]
}
2 changes: 2 additions & 0 deletions components/proximity_auth/ble/OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
msarda@chromium.org
sacomoto@chromium.org
19 changes: 19 additions & 0 deletions components/proximity_auth/ble/proximity_auth_ble_system.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright 2015 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/ble/proximity_auth_ble_system.h"

#include "base/logging.h"

namespace proximity_auth {

ProximityAuthBleSystem::ProximityAuthBleSystem() {
VLOG(1) << "Starting Proximity Auth over Bluetooth Low Energy.";
}

ProximityAuthBleSystem::~ProximityAuthBleSystem() {
VLOG(1) << "Stopping Proximity over Bluetooth Low Energy.";
}

} // namespace proximity_auth
27 changes: 27 additions & 0 deletions components/proximity_auth/ble/proximity_auth_ble_system.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Copyright 2015 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_BLE_PROXIMITY_AUTH_BLE_SYSTEM_H_
#define COMPONENTS_PROXIMITY_AUTH_BLE_PROXIMITY_AUTH_BLE_SYSTEM_H_

#include "base/macros.h"

namespace proximity_auth {

// This is the main entry point to start Proximity Auth over Bluetooth Low
// Energy. This is the underlying system for the Smart Lock features. It will
// discover Bluetooth Low Energy phones and unlock the lock screen if the phone
// passes an authorization and authentication protocol.
class ProximityAuthBleSystem {
public:
ProximityAuthBleSystem();
~ProximityAuthBleSystem();

private:
DISALLOW_COPY_AND_ASSIGN(ProximityAuthBleSystem);
};

} // namespace proximity_auth

#endif // COMPONENTS_PROXIMITY_AUTH_BLE_PROXIMITY_AUTH_BLE_SYSTEM_H_
4 changes: 4 additions & 0 deletions components/proximity_auth/switches.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ const char kCryptAuthHTTPHost[] = "cryptauth-http-host";
// Disable Easy unlock.
const char kDisableEasyUnlock[] = "disable-easy-unlock";

// Enables discovery of the phone over Bluetooth Low Energy.
const char kEnableBluetoothLowEnergyDiscovery[] =
"enable-proximity-auth-bluetooth-low-energy-discovery";

// Enables close proximity detection. This allows the user to set a setting to
// require very close proximity between the remote device and the local device
// in order to unlock the local device, which trades off convenience for
Expand Down
1 change: 1 addition & 0 deletions components/proximity_auth/switches.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ namespace switches {
// alongside the definition of their values in the .cc file.
extern const char kCryptAuthHTTPHost[];
extern const char kDisableEasyUnlock[];
extern const char kEnableBluetoothLowEnergyDiscovery[];
extern const char kEnableProximityDetection[];
extern const char kForceLoadEasyUnlockAppInTests[];

Expand Down
2 changes: 2 additions & 0 deletions tools/metrics/histograms/histograms.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55171,6 +55171,8 @@ To add a new entry, add it with any value and run test to compute valid value.
<int value="625273056" label="disable-boot-animation"/>
<int value="630947363" label="touch-events"/>
<int value="643725031" label="disable-touch-feedback"/>
<int value="683410401"
label="enable-proximity-auth-bluetooth-low-energy-discovery"/>
<int value="689489984" label="disable-zero-suggest"/>
<int value="709850261" label="disable-touch-editing"/>
<int value="711424932" label="enable-cloud-print-xps"/>
Expand Down

0 comments on commit 4c408ff

Please sign in to comment.