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

Side by Side Diff: chrome/browser/ui/cocoa/browser_window_cocoa.mm

Issue 7327007: Moving notification types which are chrome specific to a new header file chrome_notification_type... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 #include "ui/base/l10n/l10n_util_mac.h" 44 #include "ui/base/l10n/l10n_util_mac.h"
45 #include "ui/gfx/rect.h" 45 #include "ui/gfx/rect.h"
46 46
47 BrowserWindowCocoa::BrowserWindowCocoa(Browser* browser, 47 BrowserWindowCocoa::BrowserWindowCocoa(Browser* browser,
48 BrowserWindowController* controller, 48 BrowserWindowController* controller,
49 NSWindow* window) 49 NSWindow* window)
50 : browser_(browser), 50 : browser_(browser),
51 controller_(controller), 51 controller_(controller),
52 confirm_close_factory_(browser) { 52 confirm_close_factory_(browser) {
53 // This pref applies to all windows, so all must watch for it. 53 // This pref applies to all windows, so all must watch for it.
54 registrar_.Add(this, NotificationType::BOOKMARK_BAR_VISIBILITY_PREF_CHANGED, 54 registrar_.Add(this, chrome::BOOKMARK_BAR_VISIBILITY_PREF_CHANGED,
55 NotificationService::AllSources()); 55 NotificationService::AllSources());
56 registrar_.Add(this, NotificationType::SIDEBAR_CHANGED, 56 registrar_.Add(this, chrome::SIDEBAR_CHANGED,
57 NotificationService::AllSources()); 57 NotificationService::AllSources());
58 } 58 }
59 59
60 BrowserWindowCocoa::~BrowserWindowCocoa() { 60 BrowserWindowCocoa::~BrowserWindowCocoa() {
61 } 61 }
62 62
63 void BrowserWindowCocoa::Show() { 63 void BrowserWindowCocoa::Show() {
64 // The Browser associated with this browser window must become the active 64 // The Browser associated with this browser window must become the active
65 // browser at the time |Show()| is called. This is the natural behaviour under 65 // browser at the time |Show()| is called. This is the natural behaviour under
66 // Windows, but |-makeKeyAndOrderFront:| won't send |-windowDidBecomeMain:| 66 // Windows, but |-makeKeyAndOrderFront:| won't send |-windowDidBecomeMain:|
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
576 gfx::Rect bounds(NSRectToCGRect(frame)); 576 gfx::Rect bounds(NSRectToCGRect(frame));
577 bounds.set_y(NSHeight(monitorFrame) - bounds.y() - bounds.height()); 577 bounds.set_y(NSHeight(monitorFrame) - bounds.y() - bounds.height());
578 return bounds; 578 return bounds;
579 } 579 }
580 580
581 WindowOpenDisposition BrowserWindowCocoa::GetDispositionForPopupBounds( 581 WindowOpenDisposition BrowserWindowCocoa::GetDispositionForPopupBounds(
582 const gfx::Rect& bounds) { 582 const gfx::Rect& bounds) {
583 return NEW_POPUP; 583 return NEW_POPUP;
584 } 584 }
585 585
586 void BrowserWindowCocoa::Observe(NotificationType type, 586 void BrowserWindowCocoa::Observe(int type,
587 const NotificationSource& source, 587 const NotificationSource& source,
588 const NotificationDetails& details) { 588 const NotificationDetails& details) {
589 switch (type.value) { 589 switch (type) {
590 // Only the key window gets a direct toggle from the menu. 590 // Only the key window gets a direct toggle from the menu.
591 // Other windows hear about it from the notification. 591 // Other windows hear about it from the notification.
592 case NotificationType::BOOKMARK_BAR_VISIBILITY_PREF_CHANGED: 592 case chrome::BOOKMARK_BAR_VISIBILITY_PREF_CHANGED:
593 [controller_ updateBookmarkBarVisibilityWithAnimation:YES]; 593 [controller_ updateBookmarkBarVisibilityWithAnimation:YES];
594 break; 594 break;
595 case NotificationType::SIDEBAR_CHANGED: 595 case chrome::SIDEBAR_CHANGED:
596 UpdateSidebarForContents( 596 UpdateSidebarForContents(
597 Details<SidebarContainer>(details)->tab_contents()); 597 Details<SidebarContainer>(details)->tab_contents());
598 break; 598 break;
599 default: 599 default:
600 NOTREACHED(); // we don't ask for anything else! 600 NOTREACHED(); // we don't ask for anything else!
601 break; 601 break;
602 } 602 }
603 } 603 }
604 604
605 void BrowserWindowCocoa::DestroyBrowser() { 605 void BrowserWindowCocoa::DestroyBrowser() {
606 [controller_ destroyBrowser]; 606 [controller_ destroyBrowser];
607 607
608 // at this point the controller is dead (autoreleased), so 608 // at this point the controller is dead (autoreleased), so
609 // make sure we don't try to reference it any more. 609 // make sure we don't try to reference it any more.
610 } 610 }
611 611
612 NSWindow* BrowserWindowCocoa::window() const { 612 NSWindow* BrowserWindowCocoa::window() const {
613 return [controller_ window]; 613 return [controller_ window];
614 } 614 }
615 615
616 void BrowserWindowCocoa::UpdateSidebarForContents(TabContents* tab_contents) { 616 void BrowserWindowCocoa::UpdateSidebarForContents(TabContents* tab_contents) {
617 if (tab_contents == browser_->GetSelectedTabContents()) { 617 if (tab_contents == browser_->GetSelectedTabContents()) {
618 [controller_ updateSidebarForContents:tab_contents]; 618 [controller_ updateSidebarForContents:tab_contents];
619 } 619 }
620 } 620 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698