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

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 17 matching lines...) Expand all
28 #import "chrome/browser/ui/cocoa/html_dialog_window_controller.h" 28 #import "chrome/browser/ui/cocoa/html_dialog_window_controller.h"
29 #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" 29 #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h"
30 #import "chrome/browser/ui/cocoa/nsmenuitem_additions.h" 30 #import "chrome/browser/ui/cocoa/nsmenuitem_additions.h"
31 #include "chrome/browser/ui/cocoa/repost_form_warning_mac.h" 31 #include "chrome/browser/ui/cocoa/repost_form_warning_mac.h"
32 #include "chrome/browser/ui/cocoa/restart_browser.h" 32 #include "chrome/browser/ui/cocoa/restart_browser.h"
33 #include "chrome/browser/ui/cocoa/status_bubble_mac.h" 33 #include "chrome/browser/ui/cocoa/status_bubble_mac.h"
34 #include "chrome/browser/ui/cocoa/task_manager_mac.h" 34 #include "chrome/browser/ui/cocoa/task_manager_mac.h"
35 #import "chrome/browser/ui/cocoa/theme_install_bubble_view.h" 35 #import "chrome/browser/ui/cocoa/theme_install_bubble_view.h"
36 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" 36 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h"
37 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 37 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
38 #include "chrome/common/chrome_notification_types.h"
38 #include "chrome/common/pref_names.h" 39 #include "chrome/common/pref_names.h"
39 #include "content/browser/tab_contents/tab_contents.h" 40 #include "content/browser/tab_contents/tab_contents.h"
40 #include "content/common/native_web_keyboard_event.h" 41 #include "content/common/native_web_keyboard_event.h"
41 #include "content/common/notification_service.h" 42 #include "content/common/notification_service.h"
42 #include "grit/chromium_strings.h" 43 #include "grit/chromium_strings.h"
43 #include "grit/generated_resources.h" 44 #include "grit/generated_resources.h"
44 #include "ui/base/l10n/l10n_util_mac.h" 45 #include "ui/base/l10n/l10n_util_mac.h"
45 #include "ui/gfx/rect.h" 46 #include "ui/gfx/rect.h"
46 47
47 BrowserWindowCocoa::BrowserWindowCocoa(Browser* browser, 48 BrowserWindowCocoa::BrowserWindowCocoa(Browser* browser,
48 BrowserWindowController* controller, 49 BrowserWindowController* controller,
49 NSWindow* window) 50 NSWindow* window)
50 : browser_(browser), 51 : browser_(browser),
51 controller_(controller), 52 controller_(controller),
52 confirm_close_factory_(browser) { 53 confirm_close_factory_(browser) {
53 // This pref applies to all windows, so all must watch for it. 54 // This pref applies to all windows, so all must watch for it.
54 registrar_.Add(this, NotificationType::BOOKMARK_BAR_VISIBILITY_PREF_CHANGED, 55 registrar_.Add(this,
56 chrome::NOTIFICATION_BOOKMARK_BAR_VISIBILITY_PREF_CHANGED,
55 NotificationService::AllSources()); 57 NotificationService::AllSources());
56 registrar_.Add(this, NotificationType::SIDEBAR_CHANGED, 58 registrar_.Add(this, chrome::NOTIFICATION_SIDEBAR_CHANGED,
57 NotificationService::AllSources()); 59 NotificationService::AllSources());
58 } 60 }
59 61
60 BrowserWindowCocoa::~BrowserWindowCocoa() { 62 BrowserWindowCocoa::~BrowserWindowCocoa() {
61 } 63 }
62 64
63 void BrowserWindowCocoa::Show() { 65 void BrowserWindowCocoa::Show() {
64 // The Browser associated with this browser window must become the active 66 // 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 67 // browser at the time |Show()| is called. This is the natural behaviour under
66 // Windows, but |-makeKeyAndOrderFront:| won't send |-windowDidBecomeMain:| 68 // 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)); 578 gfx::Rect bounds(NSRectToCGRect(frame));
577 bounds.set_y(NSHeight(monitorFrame) - bounds.y() - bounds.height()); 579 bounds.set_y(NSHeight(monitorFrame) - bounds.y() - bounds.height());
578 return bounds; 580 return bounds;
579 } 581 }
580 582
581 WindowOpenDisposition BrowserWindowCocoa::GetDispositionForPopupBounds( 583 WindowOpenDisposition BrowserWindowCocoa::GetDispositionForPopupBounds(
582 const gfx::Rect& bounds) { 584 const gfx::Rect& bounds) {
583 return NEW_POPUP; 585 return NEW_POPUP;
584 } 586 }
585 587
586 void BrowserWindowCocoa::Observe(NotificationType type, 588 void BrowserWindowCocoa::Observe(int type,
587 const NotificationSource& source, 589 const NotificationSource& source,
588 const NotificationDetails& details) { 590 const NotificationDetails& details) {
589 switch (type.value) { 591 switch (type) {
590 // Only the key window gets a direct toggle from the menu. 592 // Only the key window gets a direct toggle from the menu.
591 // Other windows hear about it from the notification. 593 // Other windows hear about it from the notification.
592 case NotificationType::BOOKMARK_BAR_VISIBILITY_PREF_CHANGED: 594 case chrome::NOTIFICATION_BOOKMARK_BAR_VISIBILITY_PREF_CHANGED:
593 [controller_ updateBookmarkBarVisibilityWithAnimation:YES]; 595 [controller_ updateBookmarkBarVisibilityWithAnimation:YES];
594 break; 596 break;
595 case NotificationType::SIDEBAR_CHANGED: 597 case chrome::NOTIFICATION_SIDEBAR_CHANGED:
596 UpdateSidebarForContents( 598 UpdateSidebarForContents(
597 Details<SidebarContainer>(details)->tab_contents()); 599 Details<SidebarContainer>(details)->tab_contents());
598 break; 600 break;
599 default: 601 default:
600 NOTREACHED(); // we don't ask for anything else! 602 NOTREACHED(); // we don't ask for anything else!
601 break; 603 break;
602 } 604 }
603 } 605 }
604 606
605 void BrowserWindowCocoa::DestroyBrowser() { 607 void BrowserWindowCocoa::DestroyBrowser() {
606 [controller_ destroyBrowser]; 608 [controller_ destroyBrowser];
607 609
608 // at this point the controller is dead (autoreleased), so 610 // at this point the controller is dead (autoreleased), so
609 // make sure we don't try to reference it any more. 611 // make sure we don't try to reference it any more.
610 } 612 }
611 613
612 NSWindow* BrowserWindowCocoa::window() const { 614 NSWindow* BrowserWindowCocoa::window() const {
613 return [controller_ window]; 615 return [controller_ window];
614 } 616 }
615 617
616 void BrowserWindowCocoa::UpdateSidebarForContents(TabContents* tab_contents) { 618 void BrowserWindowCocoa::UpdateSidebarForContents(TabContents* tab_contents) {
617 if (tab_contents == browser_->GetSelectedTabContents()) { 619 if (tab_contents == browser_->GetSelectedTabContents()) {
618 [controller_ updateSidebarForContents:tab_contents]; 620 [controller_ updateSidebarForContents:tab_contents];
619 } 621 }
620 } 622 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/browser_window_cocoa.h ('k') | chrome/browser/ui/cocoa/browser_window_cocoa_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698