OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/cocoa/browser_window_cocoa.h" | 5 #include "chrome/browser/ui/cocoa/browser_window_cocoa.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #import "base/mac/sdk_forward_declarations.h" | 10 #import "base/mac/sdk_forward_declarations.h" |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 | 289 |
290 gfx::NativeWindow BrowserWindowCocoa::GetNativeWindow() const { | 290 gfx::NativeWindow BrowserWindowCocoa::GetNativeWindow() const { |
291 return window(); | 291 return window(); |
292 } | 292 } |
293 | 293 |
294 StatusBubble* BrowserWindowCocoa::GetStatusBubble() { | 294 StatusBubble* BrowserWindowCocoa::GetStatusBubble() { |
295 return [controller_ statusBubble]; | 295 return [controller_ statusBubble]; |
296 } | 296 } |
297 | 297 |
298 void BrowserWindowCocoa::UpdateTitleBar() { | 298 void BrowserWindowCocoa::UpdateTitleBar() { |
299 NSString* newTitle = | 299 NSString* newTitle = windowTitle(); |
300 base::SysUTF16ToNSString(browser_->GetWindowTitleForCurrentTab()); | |
301 | 300 |
302 pending_window_title_.reset( | 301 pending_window_title_.reset([BrowserWindowUtils |
303 [BrowserWindowUtils scheduleReplaceOldTitle:pending_window_title_.get() | 302 scheduleReplaceOldTitle:pending_window_title_.get() |
304 withNewTitle:newTitle | 303 withNewTitle:newTitle |
305 forWindow:window()]); | 304 forWindow:window()]); |
| 305 } |
| 306 |
| 307 void BrowserWindowCocoa::UpdateMediaState(TabMediaState media_state) { |
| 308 media_state_ = media_state; |
| 309 UpdateTitleBar(); |
| 310 } |
| 311 |
| 312 NSString* BrowserWindowCocoa::windowTitle() { |
| 313 if (media_state_ == TAB_MEDIA_STATE_AUDIO_PLAYING) { |
| 314 return l10n_util::GetNSStringF(IDS_WINDOW_AUDIO_PLAYING_MAC, |
| 315 browser_->GetWindowTitleForCurrentTab()); |
| 316 } else if (media_state_ == TAB_MEDIA_STATE_AUDIO_MUTING) { |
| 317 return l10n_util::GetNSStringF(IDS_WINDOW_AUDIO_MUTING_MAC, |
| 318 browser_->GetWindowTitleForCurrentTab()); |
| 319 } |
| 320 return base::SysUTF16ToNSString(browser_->GetWindowTitleForCurrentTab()); |
| 321 } |
| 322 |
| 323 TabMediaState BrowserWindowCocoa::mediaState() { |
| 324 return media_state_; |
306 } | 325 } |
307 | 326 |
308 void BrowserWindowCocoa::BookmarkBarStateChanged( | 327 void BrowserWindowCocoa::BookmarkBarStateChanged( |
309 BookmarkBar::AnimateChangeType change_type) { | 328 BookmarkBar::AnimateChangeType change_type) { |
310 [[controller_ bookmarkBarController] | 329 [[controller_ bookmarkBarController] |
311 updateState:browser_->bookmark_bar_state() | 330 updateState:browser_->bookmark_bar_state() |
312 changeType:change_type]; | 331 changeType:change_type]; |
313 } | 332 } |
314 | 333 |
315 void BrowserWindowCocoa::UpdateDevTools() { | 334 void BrowserWindowCocoa::UpdateDevTools() { |
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
854 void BrowserWindowCocoa::UnhideDownloadShelf() { | 873 void BrowserWindowCocoa::UnhideDownloadShelf() { |
855 GetDownloadShelf()->Unhide(); | 874 GetDownloadShelf()->Unhide(); |
856 } | 875 } |
857 | 876 |
858 void BrowserWindowCocoa::HideDownloadShelf() { | 877 void BrowserWindowCocoa::HideDownloadShelf() { |
859 GetDownloadShelf()->Hide(); | 878 GetDownloadShelf()->Hide(); |
860 StatusBubble* statusBubble = GetStatusBubble(); | 879 StatusBubble* statusBubble = GetStatusBubble(); |
861 if (statusBubble) | 880 if (statusBubble) |
862 statusBubble->Hide(); | 881 statusBubble->Hide(); |
863 } | 882 } |
OLD | NEW |