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

Unified Diff: chrome/browser/ui/cocoa/browser_window_cocoa.mm

Issue 1412083002: Indicate in the Window menu which Chrome window has an active sound playing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Applied changes based on the CR, and also refactor the logic Created 5 years, 2 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/cocoa/browser_window_cocoa.mm
diff --git a/chrome/browser/ui/cocoa/browser_window_cocoa.mm b/chrome/browser/ui/cocoa/browser_window_cocoa.mm
index 028c744d53dd56751ccc7c2e29262a534a056ffc..760e0cb4a2e2d2d96e1676b007dba6081d69f07a 100644
--- a/chrome/browser/ui/cocoa/browser_window_cocoa.mm
+++ b/chrome/browser/ui/cocoa/browser_window_cocoa.mm
@@ -88,6 +88,8 @@ const int kBookmarkAppBubbleViewHeight = 46;
const int kIconPreviewTargetSize = 128;
+const char kWhiteSpaceCharacter = ' ';
+
base::string16 TrimText(NSString* controlText) {
base::string16 text = base::SysNSStringToUTF16(controlText);
base::TrimWhitespace(text, base::TRIM_ALL, &text);
@@ -299,12 +301,29 @@ void BrowserWindowCocoa::UpdateTitleBar() {
NSString* newTitle =
base::SysUTF16ToNSString(browser_->GetWindowTitleForCurrentTab());
+ NSMutableString* titleWithMediaState = [NSMutableString string];
Robert Sesek 2015/10/22 00:01:52 Use [NSMutableString stringWithString:] to avoid u
+ [titleWithMediaState appendString:newTitle];
+
+ if (media_state_ == TAB_MEDIA_STATE_AUDIO_PLAYING) {
+ [titleWithMediaState appendFormat:@"%c", kWhiteSpaceCharacter];
miu 2015/10/21 20:06:52 Can the whitespace char be included in the string
+ [titleWithMediaState appendString:@"🔊"];
miu 2015/10/21 20:06:52 Was this moved to generated_resources.prd? If so,
Robert Sesek 2015/10/22 00:01:52 Two appends shouldn't be necessary. Just [title a
+ }
+ else if (media_state_ == TAB_MEDIA_STATE_AUDIO_MUTING) {
Robert Sesek 2015/10/22 00:01:52 nit: this goes on line 310.
+ [titleWithMediaState appendFormat:@"%c", kWhiteSpaceCharacter];
+ [titleWithMediaState appendString:@"🔇"];
+ }
+
pending_window_title_.reset(
[BrowserWindowUtils scheduleReplaceOldTitle:pending_window_title_.get()
- withNewTitle:newTitle
+ withNewTitle:titleWithMediaState
forWindow:window()]);
}
+void BrowserWindowCocoa::UpdateMediaState(TabMediaState media_state) {
+ media_state_ = media_state;
+ UpdateTitleBar();
+}
+
void BrowserWindowCocoa::BookmarkBarStateChanged(
BookmarkBar::AnimateChangeType change_type) {
[[controller_ bookmarkBarController]

Powered by Google App Engine
This is Rietveld 408576698