Chromium Code Reviews| Index: chrome/browser/extensions/api/tabs/tabs_api.cc |
| diff --git a/chrome/browser/extensions/api/tabs/tabs_api.cc b/chrome/browser/extensions/api/tabs/tabs_api.cc |
| index 83827fb16c30ebaace2bf039766634fd3036c383..48e1815f73c6e3ec6cb5b96b1a7627e0fb203cae 100644 |
| --- a/chrome/browser/extensions/api/tabs/tabs_api.cc |
| +++ b/chrome/browser/extensions/api/tabs/tabs_api.cc |
| @@ -1241,23 +1241,21 @@ bool TabsUpdateFunction::RunAsync() { |
| } |
| if (params->update_properties.muted.get()) { |
| - if (chrome::IsTabAudioMutingFeatureEnabled()) { |
| - if (!chrome::CanToggleAudioMute(contents)) { |
| - WriteToConsole( |
| - content::CONSOLE_MESSAGE_LEVEL_WARNING, |
| - base::StringPrintf( |
| - "Cannot update mute state for tab %d, tab has audio or video " |
| - "currently being captured", |
| - tab_id)); |
| - } else { |
| - chrome::SetTabAudioMuted(contents, *params->update_properties.muted, |
| - extension()->id()); |
| - } |
| - } else { |
| - WriteToConsole(content::CONSOLE_MESSAGE_LEVEL_WARNING, |
| - base::StringPrintf( |
| - "Failed to update mute state, --%s must be enabled", |
| - switches::kEnableTabAudioMuting)); |
| + TabMutedResult tab_muted_result = chrome::SetTabAudioMuted( |
| + contents, *params->update_properties.muted, extension()->id()); |
| + |
| + switch (tab_muted_result) { |
| + case TAB_MUTED_RESULT_FAIL_NOT_ENABLED: |
| + error_ = ErrorUtils::FormatErrorMessage( |
| + keys::kCannotUpdateMuteDisabled, base::IntToString(tab_id), |
| + switches::kEnableTabAudioMuting); |
| + return false; |
| + case TAB_MUTED_RESULT_FAIL_TABCAPTURE: |
| + error_ = ErrorUtils::FormatErrorMessage(keys::kCannotUpdateMuteCaptured, |
| + base::IntToString(tab_id)); |
| + return false; |
| + case TAB_MUTED_RESULT_SUCCESS: |
|
not at google - send to devlin
2015/07/24 22:51:25
I would keep the cases in the same order they appe
|
| + break; |
| } |
| } |