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

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

Issue 2663693002: Add listener for AdapterDiscoveringChanged on BT chooser-controller
Patch Set: Remove ".get()" in bluetooth_device_chooser_controller.cc Created 3 years, 9 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 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 OnBluetoothChooserEvent(BluetoothChooser::Event::RESCAN, 395 OnBluetoothChooserEvent(BluetoothChooser::Event::RESCAN,
396 "" /* device_address */); 396 "" /* device_address */);
397 } 397 }
398 } 398 }
399 399
400 if (!powered) { 400 if (!powered) {
401 discovery_session_timer_.Stop(); 401 discovery_session_timer_.Stop();
402 } 402 }
403 } 403 }
404 404
405 void BluetoothDeviceChooserController::AdapterDiscoveringChanged(
406 bool discovering) {
407 if (!discovering && discovery_session_ && discovery_session_->IsActive())
408 StopDeviceDiscovery();
409 }
410
405 int BluetoothDeviceChooserController::CalculateSignalStrengthLevel( 411 int BluetoothDeviceChooserController::CalculateSignalStrengthLevel(
406 int8_t rssi) { 412 int8_t rssi) {
407 RecordRSSISignalStrength(rssi); 413 RecordRSSISignalStrength(rssi);
408 414
409 if (rssi <= kMinRSSI) { 415 if (rssi <= kMinRSSI) {
410 RecordRSSISignalStrengthLevel( 416 RecordRSSISignalStrengthLevel(
411 UMARSSISignalStrengthLevel::LESS_THAN_OR_EQUAL_TO_MIN_RSSI); 417 UMARSSISignalStrengthLevel::LESS_THAN_OR_EQUAL_TO_MIN_RSSI);
412 return 0; 418 return 0;
413 } 419 }
414 420
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 561
556 void BluetoothDeviceChooserController::PostErrorCallback( 562 void BluetoothDeviceChooserController::PostErrorCallback(
557 blink::mojom::WebBluetoothResult error) { 563 blink::mojom::WebBluetoothResult error) {
558 if (!base::ThreadTaskRunnerHandle::Get()->PostTask( 564 if (!base::ThreadTaskRunnerHandle::Get()->PostTask(
559 FROM_HERE, base::Bind(error_callback_, error))) { 565 FROM_HERE, base::Bind(error_callback_, error))) {
560 LOG(WARNING) << "No TaskRunner."; 566 LOG(WARNING) << "No TaskRunner.";
561 } 567 }
562 } 568 }
563 569
564 } // namespace content 570 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698