Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(78)

Side by Side Diff: content/browser/bluetooth/bluetooth_device_chooser_controller.cc

Issue 2663693002: Add listener for AdapterDiscoveringChanged on BT chooser-controller
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 448 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 OnBluetoothChooserEvent(BluetoothChooser::Event::RESCAN, 459 OnBluetoothChooserEvent(BluetoothChooser::Event::RESCAN,
460 "" /* device_address */); 460 "" /* device_address */);
461 } 461 }
462 } 462 }
463 463
464 if (!powered) { 464 if (!powered) {
465 discovery_session_timer_.Stop(); 465 discovery_session_timer_.Stop();
466 } 466 }
467 } 467 }
468 468
469 void BluetoothDeviceChooserController::AdapterDiscoveringChanged(
470 bool discovering) {
471 if (!discovering && discovery_session_.get() &&
scheib 2017/02/13 21:06:54 Remove ".get()", it is not required.
472 discovery_session_->IsActive()) {
473 StopDeviceDiscovery();
474 }
475 }
476
469 int BluetoothDeviceChooserController::CalculateSignalStrengthLevel( 477 int BluetoothDeviceChooserController::CalculateSignalStrengthLevel(
470 int8_t rssi) { 478 int8_t rssi) {
471 RecordRSSISignalStrength(rssi); 479 RecordRSSISignalStrength(rssi);
472 480
473 if (rssi < k20thPercentileRSSI) { 481 if (rssi < k20thPercentileRSSI) {
474 RecordRSSISignalStrengthLevel(content::UMARSSISignalStrengthLevel::LEVEL_0); 482 RecordRSSISignalStrengthLevel(content::UMARSSISignalStrengthLevel::LEVEL_0);
475 return 0; 483 return 0;
476 } else if (rssi < k40thPercentileRSSI) { 484 } else if (rssi < k40thPercentileRSSI) {
477 RecordRSSISignalStrengthLevel(content::UMARSSISignalStrengthLevel::LEVEL_1); 485 RecordRSSISignalStrengthLevel(content::UMARSSISignalStrengthLevel::LEVEL_1);
478 return 1; 486 return 1;
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 627
620 void BluetoothDeviceChooserController::PostErrorCallback( 628 void BluetoothDeviceChooserController::PostErrorCallback(
621 blink::mojom::WebBluetoothResult error) { 629 blink::mojom::WebBluetoothResult error) {
622 if (!base::ThreadTaskRunnerHandle::Get()->PostTask( 630 if (!base::ThreadTaskRunnerHandle::Get()->PostTask(
623 FROM_HERE, base::Bind(error_callback_, error))) { 631 FROM_HERE, base::Bind(error_callback_, error))) {
624 LOG(WARNING) << "No TaskRunner."; 632 LOG(WARNING) << "No TaskRunner.";
625 } 633 }
626 } 634 }
627 635
628 } // namespace content 636 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698