OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/sys_string_conversions.h" | 10 #include "base/sys_string_conversions.h" |
(...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
606 void BrowserWindowCocoa::Observe(NotificationType type, | 606 void BrowserWindowCocoa::Observe(NotificationType type, |
607 const NotificationSource& source, | 607 const NotificationSource& source, |
608 const NotificationDetails& details) { | 608 const NotificationDetails& details) { |
609 switch (type.value) { | 609 switch (type.value) { |
610 // Only the key window gets a direct toggle from the menu. | 610 // Only the key window gets a direct toggle from the menu. |
611 // Other windows hear about it from the notification. | 611 // Other windows hear about it from the notification. |
612 case NotificationType::BOOKMARK_BAR_VISIBILITY_PREF_CHANGED: | 612 case NotificationType::BOOKMARK_BAR_VISIBILITY_PREF_CHANGED: |
613 [controller_ updateBookmarkBarVisibilityWithAnimation:YES]; | 613 [controller_ updateBookmarkBarVisibilityWithAnimation:YES]; |
614 break; | 614 break; |
615 case NotificationType::SIDEBAR_CHANGED: | 615 case NotificationType::SIDEBAR_CHANGED: |
616 UpdateSidebarForContents( | 616 UpdateSidebar(Details<SidebarChangedDetails>(details).ptr()); |
617 Details<SidebarContainer>(details)->tab_contents()); | |
618 break; | 617 break; |
619 default: | 618 default: |
620 NOTREACHED(); // we don't ask for anything else! | 619 NOTREACHED(); // we don't ask for anything else! |
621 break; | 620 break; |
622 } | 621 } |
623 } | 622 } |
624 | 623 |
625 void BrowserWindowCocoa::DestroyBrowser() { | 624 void BrowserWindowCocoa::DestroyBrowser() { |
626 [controller_ destroyBrowser]; | 625 [controller_ destroyBrowser]; |
627 | 626 |
628 // at this point the controller is dead (autoreleased), so | 627 // at this point the controller is dead (autoreleased), so |
629 // make sure we don't try to reference it any more. | 628 // make sure we don't try to reference it any more. |
630 } | 629 } |
631 | 630 |
632 NSWindow* BrowserWindowCocoa::window() const { | 631 NSWindow* BrowserWindowCocoa::window() const { |
633 return [controller_ window]; | 632 return [controller_ window]; |
634 } | 633 } |
635 | 634 |
636 void BrowserWindowCocoa::UpdateSidebarForContents(TabContents* tab_contents) { | 635 void BrowserWindowCocoa::UpdateSidebar(SidebarChangedDetails* details) { |
637 if (tab_contents == browser_->GetSelectedTabContents()) { | 636 if (details->source->tab() == browser_->GetSelectedTabContentsWrapper()) { |
638 [controller_ updateSidebarForContents:tab_contents]; | 637 [controller_ updateSidebarForTab:details->source->tab()]; |
639 } | 638 } |
640 } | 639 } |
OLD | NEW |