OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/bluetooth/bluetooth_device_chooser_controller.h" | 5 #include "content/browser/bluetooth/bluetooth_device_chooser_controller.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
9 #include <unordered_set> | 9 #include <unordered_set> |
10 | 10 |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 | 334 |
335 void BluetoothDeviceChooserController::AdapterPoweredChanged(bool powered) { | 335 void BluetoothDeviceChooserController::AdapterPoweredChanged(bool powered) { |
336 if (!powered && discovery_session_.get()) { | 336 if (!powered && discovery_session_.get()) { |
337 StopDiscoverySession(std::move(discovery_session_)); | 337 StopDiscoverySession(std::move(discovery_session_)); |
338 } | 338 } |
339 | 339 |
340 if (chooser_.get()) { | 340 if (chooser_.get()) { |
341 chooser_->SetAdapterPresence( | 341 chooser_->SetAdapterPresence( |
342 powered ? BluetoothChooser::AdapterPresence::POWERED_ON | 342 powered ? BluetoothChooser::AdapterPresence::POWERED_ON |
343 : BluetoothChooser::AdapterPresence::POWERED_OFF); | 343 : BluetoothChooser::AdapterPresence::POWERED_OFF); |
| 344 if (powered) { |
| 345 OnBluetoothChooserEvent(BluetoothChooser::Event::RESCAN, |
| 346 "" /* device_address */); |
| 347 } |
344 } | 348 } |
345 | 349 |
346 if (!powered) { | 350 if (!powered) { |
347 discovery_session_timer_.Stop(); | 351 discovery_session_timer_.Stop(); |
348 } | 352 } |
349 } | 353 } |
350 | 354 |
351 void BluetoothDeviceChooserController::PopulateFoundDevices() { | 355 void BluetoothDeviceChooserController::PopulateFoundDevices() { |
352 VLOG(1) << "Populating " << adapter_->GetDevices().size() | 356 VLOG(1) << "Populating " << adapter_->GetDevices().size() |
353 << " devices in chooser."; | 357 << " devices in chooser."; |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 | 465 |
462 void BluetoothDeviceChooserController::PostErrorCallback( | 466 void BluetoothDeviceChooserController::PostErrorCallback( |
463 blink::mojom::WebBluetoothError error) { | 467 blink::mojom::WebBluetoothError error) { |
464 if (!base::ThreadTaskRunnerHandle::Get()->PostTask( | 468 if (!base::ThreadTaskRunnerHandle::Get()->PostTask( |
465 FROM_HERE, base::Bind(error_callback_, error))) { | 469 FROM_HERE, base::Bind(error_callback_, error))) { |
466 LOG(WARNING) << "No TaskRunner."; | 470 LOG(WARNING) << "No TaskRunner."; |
467 } | 471 } |
468 } | 472 } |
469 | 473 |
470 } // namespace content | 474 } // namespace content |
OLD | NEW |