diff options
author | sacomoto <sacomoto@chromium.org> | 2015-06-26 03:01:52 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-06-26 10:02:17 +0000 |
commit | d7896d23183def152f0334e076622d58c60040b9 (patch) | |
tree | 7fa49954f7888a950d2e33a9c23308bb0351ed87 /components/proximity_auth | |
parent | 9ad56f55bb18f48ecced91751c0d9648c203451a (diff) | |
download | chromium_src-d7896d23183def152f0334e076622d58c60040b9.zip chromium_src-d7896d23183def152f0334e076622d58c60040b9.tar.gz chromium_src-d7896d23183def152f0334e076622d58c60040b9.tar.bz2 |
Using PA_LOG(INFO) instead of VLOG(1).
This CL replaces VLOG(1) with PA_LOG(INFO) in all files in
components/proximity_auth/ble.
BUG=
Review URL: https://codereview.chromium.org/1212433003
Cr-Commit-Position: refs/heads/master@{#336349}
Diffstat (limited to 'components/proximity_auth')
6 files changed, 96 insertions, 86 deletions
diff --git a/components/proximity_auth/ble/bluetooth_low_energy_characteristics_finder.cc b/components/proximity_auth/ble/bluetooth_low_energy_characteristics_finder.cc index d0c2f9b..838ee6e 100644 --- a/components/proximity_auth/ble/bluetooth_low_energy_characteristics_finder.cc +++ b/components/proximity_auth/ble/bluetooth_low_energy_characteristics_finder.cc @@ -4,6 +4,7 @@ #include "components/proximity_auth/ble/bluetooth_low_energy_characteristics_finder.h" +#include "components/proximity_auth/logging/logging.h" #include "device/bluetooth/bluetooth_adapter.h" #include "device/bluetooth/bluetooth_device.h" #include "device/bluetooth/bluetooth_gatt_characteristic.h" @@ -60,7 +61,8 @@ BluetoothLowEnergyCharacteristicsFinder:: void BluetoothLowEnergyCharacteristicsFinder::GattCharacteristicAdded( BluetoothAdapter* adapter, BluetoothGattCharacteristic* characteristic) { - VLOG(1) << "New char found: " << characteristic->GetUUID().canonical_value(); + PA_LOG(INFO) << "New char found: " + << characteristic->GetUUID().canonical_value(); HandleCharacteristicUpdate(characteristic); } @@ -68,8 +70,8 @@ void BluetoothLowEnergyCharacteristicsFinder::GattDiscoveryCompleteForService( BluetoothAdapter* adapter, BluetoothGattService* service) { if (service && service->GetUUID() == remote_service_.uuid) { - VLOG(1) << "All characteristics discovered for " - << remote_service_.uuid.canonical_value(); + PA_LOG(INFO) << "All characteristics discovered for " + << remote_service_.uuid.canonical_value(); if (to_peripheral_char_.id.empty() || from_peripheral_char_.id.empty()) { if (!error_callback_.is_null()) { diff --git a/components/proximity_auth/ble/bluetooth_low_energy_characteristics_finder_unittest.cc b/components/proximity_auth/ble/bluetooth_low_energy_characteristics_finder_unittest.cc index 87952024..090cd2b 100644 --- a/components/proximity_auth/ble/bluetooth_low_energy_characteristics_finder_unittest.cc +++ b/components/proximity_auth/ble/bluetooth_low_energy_characteristics_finder_unittest.cc @@ -106,11 +106,11 @@ class ProximityAuthBluetoothLowEnergyCharacteristicFinderTest service_.get(), id, uuid, true, kCharacteristicProperties, device::BluetoothGattCharacteristic::PERMISSION_NONE)); - EXPECT_CALL(*characteristic.get(), GetUUID()).WillOnce(Return(uuid)); + ON_CALL(*characteristic.get(), GetUUID()).WillByDefault(Return(uuid)); if (valid) - EXPECT_CALL(*characteristic.get(), GetIdentifier()).WillOnce(Return(id)); - EXPECT_CALL(*characteristic.get(), GetService()) - .WillOnce(Return(service_.get())); + ON_CALL(*characteristic.get(), GetIdentifier()).WillByDefault(Return(id)); + ON_CALL(*characteristic.get(), GetService()) + .WillByDefault(Return(service_.get())); return characteristic.Pass(); } diff --git a/components/proximity_auth/ble/bluetooth_low_energy_connection.cc b/components/proximity_auth/ble/bluetooth_low_energy_connection.cc index bf14512..42c7655 100644 --- a/components/proximity_auth/ble/bluetooth_low_energy_connection.cc +++ b/components/proximity_auth/ble/bluetooth_low_energy_connection.cc @@ -11,6 +11,7 @@ #include "components/proximity_auth/ble/bluetooth_low_energy_characteristics_finder.h" #include "components/proximity_auth/ble/fake_wire_message.h" #include "components/proximity_auth/connection_finder.h" +#include "components/proximity_auth/logging/logging.h" #include "components/proximity_auth/wire_message.h" #include "device/bluetooth/bluetooth_adapter.h" #include "device/bluetooth/bluetooth_device.h" @@ -100,7 +101,7 @@ void BluetoothLowEnergyConnection::Disconnect() { connection_.reset(); BluetoothDevice* device = GetRemoteDevice(); if (device) { - VLOG(1) << "Disconnect from device " << device->GetAddress(); + PA_LOG(INFO) << "Disconnect from device " << device->GetAddress(); device->Disconnect( base::Bind(&BluetoothLowEnergyConnection::OnDisconnected, weak_ptr_factory_.GetWeakPtr()), @@ -112,11 +113,11 @@ void BluetoothLowEnergyConnection::Disconnect() { } void BluetoothLowEnergyConnection::OnDisconnected() { - VLOG(1) << "Disconnected."; + PA_LOG(INFO) << "Disconnected."; } void BluetoothLowEnergyConnection::OnDisconnectError() { - VLOG(1) << "Disconnection failed."; + PA_LOG(WARNING) << "Disconnection failed."; } void BluetoothLowEnergyConnection::SetSubStatus(SubStatus new_sub_status) { @@ -134,7 +135,7 @@ void BluetoothLowEnergyConnection::SetSubStatus(SubStatus new_sub_status) { void BluetoothLowEnergyConnection::SendMessageImpl( scoped_ptr<WireMessage> message) { - VLOG(1) << "Sending message " << message->Serialize(); + PA_LOG(INFO) << "Sending message " << message->Serialize(); std::string serialized_msg = message->Serialize(); @@ -173,7 +174,7 @@ void BluetoothLowEnergyConnection::DeviceChanged(BluetoothAdapter* adapter, BluetoothDevice* device) { if (device && device->GetAddress() == GetRemoteDeviceAddress() && !device->IsConnected()) { - VLOG(1) << "GATT connection dropped " << GetRemoteDeviceAddress(); + PA_LOG(INFO) << "GATT connection dropped " << GetRemoteDeviceAddress(); Disconnect(); } } @@ -181,7 +182,7 @@ void BluetoothLowEnergyConnection::DeviceChanged(BluetoothAdapter* adapter, void BluetoothLowEnergyConnection::DeviceRemoved(BluetoothAdapter* adapter, BluetoothDevice* device) { if (device && device->GetAddress() == GetRemoteDeviceAddress()) { - VLOG(1) << "Device removed " << GetRemoteDeviceAddress(); + PA_LOG(INFO) << "Device removed " << GetRemoteDeviceAddress(); Disconnect(); } } @@ -192,8 +193,8 @@ void BluetoothLowEnergyConnection::GattCharacteristicValueChanged( const std::vector<uint8>& value) { DCHECK_EQ(adapter, adapter_.get()); - VLOG(1) << "Characteristic value changed: " - << characteristic->GetUUID().canonical_value(); + PA_LOG(INFO) << "Characteristic value changed: " + << characteristic->GetUUID().canonical_value(); if (characteristic->GetIdentifier() == from_peripheral_char_.id) { if (receiving_bytes_) { @@ -208,7 +209,7 @@ void BluetoothLowEnergyConnection::GattCharacteristicValueChanged( } if (value.size() < 4) { - VLOG(1) << "Incoming data corrupted, no signal found."; + PA_LOG(WARNING) << "Incoming data corrupted, no signal found."; return; } @@ -222,7 +223,7 @@ void BluetoothLowEnergyConnection::GattCharacteristicValueChanged( break; case ControlSignal::kSendSignal: { if (value.size() < 8) { - VLOG(1) + PA_LOG(WARNING) << "Incoming data corrupted, expected message size not found."; return; } @@ -257,15 +258,16 @@ scoped_ptr<WireMessage> BluetoothLowEnergyConnection::DeserializeWireMessage( } void BluetoothLowEnergyConnection::CompleteConnection() { - VLOG(1) << "Connection completed. Time elapsed: " - << base::TimeTicks::Now() - start_time_; + PA_LOG(INFO) << "Connection completed. Time elapsed: " + << base::TimeTicks::Now() - start_time_; SetSubStatus(SubStatus::CONNECTED); } void BluetoothLowEnergyConnection::OnCreateGattConnectionError( device::BluetoothDevice::ConnectErrorCode error_code) { - VLOG(1) << "Error creating GATT connection to " - << remote_device().bluetooth_address << "error code: " << error_code; + PA_LOG(WARNING) << "Error creating GATT connection to " + << remote_device().bluetooth_address + << "error code: " << error_code; Disconnect(); } @@ -306,13 +308,14 @@ void BluetoothLowEnergyConnection::OnCharacteristicsFound( void BluetoothLowEnergyConnection::OnCharacteristicsFinderError( const RemoteAttribute& to_peripheral_char, const RemoteAttribute& from_peripheral_char) { - VLOG(1) << "Connection error, missing characteristics for SmartLock " - "service.\n" << (to_peripheral_char.id.empty() - ? to_peripheral_char.uuid.canonical_value() - : "") - << (from_peripheral_char.id.empty() - ? ", " + from_peripheral_char.uuid.canonical_value() - : "") << " not found."; + PA_LOG(WARNING) << "Connection error, missing characteristics for SmartLock " + "service.\n" + << (to_peripheral_char.id.empty() + ? to_peripheral_char.uuid.canonical_value() + : "") + << (from_peripheral_char.id.empty() + ? ", " + from_peripheral_char.uuid.canonical_value() + : "") << " not found."; Disconnect(); } @@ -334,14 +337,14 @@ void BluetoothLowEnergyConnection::StartNotifySession() { void BluetoothLowEnergyConnection::OnNotifySessionError( BluetoothGattService::GattErrorCode error) { - VLOG(1) << "Error starting notification session: " << error; + PA_LOG(WARNING) << "Error starting notification session: " << error; Disconnect(); } void BluetoothLowEnergyConnection::OnNotifySessionStarted( scoped_ptr<BluetoothGattNotifySession> notify_session) { - VLOG(1) << "Notification session started " - << notify_session->GetCharacteristicIdentifier(); + PA_LOG(INFO) << "Notification session started " + << notify_session->GetCharacteristicIdentifier(); SetSubStatus(SubStatus::NOTIFY_SESSION_READY); notify_session_ = notify_session.Pass(); @@ -359,7 +362,7 @@ void BluetoothLowEnergyConnection::StopNotifySession() { void BluetoothLowEnergyConnection::SendInviteToConnectSignal() { if (sub_status() == SubStatus::NOTIFY_SESSION_READY) { - VLOG(1) << "Sending invite to connect signal"; + PA_LOG(INFO) << "Sending invite to connect signal"; SetSubStatus(SubStatus::WAITING_RESPONSE_SIGNAL); WriteRequest write_request = BuildWriteRequest( @@ -412,8 +415,8 @@ void BluetoothLowEnergyConnection::OnRemoteCharacteristicWritten( void BluetoothLowEnergyConnection::OnWriteRemoteCharacteristicError( bool run_did_send_message_callback, BluetoothGattService::GattErrorCode error) { - VLOG(1) << "Error " << error << " writing characteristic: " - << to_peripheral_char_.uuid.canonical_value(); + PA_LOG(WARNING) << "Error " << error << " writing characteristic: " + << to_peripheral_char_.uuid.canonical_value(); write_remote_characteristic_pending_ = false; // TODO(sacomoto): Actually pass the current message to the observer. if (run_did_send_message_callback) @@ -468,7 +471,7 @@ BluetoothDevice* BluetoothLowEnergyConnection::GetRemoteDevice() { BluetoothGattService* BluetoothLowEnergyConnection::GetRemoteService() { BluetoothDevice* remote_device = GetRemoteDevice(); if (!remote_device) { - VLOG(1) << "device not found"; + PA_LOG(WARNING) << "Remote device not found."; return NULL; } if (remote_service_.id.empty()) { @@ -488,7 +491,7 @@ BluetoothLowEnergyConnection::GetGattCharacteristic( const std::string& gatt_characteristic) { BluetoothGattService* remote_service = GetRemoteService(); if (!remote_service) { - VLOG(1) << "service not found"; + PA_LOG(WARNING) << "Remote service not found."; return NULL; } return remote_service->GetCharacteristic(gatt_characteristic); diff --git a/components/proximity_auth/ble/bluetooth_low_energy_connection_finder.cc b/components/proximity_auth/ble/bluetooth_low_energy_connection_finder.cc index 93858e0..c2e0991 100644 --- a/components/proximity_auth/ble/bluetooth_low_energy_connection_finder.cc +++ b/components/proximity_auth/ble/bluetooth_low_energy_connection_finder.cc @@ -14,6 +14,7 @@ #include "base/thread_task_runner_handle.h" #include "components/proximity_auth/ble/bluetooth_low_energy_connection.h" #include "components/proximity_auth/connection.h" +#include "components/proximity_auth/logging/logging.h" #include "device/bluetooth/bluetooth_adapter_factory.h" #include "device/bluetooth/bluetooth_device.h" #include "device/bluetooth/bluetooth_discovery_session.h" @@ -65,10 +66,10 @@ BluetoothLowEnergyConnectionFinder::~BluetoothLowEnergyConnectionFinder() { void BluetoothLowEnergyConnectionFinder::Find( const ConnectionCallback& connection_callback) { if (!device::BluetoothAdapterFactory::IsBluetoothAdapterAvailable()) { - VLOG(1) << "Bluetooth is unsupported on this platform. Aborting."; + PA_LOG(WARNING) << "Bluetooth is unsupported on this platform. Aborting."; return; } - VLOG(1) << "Finding connection"; + PA_LOG(INFO) << "Finding connection"; connection_callback_ = connection_callback; @@ -83,7 +84,7 @@ void BluetoothLowEnergyConnectionFinder::AdapterPoweredChanged( BluetoothAdapter* adapter, bool powered) { DCHECK_EQ(adapter_.get(), adapter); - VLOG(1) << "Adapter powered: " << powered; + PA_LOG(INFO) << "Adapter powered: " << powered; // Important: do not rely on |adapter->IsDiscoverying()| to verify if there is // an active discovery session. We need to create our own with an specific @@ -96,7 +97,7 @@ void BluetoothLowEnergyConnectionFinder::DeviceAdded(BluetoothAdapter* adapter, BluetoothDevice* device) { DCHECK_EQ(adapter_.get(), adapter); DCHECK(device); - VLOG(1) << "Device added: " << device->GetAddress(); + PA_LOG(INFO) << "Device added: " << device->GetAddress(); // Note: Only consider |device| when it was actually added/updated during a // scanning, otherwise the device is stale and the GATT connection will fail. @@ -112,7 +113,7 @@ void BluetoothLowEnergyConnectionFinder::DeviceChanged( BluetoothDevice* device) { DCHECK_EQ(adapter_.get(), adapter); DCHECK(device); - VLOG(1) << "Device changed: " << device->GetAddress(); + PA_LOG(INFO) << "Device changed: " << device->GetAddress(); // Note: Only consider |device| when it was actually added/updated during a // scanning, otherwise the device is stale and the GATT connection will fail. @@ -129,11 +130,11 @@ void BluetoothLowEnergyConnectionFinder::HandleDeviceUpdated( return; const auto& i = pending_connections_.find(device); if (i != pending_connections_.end()) { - VLOG(1) << "Pending connection to device " << device->GetAddress(); + PA_LOG(INFO) << "Pending connection to device " << device->GetAddress(); return; } if (HasService(device) && device->IsPaired()) { - VLOG(1) << "Connecting to paired device " << device->GetAddress(); + PA_LOG(INFO) << "Connecting to paired device " << device->GetAddress(); pending_connections_.insert(device); CreateGattConnection(device); } @@ -147,14 +148,14 @@ void BluetoothLowEnergyConnectionFinder::DeviceRemoved( const auto& i = pending_connections_.find(device); if (i != pending_connections_.end()) { - VLOG(1) << "Remove pending connection to " << device->GetAddress(); + PA_LOG(INFO) << "Remove pending connection to " << device->GetAddress(); pending_connections_.erase(i); } } void BluetoothLowEnergyConnectionFinder::OnAdapterInitialized( scoped_refptr<BluetoothAdapter> adapter) { - VLOG(1) << "Adapter ready"; + PA_LOG(INFO) << "Adapter ready"; adapter_ = adapter; adapter_->AddObserver(this); @@ -163,12 +164,10 @@ void BluetoothLowEnergyConnectionFinder::OnAdapterInitialized( // temporary MAC may not be resolved automatically (see crbug.com/495402). The // Bluetooth adapter will fire |OnDeviceChanged| notifications for all // Bluetooth Low Energy devices that are advertising. - if (VLOG_IS_ON(1)) { - std::vector<BluetoothDevice*> devices = adapter_->GetDevices(); - for (auto* device : devices) { - VLOG(1) << "Ignoring device " << device->GetAddress() - << " present when adapter was initialized."; - } + std::vector<BluetoothDevice*> devices = adapter_->GetDevices(); + for (auto* device : devices) { + PA_LOG(INFO) << "Ignoring device " << device->GetAddress() + << " present when adapter was initialized."; } StartDiscoverySession(); @@ -176,18 +175,18 @@ void BluetoothLowEnergyConnectionFinder::OnAdapterInitialized( void BluetoothLowEnergyConnectionFinder::OnDiscoverySessionStarted( scoped_ptr<device::BluetoothDiscoverySession> discovery_session) { - VLOG(1) << "Discovery session started"; + PA_LOG(INFO) << "Discovery session started"; discovery_session_ = discovery_session.Pass(); } void BluetoothLowEnergyConnectionFinder::OnStartDiscoverySessionError() { - VLOG(1) << "Error starting discovery session"; + PA_LOG(WARNING) << "Error starting discovery session"; } void BluetoothLowEnergyConnectionFinder::StartDiscoverySession() { DCHECK(adapter_); if (discovery_session_ && discovery_session_->IsActive()) { - VLOG(1) << "Discovery session already active"; + PA_LOG(INFO) << "Discovery session already active"; return; } @@ -206,23 +205,23 @@ void BluetoothLowEnergyConnectionFinder::StartDiscoverySession() { } void BluetoothLowEnergyConnectionFinder::OnDiscoverySessionStopped() { - VLOG(1) << "Discovery session stopped"; + PA_LOG(INFO) << "Discovery session stopped"; discovery_session_.reset(); } void BluetoothLowEnergyConnectionFinder::OnStopDiscoverySessionError() { - VLOG(1) << "Error stopping discovery session"; + PA_LOG(WARNING) << "Error stopping discovery session"; } void BluetoothLowEnergyConnectionFinder::StopDiscoverySession() { - VLOG(1) << "Stopping discovery sesison"; + PA_LOG(INFO) << "Stopping discovery sesison"; if (!adapter_) { - VLOG(1) << "Adapter not initialized"; + PA_LOG(WARNING) << "Adapter not initialized"; return; } if (!discovery_session_ || !discovery_session_->IsActive()) { - VLOG(1) << "No Active discovery session"; + PA_LOG(INFO) << "No Active discovery session"; return; } @@ -237,8 +236,8 @@ void BluetoothLowEnergyConnectionFinder::StopDiscoverySession() { bool BluetoothLowEnergyConnectionFinder::HasService( BluetoothDevice* remote_device) { if (remote_device) { - VLOG(1) << "Device " << remote_device->GetAddress() << " has " - << remote_device->GetUUIDs().size() << " services."; + PA_LOG(INFO) << "Device " << remote_device->GetAddress() << " has " + << remote_device->GetUUIDs().size() << " services."; std::vector<device::BluetoothUUID> uuids = remote_device->GetUUIDs(); for (const auto& service_uuid : uuids) { if (remote_service_uuid_ == service_uuid) { @@ -252,13 +251,13 @@ bool BluetoothLowEnergyConnectionFinder::HasService( void BluetoothLowEnergyConnectionFinder::OnCreateGattConnectionError( std::string device_address, BluetoothDevice::ConnectErrorCode error_code) { - VLOG(1) << "Error creating connection to device " << device_address - << " : error code = " << error_code; + PA_LOG(WARNING) << "Error creating connection to device " << device_address + << " : error code = " << error_code; BluetoothDevice* device = GetDevice(device_address); const auto& i = pending_connections_.find(device); if (i != pending_connections_.end()) { - VLOG(1) << "Remove pending connection to " << device->GetAddress(); + PA_LOG(INFO) << "Remove pending connection to " << device->GetAddress(); pending_connections_.erase(i); } } @@ -270,7 +269,7 @@ void BluetoothLowEnergyConnectionFinder::OnGattConnectionCreated( return; } - VLOG(1) << "GATT connection created"; + PA_LOG(INFO) << "GATT connection created"; connected_ = true; pending_connections_.clear(); @@ -296,10 +295,10 @@ void BluetoothLowEnergyConnectionFinder::CompleteConnection() { void BluetoothLowEnergyConnectionFinder::CreateGattConnection( device::BluetoothDevice* remote_device) { - VLOG(1) << "SmartLock service found (" - << remote_service_uuid_.canonical_value() << ")\n" - << "device = " << remote_device->GetAddress() - << ", name = " << remote_device->GetName(); + PA_LOG(INFO) << "SmartLock service found (" + << remote_service_uuid_.canonical_value() << ")\n" + << "device = " << remote_device->GetAddress() + << ", name = " << remote_device->GetName(); remote_device->CreateGattConnection( base::Bind(&BluetoothLowEnergyConnectionFinder::OnGattConnectionCreated, weak_ptr_factory_.GetWeakPtr()), @@ -315,7 +314,7 @@ void BluetoothLowEnergyConnectionFinder::CloseGattConnection( gatt_connection.reset(); BluetoothDevice* device = adapter_->GetDevice(device_address); if (device) { - VLOG(1) << "Disconnect from device " << device->GetAddress(); + PA_LOG(INFO) << "Disconnect from device " << device->GetAddress(); device->Disconnect(base::Bind(&base::DoNothing), base::Bind(&base::DoNothing)); } @@ -347,7 +346,7 @@ void BluetoothLowEnergyConnectionFinder::OnConnectionStatusChanged( connection_callback_.Run(connection_.Pass()); connection_callback_.Reset(); } else if (old_status == Connection::IN_PROGRESS) { - VLOG(1) << "Connection failed. Retrying."; + PA_LOG(WARNING) << "Connection failed. Retrying."; RestartDiscoverySessionWhenReady(); } } diff --git a/components/proximity_auth/ble/bluetooth_low_energy_connection_finder_unittest.cc b/components/proximity_auth/ble/bluetooth_low_energy_connection_finder_unittest.cc index 21c2039..75981cc 100644 --- a/components/proximity_auth/ble/bluetooth_low_energy_connection_finder_unittest.cc +++ b/components/proximity_auth/ble/bluetooth_low_energy_connection_finder_unittest.cc @@ -122,6 +122,9 @@ class ProximityAuthBluetoothLowEnergyConnectionFinderTest last_discovery_session_alias_(nullptr) { device::BluetoothAdapterFactory::SetAdapterForTesting(adapter_); + std::vector<const device::BluetoothDevice*> devices; + ON_CALL(*adapter_, GetDevices()).WillByDefault(Return(devices)); + ON_CALL(*adapter_, IsPresent()).WillByDefault(Return(true)); ON_CALL(*adapter_, IsPowered()).WillByDefault(Return(true)); } diff --git a/components/proximity_auth/ble/proximity_auth_ble_system.cc b/components/proximity_auth/ble/proximity_auth_ble_system.cc index 5ad6b624..a564005 100644 --- a/components/proximity_auth/ble/proximity_auth_ble_system.cc +++ b/components/proximity_auth/ble/proximity_auth_ble_system.cc @@ -14,6 +14,7 @@ #include "components/proximity_auth/connection.h" #include "components/proximity_auth/cryptauth/base64url.h" #include "components/proximity_auth/cryptauth/cryptauth_client.h" +#include "components/proximity_auth/logging/logging.h" #include "components/proximity_auth/remote_device.h" #include "device/bluetooth/bluetooth_device.h" #include "device/bluetooth/bluetooth_gatt_connection.h" @@ -82,7 +83,7 @@ ProximityAuthBleSystem::ProximityAuthBleSystem( cryptauth_client_factory_(cryptauth_client_factory.Pass()), is_polling_screen_state_(false), weak_ptr_factory_(this) { - VLOG(1) << "Starting Proximity Auth over Bluetooth Low Energy."; + PA_LOG(INFO) << "Starting Proximity Auth over Bluetooth Low Energy."; screenlock_bridge_->AddObserver(this); } @@ -93,12 +94,12 @@ ProximityAuthBleSystem::ProximityAuthBleSystem( browser_context_(browser_context), is_polling_screen_state_(false), weak_ptr_factory_(this) { - VLOG(1) << "Starting Proximity Auth over Bluetooth Low Energy."; + PA_LOG(INFO) << "Starting Proximity Auth over Bluetooth Low Energy."; screenlock_bridge_->AddObserver(this); } ProximityAuthBleSystem::~ProximityAuthBleSystem() { - VLOG(1) << "Stopping Proximity over Bluetooth Low Energy."; + PA_LOG(INFO) << "Stopping Proximity over Bluetooth Low Energy."; screenlock_bridge_->RemoveObserver(this); if (connection_) connection_->RemoveObserver(this); @@ -106,7 +107,8 @@ ProximityAuthBleSystem::~ProximityAuthBleSystem() { void ProximityAuthBleSystem::OnGetMyDevices( const cryptauth::GetMyDevicesResponse& response) { - VLOG(1) << "Found " << response.devices_size() << " devices on CryptAuth."; + PA_LOG(INFO) << "Found " << response.devices_size() + << " devices on CryptAuth."; unlock_keys_.clear(); for (const auto& device : response.devices()) { // Cache BLE devices (|bluetooth_address().empty() == true|) that are @@ -116,15 +118,15 @@ void ProximityAuthBleSystem::OnGetMyDevices( Base64UrlEncode(device.public_key(), &base64_public_key); unlock_keys_[base64_public_key] = device.friendly_device_name(); - VLOG(1) << "friendly_name = " << device.friendly_device_name(); - VLOG(1) << "public_key = " << base64_public_key; + PA_LOG(INFO) << "friendly_name = " << device.friendly_device_name(); + PA_LOG(INFO) << "public_key = " << base64_public_key; } } - VLOG(1) << "Found " << unlock_keys_.size() << " unlock keys."; + PA_LOG(INFO) << "Found " << unlock_keys_.size() << " unlock keys."; } void ProximityAuthBleSystem::OnGetMyDevicesError(const std::string& error) { - VLOG(1) << "GetMyDevices failed: " << error; + PA_LOG(INFO) << "GetMyDevices failed: " << error; } // This should be called exclusively after the user has logged in. For instance, @@ -144,7 +146,7 @@ void ProximityAuthBleSystem::GetUnlockKeys() { void ProximityAuthBleSystem::OnScreenDidLock( ScreenlockBridge::LockHandler::ScreenType screen_type) { - VLOG(1) << "OnScreenDidLock: " << screen_type; + PA_LOG(INFO) << "OnScreenDidLock: " << screen_type; switch (screen_type) { case ScreenlockBridge::LockHandler::SIGNIN_SCREEN: connection_finder_.reset(); @@ -170,7 +172,7 @@ ConnectionFinder* ProximityAuthBleSystem::CreateConnectionFinder() { void ProximityAuthBleSystem::OnScreenDidUnlock( ScreenlockBridge::LockHandler::ScreenType screen_type) { - VLOG(1) << "OnScreenDidUnlock: " << screen_type; + PA_LOG(INFO) << "OnScreenDidUnlock: " << screen_type; // Fetch the unlock keys when the user signs in. // TODO(sacomoto): refetch the keys periodically, in case a new device was @@ -192,12 +194,13 @@ void ProximityAuthBleSystem::OnScreenDidUnlock( } void ProximityAuthBleSystem::OnFocusedUserChanged(const std::string& user_id) { - VLOG(1) << "OnFocusedUserChanged: " << user_id; + PA_LOG(INFO) << "OnFocusedUserChanged: " << user_id; } void ProximityAuthBleSystem::OnMessageReceived(const Connection& connection, const WireMessage& message) { - VLOG(1) << "Message received: " << message.payload(); + // TODO(sacomoto): change this when WireMessage is fully implemented. + PA_LOG(INFO) << "Message received: " << message.payload(); // Unlock the screen when the remote device sends an unlock signal. // @@ -205,14 +208,14 @@ void ProximityAuthBleSystem::OnMessageReceived(const Connection& connection, // This user experience for this operation will be greately improved once // the Proximity Auth Unlock Manager migration to C++ is done. if (message.payload() == kScreenUnlocked) { - VLOG(1) << "Device unlocked. Unlock."; + PA_LOG(INFO) << "Device unlocked. Unlock."; screenlock_bridge_->Unlock(browser_context_); } } void ProximityAuthBleSystem::OnConnectionFound( scoped_ptr<Connection> connection) { - VLOG(1) << "Connection found."; + PA_LOG(INFO) << "Connection found."; connection_ = connection.Pass(); if (connection_) { @@ -246,7 +249,7 @@ void ProximityAuthBleSystem::OnConnectionStatusChanged( void ProximityAuthBleSystem::StartPollingScreenState() { if (is_polling_screen_state_) { if (!connection_ || !connection_->IsConnected()) { - VLOG(1) << "Polling stopped"; + PA_LOG(INFO) << "Polling stopped."; is_polling_screen_state_ = false; return; } |