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

Issue 1233263002: Clean up error handling logic for extension tab muting (Closed)

Created:
5 years, 5 months ago by Jared Sohn
Modified:
5 years, 4 months ago
CC:
chromium-apps-reviews_chromium.org, chromium-reviews, extensions-reviews_chromium.org, miu+watch_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Clean up error handling logic for extension tab muting. 1. Have SetTabAudioMuted return an enumerated value indicating why it failed and use a switch to show an error message. Do not redundantly do checks both in SetTabAudioMuted and in TabsUpdateFunction::RunAsync (in tabs_api.cc) 2. Instead of sending warning messages to the console, set lastError. 3. Put message text in tabs_constants instead of tabs_api BUG=438903 Committed: https://crrev.com/c337ac9749c9cc84872351a909222e151860e66e Cr-Commit-Position: refs/heads/master@{#340528}

Patch Set 1 #

Patch Set 2 : use linked_ptr for TokenBucketInfo #

Patch Set 3 : Combine LastMuteMetadata and RateLimitMetadata and some variable renaming #

Patch Set 4 : add a comment for IsTabAudioMutedRateLimited #

Patch Set 5 : change WARNs to ERRORs, more variable renamings #

Total comments: 11

Patch Set 6 : followups through message #2, added a rate limiting test, documenting rate limiting to user #

Patch Set 7 : Restore capitalization of LastMuteMetadata #

Total comments: 9

Patch Set 8 : Fix issues from #4. Also use tab_constants for error strings." #

Total comments: 7

Patch Set 9 : followups through codereview #8 #

Total comments: 1

Patch Set 10 : remove rate limiting code #

Total comments: 1

Patch Set 11 : include case for TAB_MUTED_RESULT_SUCCESS first within switch to match enum order #

Unified diffs Side-by-side diffs Delta from patch set Stats (+45 lines, -29 lines) Patch
M chrome/browser/extensions/api/tabs/tabs_api.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +15 lines, -17 lines 0 comments Download
M chrome/browser/extensions/api/tabs/tabs_constants.h View 1 2 3 4 5 6 7 8 9 1 chunk +2 lines, -0 lines 0 comments Download
M chrome/browser/extensions/api/tabs/tabs_constants.cc View 1 2 3 4 5 6 7 8 9 1 chunk +5 lines, -1 line 0 comments Download
M chrome/browser/ui/tabs/tab_utils.h View 1 2 3 4 5 6 7 8 9 2 chunks +9 lines, -3 lines 0 comments Download
M chrome/browser/ui/tabs/tab_utils.cc View 1 2 3 4 5 6 7 8 9 1 chunk +13 lines, -6 lines 0 comments Download
M chrome/test/data/extensions/api_test/tabs/basics/muted.js View 1 2 3 4 5 6 7 8 9 1 chunk +1 line, -2 lines 0 comments Download

Messages

Total messages: 27 (4 generated)
miu
Nice work. Comments: https://codereview.chromium.org/1233263002/diff/60001/chrome/browser/ui/tabs/tab_utils.cc File chrome/browser/ui/tabs/tab_utils.cc (right): https://codereview.chromium.org/1233263002/diff/60001/chrome/browser/ui/tabs/tab_utils.cc#newcode271 chrome/browser/ui/tabs/tab_utils.cc:271: // updates the rate limiting state. ...
5 years, 5 months ago (2015-07-15 01:45:56 UTC) #2
Jared Sohn
https://codereview.chromium.org/1233263002/diff/60001/chrome/browser/ui/tabs/tab_utils.cc File chrome/browser/ui/tabs/tab_utils.cc (right): https://codereview.chromium.org/1233263002/diff/60001/chrome/browser/ui/tabs/tab_utils.cc#newcode271 chrome/browser/ui/tabs/tab_utils.cc:271: // updates the rate limiting state. On 2015/07/15 at ...
5 years, 5 months ago (2015-07-15 02:33:34 UTC) #3
miu
https://codereview.chromium.org/1233263002/diff/60001/chrome/browser/ui/tabs/tab_utils.cc File chrome/browser/ui/tabs/tab_utils.cc (right): https://codereview.chromium.org/1233263002/diff/60001/chrome/browser/ui/tabs/tab_utils.cc#newcode332 chrome/browser/ui/tabs/tab_utils.cc:332: if (!contents) On 2015/07/15 02:33:34, Jared Sohn wrote: > ...
5 years, 5 months ago (2015-07-16 00:28:26 UTC) #4
Jared Sohn
I just posted a new update that I think handles all issues mentioned so far. ...
5 years, 5 months ago (2015-07-17 08:36:11 UTC) #5
Jared Sohn
Another question: Right now, if an extension sets a mute state and the tab already ...
5 years, 5 months ago (2015-07-17 19:49:56 UTC) #6
miu
lgtm % nits: https://codereview.chromium.org/1233263002/diff/120001/chrome/browser/extensions/api/tabs/tabs_constants.h File chrome/browser/extensions/api/tabs/tabs_constants.h (right): https://codereview.chromium.org/1233263002/diff/120001/chrome/browser/extensions/api/tabs/tabs_constants.h#newcode97 chrome/browser/extensions/api/tabs/tabs_constants.h:97: extern const char kCannotUpdateMuteDisabled[]; Good idea! ...
5 years, 5 months ago (2015-07-18 00:42:42 UTC) #7
miu
On 2015/07/17 19:49:56, Jared Sohn wrote: > Another question: > > Right now, if an ...
5 years, 5 months ago (2015-07-18 00:48:30 UTC) #8
Jared Sohn
The latest patch should address issues from all feedback thus far. I am also adding ...
5 years, 5 months ago (2015-07-18 23:57:25 UTC) #10
not at google - send to devlin
What is the motivation for rate limiting? What is wrong with updating the mute property ...
5 years, 5 months ago (2015-07-20 22:09:10 UTC) #11
Jared Sohn
On 2015/07/20 at 22:09:10, kalman wrote: > What is the motivation for rate limiting? What ...
5 years, 5 months ago (2015-07-20 23:01:22 UTC) #12
not at google - send to devlin
I'm not sure that API throttling is the right solution to that, like, there are ...
5 years, 5 months ago (2015-07-21 00:04:03 UTC) #13
Jared Sohn
On 2015/07/21 at 00:04:03, kalman wrote: > I'm not sure that API throttling is the ...
5 years, 5 months ago (2015-07-22 09:12:35 UTC) #14
Jared Sohn
I wrote a couple of extensions in which one wants all tabs to be muted ...
5 years, 5 months ago (2015-07-24 20:35:38 UTC) #15
not at google - send to devlin
On 2015/07/24 20:35:38, Jared Sohn wrote: > I wrote a couple of extensions in which ...
5 years, 5 months ago (2015-07-24 21:18:56 UTC) #16
Jared Sohn
>What is the cleanup you're talking about? 1. Have SetTabAudioMuted return an enumerated value indicating ...
5 years, 5 months ago (2015-07-24 21:46:42 UTC) #17
not at google - send to devlin
Ah right. Yes let's submit that part. https://codereview.chromium.org/1233263002/diff/140001/chrome/browser/extensions/api/tabs/tabs_api.cc File chrome/browser/extensions/api/tabs/tabs_api.cc (right): https://codereview.chromium.org/1233263002/diff/140001/chrome/browser/extensions/api/tabs/tabs_api.cc#newcode1244 chrome/browser/extensions/api/tabs/tabs_api.cc:1244: TabMutedResult tabMutedResult ...
5 years, 5 months ago (2015-07-24 21:48:48 UTC) #18
Jared Sohn
> it's hard to say that extensions should be punished for that. The original patch ...
5 years, 5 months ago (2015-07-24 22:44:21 UTC) #19
not at google - send to devlin
> > I also changed the bug's name/description; should it also mention that this > ...
5 years, 5 months ago (2015-07-24 22:47:49 UTC) #20
not at google - send to devlin
lgtm https://codereview.chromium.org/1233263002/diff/160001/chrome/browser/extensions/api/tabs/tabs_api.cc File chrome/browser/extensions/api/tabs/tabs_api.cc (right): https://codereview.chromium.org/1233263002/diff/160001/chrome/browser/extensions/api/tabs/tabs_api.cc#newcode1257 chrome/browser/extensions/api/tabs/tabs_api.cc:1257: case TAB_MUTED_RESULT_SUCCESS: I would keep the cases in ...
5 years, 5 months ago (2015-07-24 22:51:25 UTC) #21
miu
lgtm
5 years, 4 months ago (2015-07-27 17:27:59 UTC) #22
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1233263002/180001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1233263002/180001
5 years, 4 months ago (2015-07-27 17:58:47 UTC) #25
commit-bot: I haz the power
Committed patchset #11 (id:180001)
5 years, 4 months ago (2015-07-27 19:25:22 UTC) #26
commit-bot: I haz the power
5 years, 4 months ago (2015-07-27 19:25:53 UTC) #27
Message was sent while issue was closed.
Patchset 11 (id:??) landed as
https://crrev.com/c337ac9749c9cc84872351a909222e151860e66e
Cr-Commit-Position: refs/heads/master@{#340528}

Powered by Google App Engine
This is Rietveld 408576698