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

Unified Diff: content/browser/web_contents/web_contents_impl.cc

Issue 1848663002: bluetooth: Remove indicator only when there are no more devices connected (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@my-origin
Patch Set: Ref count connections Created 4 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/web_contents/web_contents_impl.cc
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 2d463287de60180ff5c1c2e3e3f41c96ae7d9f7b..041a57c975cd109afb42296e35509ad952d7d69c 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -358,7 +358,7 @@ WebContentsImpl::WebContentsImpl(BrowserContext* browser_context)
accessibility_mode_(
BrowserAccessibilityStateImpl::GetInstance()->accessibility_mode()),
audio_stream_monitor_(this),
- bluetooth_device_connected_(false),
+ bluetooth_connected_devices_(0),
virtual_keyboard_requested_(false),
page_scale_factor_is_one_(true),
loading_weak_factory_(this),
@@ -1125,14 +1125,22 @@ void WebContentsImpl::SetAudioMuted(bool mute) {
NotifyNavigationStateChanged(INVALIDATE_TYPE_TAB);
}
-bool WebContentsImpl::IsBluetoothDeviceConnected() const {
- return bluetooth_device_connected_;
+void WebContentsImpl::IncrementBluetoothConnectedDeviceCount() {
+ // Notification for UI updates if the state changes.
+ if (bluetooth_connected_device_count_++ == 0) {
Jeffrey Yasskin 2016/03/31 18:00:25 I hate post-increment, because I have to think too
ortuno 2016/04/04 21:20:56 Done.
+ NotifyNavigationStateChanged(INVALIDATE_TYPE_TAB);
+ }
}
-void WebContentsImpl::SetBluetoothDeviceConnected(bool connected) {
- bluetooth_device_connected_ = connected;
- // Notification for UI updates in response to the connected device.
- NotifyNavigationStateChanged(INVALIDATE_TYPE_TAB);
+void WebContentsImpl::DecrementBluetoothConnectedDeviceCount() {
+ // Notification for UI updates if the state changes.
+ if (bluetooth_connected_device_count_-- == 1) {
+ NotifyNavigationStateChanged(INVALIDATE_TYPE_TAB);
+ }
+}
+
+bool WebContentsImpl::IsConnectedToBluetoothDevice() const {
+ return bluetooth_connected_devices_ > 0;
}
bool WebContentsImpl::IsCrashed() const {

Powered by Google App Engine
This is Rietveld 408576698