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

Issue 2801403002: MD Settings: Bluetooth: Fix adapter state and discovery (Closed)

Created:
3 years, 8 months ago by stevenjb
Modified:
3 years, 8 months ago
Reviewers:
rkc, Devlin, michaelpg
CC:
chromium-reviews, extensions-reviews_chromium.org, michaelpg+watch-md-settings_chromium.org, michaelpg+watch-md-ui_chromium.org, arv+watch_chromium.org, chromium-apps-reviews_chromium.org, dbeam+watch-settings_chromium.org, stevenjb+watch-md-settings_chromium.org
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

MD Settings: Bluetooth: Fix adapter state and discovery This CL: * Adds some additional bluetooth event logging (USER events). * Fixes the toggle logic so as not to set powered=false before the adapter state is received or when the toggle state matches the adapter state. * Disables the toggle until the adapter state changes (not normally observable, but can prevent rapid toggling artifacts). * Modifies BluetoothEventRouter to stop discovery when all WebUI tabs (or all tabs/windows associated with an extension) are closed. BUG=703694, 703698 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation Review-Url: https://codereview.chromium.org/2801403002 Cr-Commit-Position: refs/heads/master@{#464258} Committed: https://chromium.googlesource.com/chromium/src/+/f4de1dce7be5bc5c6fcf4615478757773dace027

Patch Set 1 #

Patch Set 2 : . #

Total comments: 8

Patch Set 3 : Improve comment #

Total comments: 5

Patch Set 4 : Correct comment and add more logging #

Patch Set 5 : Track event router listeners by id #

Patch Set 6 : Fix unittests #

Patch Set 7 : Fix test #

Total comments: 14

Patch Set 8 : Feedback #

Patch Set 9 : Use CHECK instead of early exit #

Unified diffs Side-by-side diffs Delta from patch set Stats (+185 lines, -91 lines) Patch
M chrome/browser/resources/settings/bluetooth_page/bluetooth_page.html View 3 chunks +6 lines, -5 lines 0 comments Download
M chrome/browser/resources/settings/bluetooth_page/bluetooth_page.js View 1 2 4 chunks +32 lines, -10 lines 0 comments Download
M chrome/browser/resources/settings/bluetooth_page/bluetooth_subpage.html View 2 chunks +11 lines, -9 lines 0 comments Download
M chrome/browser/resources/settings/bluetooth_page/bluetooth_subpage.js View 3 chunks +11 lines, -8 lines 0 comments Download
M chrome/test/data/webui/settings/bluetooth_page_tests.js View 1 2 3 4 5 6 1 chunk +12 lines, -9 lines 0 comments Download
M chrome/test/data/webui/settings/fake_bluetooth.js View 1 2 3 4 5 6 3 chunks +15 lines, -4 lines 0 comments Download
M chrome/test/data/webui/settings/fake_bluetooth_private.js View 1 2 3 4 5 6 1 chunk +1 line, -1 line 0 comments Download
M extensions/browser/api/DEPS View 1 chunk +1 line, -0 lines 0 comments Download
M extensions/browser/api/bluetooth/bluetooth_api.cc View 1 2 3 4 4 chunks +9 lines, -3 lines 0 comments Download
M extensions/browser/api/bluetooth/bluetooth_event_router.h View 1 2 3 4 3 chunks +5 lines, -3 lines 0 comments Download
M extensions/browser/api/bluetooth/bluetooth_event_router.cc View 1 2 3 4 5 6 7 8 22 chunks +64 lines, -31 lines 0 comments Download
M extensions/browser/api/bluetooth/bluetooth_event_router_unittest.cc View 1 2 3 4 5 6 7 2 chunks +12 lines, -8 lines 0 comments Download
M extensions/browser/api/bluetooth/bluetooth_private_api.cc View 4 chunks +6 lines, -0 lines 0 comments Download

Messages

Total messages: 44 (16 generated)
stevenjb
3 years, 8 months ago (2017-04-07 21:18:29 UTC) #3
stevenjb
+rdevlin.cronin@ for extensions/
3 years, 8 months ago (2017-04-07 21:20:00 UTC) #5
rkc
//e/b/a/bluetooth* lgtm I'll leave the review for the settings changes to Michael.
3 years, 8 months ago (2017-04-07 21:23:29 UTC) #6
michaelpg
https://codereview.chromium.org/2801403002/diff/20001/chrome/browser/resources/settings/bluetooth_page/bluetooth_page.js File chrome/browser/resources/settings/bluetooth_page/bluetooth_page.js (right): https://codereview.chromium.org/2801403002/diff/20001/chrome/browser/resources/settings/bluetooth_page/bluetooth_page.js#newcode36 chrome/browser/resources/settings/bluetooth_page/bluetooth_page.js:36: * Reflects the current state of the toggle buttons. ...
3 years, 8 months ago (2017-04-07 21:47:03 UTC) #7
stevenjb
https://codereview.chromium.org/2801403002/diff/20001/chrome/browser/resources/settings/bluetooth_page/bluetooth_page.js File chrome/browser/resources/settings/bluetooth_page/bluetooth_page.js (right): https://codereview.chromium.org/2801403002/diff/20001/chrome/browser/resources/settings/bluetooth_page/bluetooth_page.js#newcode36 chrome/browser/resources/settings/bluetooth_page/bluetooth_page.js:36: * Reflects the current state of the toggle buttons. ...
3 years, 8 months ago (2017-04-07 23:36:05 UTC) #8
Devlin
https://codereview.chromium.org/2801403002/diff/40001/extensions/browser/api/bluetooth/bluetooth_event_router.cc File extensions/browser/api/bluetooth/bluetooth_event_router.cc (right): https://codereview.chromium.org/2801403002/diff/40001/extensions/browser/api/bluetooth/bluetooth_event_router.cc#newcode227 extensions/browser/api/bluetooth/bluetooth_event_router.cc:227: // When a tab is closed, OnExtensionUnloaded may not ...
3 years, 8 months ago (2017-04-08 00:22:28 UTC) #9
stevenjb
https://codereview.chromium.org/2801403002/diff/40001/extensions/browser/api/bluetooth/bluetooth_event_router.cc File extensions/browser/api/bluetooth/bluetooth_event_router.cc (right): https://codereview.chromium.org/2801403002/diff/40001/extensions/browser/api/bluetooth/bluetooth_event_router.cc#newcode227 extensions/browser/api/bluetooth/bluetooth_event_router.cc:227: // When a tab is closed, OnExtensionUnloaded may not ...
3 years, 8 months ago (2017-04-08 00:40:52 UTC) #10
Devlin
https://codereview.chromium.org/2801403002/diff/40001/extensions/browser/api/bluetooth/bluetooth_event_router.cc File extensions/browser/api/bluetooth/bluetooth_event_router.cc (right): https://codereview.chromium.org/2801403002/diff/40001/extensions/browser/api/bluetooth/bluetooth_event_router.cc#newcode227 extensions/browser/api/bluetooth/bluetooth_event_router.cc:227: // When a tab is closed, OnExtensionUnloaded may not ...
3 years, 8 months ago (2017-04-08 00:43:43 UTC) #11
stevenjb
https://codereview.chromium.org/2801403002/diff/40001/extensions/browser/api/bluetooth/bluetooth_event_router.cc File extensions/browser/api/bluetooth/bluetooth_event_router.cc (right): https://codereview.chromium.org/2801403002/diff/40001/extensions/browser/api/bluetooth/bluetooth_event_router.cc#newcode227 extensions/browser/api/bluetooth/bluetooth_event_router.cc:227: // When a tab is closed, OnExtensionUnloaded may not ...
3 years, 8 months ago (2017-04-08 02:26:15 UTC) #13
Devlin
lgtm https://codereview.chromium.org/2801403002/diff/40001/extensions/browser/api/bluetooth/bluetooth_event_router.cc File extensions/browser/api/bluetooth/bluetooth_event_router.cc (right): https://codereview.chromium.org/2801403002/diff/40001/extensions/browser/api/bluetooth/bluetooth_event_router.cc#newcode227 extensions/browser/api/bluetooth/bluetooth_event_router.cc:227: // When a tab is closed, OnExtensionUnloaded may ...
3 years, 8 months ago (2017-04-10 22:42:47 UTC) #14
stevenjb
I was less than pleased with the previous heavy handed solution so I did some ...
3 years, 8 months ago (2017-04-11 04:46:09 UTC) #15
stevenjb
rdevlin.cronin@, rkc@ PTAL delta from PS 4.
3 years, 8 months ago (2017-04-11 19:49:48 UTC) #20
michaelpg
lgtm
3 years, 8 months ago (2017-04-11 21:51:10 UTC) #25
stevenjb
rdevlin.cronin@, rkc@ could you PTAL delta from PS 4. This is a P1 for M59.
3 years, 8 months ago (2017-04-12 17:45:59 UTC) #26
rkc
lgtm % comment https://codereview.chromium.org/2801403002/diff/140001/extensions/browser/api/bluetooth/bluetooth_event_router_unittest.cc File extensions/browser/api/bluetooth/bluetooth_event_router_unittest.cc (right): https://codereview.chromium.org/2801403002/diff/140001/extensions/browser/api/bluetooth/bluetooth_event_router_unittest.cc#newcode70 extensions/browser/api/bluetooth/bluetooth_event_router_unittest.cc:70: EventListenerInfo info("", "", GURL(), nullptr); Can ...
3 years, 8 months ago (2017-04-12 17:58:52 UTC) #27
stevenjb
https://codereview.chromium.org/2801403002/diff/140001/extensions/browser/api/bluetooth/bluetooth_event_router_unittest.cc File extensions/browser/api/bluetooth/bluetooth_event_router_unittest.cc (right): https://codereview.chromium.org/2801403002/diff/140001/extensions/browser/api/bluetooth/bluetooth_event_router_unittest.cc#newcode70 extensions/browser/api/bluetooth/bluetooth_event_router_unittest.cc:70: EventListenerInfo info("", "", GURL(), nullptr); On 2017/04/12 17:58:52, rkc ...
3 years, 8 months ago (2017-04-12 18:08:56 UTC) #28
rkc
That's fine - but then please do file a bug for expanding this test and ...
3 years, 8 months ago (2017-04-12 18:26:27 UTC) #29
Devlin
https://codereview.chromium.org/2801403002/diff/140001/extensions/browser/api/bluetooth/bluetooth_event_router.cc File extensions/browser/api/bluetooth/bluetooth_event_router.cc (right): https://codereview.chromium.org/2801403002/diff/140001/extensions/browser/api/bluetooth/bluetooth_event_router.cc#newcode50 extensions/browser/api/bluetooth/bluetooth_event_router.cc:50: : details.listener_url.host(); Haven't we had issues with using the ...
3 years, 8 months ago (2017-04-12 19:21:44 UTC) #30
stevenjb
https://codereview.chromium.org/2801403002/diff/140001/extensions/browser/api/bluetooth/bluetooth_event_router.cc File extensions/browser/api/bluetooth/bluetooth_event_router.cc (right): https://codereview.chromium.org/2801403002/diff/140001/extensions/browser/api/bluetooth/bluetooth_event_router.cc#newcode50 extensions/browser/api/bluetooth/bluetooth_event_router.cc:50: : details.listener_url.host(); On 2017/04/12 19:21:44, Devlin wrote: > Haven't ...
3 years, 8 months ago (2017-04-12 20:35:41 UTC) #31
stevenjb
PTAL
3 years, 8 months ago (2017-04-12 20:36:09 UTC) #32
Devlin
https://codereview.chromium.org/2801403002/diff/140001/extensions/browser/api/bluetooth/bluetooth_event_router.cc File extensions/browser/api/bluetooth/bluetooth_event_router.cc (right): https://codereview.chromium.org/2801403002/diff/140001/extensions/browser/api/bluetooth/bluetooth_event_router.cc#newcode390 extensions/browser/api/bluetooth/bluetooth_event_router.cc:390: return; // Edge case if adapter wasn't ready when ...
3 years, 8 months ago (2017-04-12 22:23:20 UTC) #33
stevenjb
https://codereview.chromium.org/2801403002/diff/140001/extensions/browser/api/bluetooth/bluetooth_event_router.cc File extensions/browser/api/bluetooth/bluetooth_event_router.cc (right): https://codereview.chromium.org/2801403002/diff/140001/extensions/browser/api/bluetooth/bluetooth_event_router.cc#newcode390 extensions/browser/api/bluetooth/bluetooth_event_router.cc:390: return; // Edge case if adapter wasn't ready when ...
3 years, 8 months ago (2017-04-12 22:33:01 UTC) #34
Devlin
https://codereview.chromium.org/2801403002/diff/140001/extensions/browser/api/bluetooth/bluetooth_event_router.cc File extensions/browser/api/bluetooth/bluetooth_event_router.cc (right): https://codereview.chromium.org/2801403002/diff/140001/extensions/browser/api/bluetooth/bluetooth_event_router.cc#newcode390 extensions/browser/api/bluetooth/bluetooth_event_router.cc:390: return; // Edge case if adapter wasn't ready when ...
3 years, 8 months ago (2017-04-12 23:01:26 UTC) #35
stevenjb
https://codereview.chromium.org/2801403002/diff/140001/extensions/browser/api/bluetooth/bluetooth_event_router.cc File extensions/browser/api/bluetooth/bluetooth_event_router.cc (right): https://codereview.chromium.org/2801403002/diff/140001/extensions/browser/api/bluetooth/bluetooth_event_router.cc#newcode390 extensions/browser/api/bluetooth/bluetooth_event_router.cc:390: return; // Edge case if adapter wasn't ready when ...
3 years, 8 months ago (2017-04-12 23:12:28 UTC) #36
Devlin
lgtm again with a CHECK. Sorry for the back-and-forth. https://codereview.chromium.org/2801403002/diff/140001/extensions/browser/api/bluetooth/bluetooth_event_router.cc File extensions/browser/api/bluetooth/bluetooth_event_router.cc (right): https://codereview.chromium.org/2801403002/diff/140001/extensions/browser/api/bluetooth/bluetooth_event_router.cc#newcode390 extensions/browser/api/bluetooth/bluetooth_event_router.cc:390: ...
3 years, 8 months ago (2017-04-13 00:13:39 UTC) #37
stevenjb
Thanks for the review! Hopefully someone will have a chance to clean this all up ...
3 years, 8 months ago (2017-04-13 00:25:31 UTC) #38
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2801403002/180001
3 years, 8 months ago (2017-04-13 00:27:03 UTC) #41
commit-bot: I haz the power
3 years, 8 months ago (2017-04-13 02:48:48 UTC) #44
Message was sent while issue was closed.
Committed patchset #9 (id:180001) as
https://chromium.googlesource.com/chromium/src/+/f4de1dce7be5bc5c6fcf46154787...

Powered by Google App Engine
This is Rietveld 408576698