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

Unified Diff: chrome/browser/ui/tabs/tab_utils.h

Issue 1233263002: Clean up error handling logic for extension tab muting (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix issues from #4. Also use tab_constants for error strings." Created 5 years, 5 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: chrome/browser/ui/tabs/tab_utils.h
diff --git a/chrome/browser/ui/tabs/tab_utils.h b/chrome/browser/ui/tabs/tab_utils.h
index 2ca81514a81b2d0486e6534def812969cb610cd2..358e2594671ca0acf6943fb73073149162f7ddd2 100644
--- a/chrome/browser/ui/tabs/tab_utils.h
+++ b/chrome/browser/ui/tabs/tab_utils.h
@@ -7,7 +7,7 @@
#include <string>
#include <vector>
-
+#include "base/containers/hash_tables.h"
#include "base/memory/scoped_ptr.h"
#include "base/strings/string16.h"
#include "content/public/browser/web_contents_user_data.h"
@@ -33,6 +33,13 @@ enum TabMediaState {
TAB_MEDIA_STATE_AUDIO_MUTING, // Tab audio is being muted.
};
+enum TabMutedResult {
+ TAB_MUTED_RESULT_SUCCESS,
+ TAB_MUTED_RESULT_FAIL_NOT_ENABLED,
+ TAB_MUTED_RESULT_FAIL_TABCAPTURE,
+ TAB_MUTED_RESULT_FAIL_RATE_LIMITED,
+};
+
namespace chrome {
// String to indicate reason for muted state change (user, capture, extension
@@ -40,6 +47,10 @@ namespace chrome {
extern const char kMutedToggleCauseUser[];
extern const char kMutedToggleCauseCapture[];
+// Constants for rate limiting mute updating by extensions
+extern const int kMuteTokenBucketCostSeconds;
miu 2015/07/18 00:42:42 Just noticed this: Since these two constants are u
Jared Sohn 2015/07/18 23:57:24 When this is done, I get an error message that say
+extern const int kMuteTokenBucketCapacitySeconds;
+
// Logic to determine which components (i.e., close button, favicon, and media
// indicator) of a tab should be shown, given current state. |capacity|
// specifies how many components can be shown, given available tab width.
@@ -109,9 +120,9 @@ bool IsTabAudioMuted(content::WebContents* contents);
// Sets whether all audio output from |contents| is muted.
// Cause is extensionid, kMutedToggleCause constant, or empty string
-void SetTabAudioMuted(content::WebContents* contents,
- bool mute,
- const std::string& cause);
+TabMutedResult SetTabAudioMuted(content::WebContents* contents,
+ bool mute,
+ const std::string& cause);
// Get cause of mute (extensionid, kMutedToggleCause constant, or empty string)
const std::string& GetTabAudioMutedCause(content::WebContents* contents);

Powered by Google App Engine
This is Rietveld 408576698