| 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/mac/mac_util.h" | |
| 11 #include "base/sys_string_conversions.h" | 10 #include "base/sys_string_conversions.h" |
| 12 #include "chrome/app/chrome_command_ids.h" | 11 #include "chrome/app/chrome_command_ids.h" |
| 13 #include "chrome/browser/bookmarks/bookmark_utils.h" | 12 #include "chrome/browser/bookmarks/bookmark_utils.h" |
| 14 #include "chrome/browser/download/download_shelf.h" | 13 #include "chrome/browser/download/download_shelf.h" |
| 15 #include "chrome/browser/global_keyboard_shortcuts_mac.h" | 14 #include "chrome/browser/global_keyboard_shortcuts_mac.h" |
| 16 #include "chrome/browser/page_info_window.h" | 15 #include "chrome/browser/page_info_window.h" |
| 17 #include "chrome/browser/prefs/pref_service.h" | 16 #include "chrome/browser/prefs/pref_service.h" |
| 18 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
| 19 #include "chrome/browser/sidebar/sidebar_container.h" | 18 #include "chrome/browser/sidebar/sidebar_container.h" |
| 20 #include "chrome/browser/sidebar/sidebar_manager.h" | 19 #include "chrome/browser/sidebar/sidebar_manager.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 34 #import "chrome/browser/ui/cocoa/options/edit_search_engine_cocoa_controller.h" | 33 #import "chrome/browser/ui/cocoa/options/edit_search_engine_cocoa_controller.h" |
| 35 #import "chrome/browser/ui/cocoa/options/keyword_editor_cocoa_controller.h" | 34 #import "chrome/browser/ui/cocoa/options/keyword_editor_cocoa_controller.h" |
| 36 #import "chrome/browser/ui/cocoa/nsmenuitem_additions.h" | 35 #import "chrome/browser/ui/cocoa/nsmenuitem_additions.h" |
| 37 #include "chrome/browser/ui/cocoa/repost_form_warning_mac.h" | 36 #include "chrome/browser/ui/cocoa/repost_form_warning_mac.h" |
| 38 #include "chrome/browser/ui/cocoa/restart_browser.h" | 37 #include "chrome/browser/ui/cocoa/restart_browser.h" |
| 39 #include "chrome/browser/ui/cocoa/status_bubble_mac.h" | 38 #include "chrome/browser/ui/cocoa/status_bubble_mac.h" |
| 40 #include "chrome/browser/ui/cocoa/task_manager_mac.h" | 39 #include "chrome/browser/ui/cocoa/task_manager_mac.h" |
| 41 #import "chrome/browser/ui/cocoa/theme_install_bubble_view.h" | 40 #import "chrome/browser/ui/cocoa/theme_install_bubble_view.h" |
| 42 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" | 41 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h" |
| 43 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 42 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 43 #include "chrome/browser/ui/window_snapshot/window_snapshot.h" |
| 44 #include "chrome/common/native_web_keyboard_event.h" | 44 #include "chrome/common/native_web_keyboard_event.h" |
| 45 #include "chrome/common/notification_service.h" | 45 #include "chrome/common/notification_service.h" |
| 46 #include "chrome/common/pref_names.h" | 46 #include "chrome/common/pref_names.h" |
| 47 #include "gfx/rect.h" | 47 #include "gfx/rect.h" |
| 48 #include "grit/chromium_strings.h" | 48 #include "grit/chromium_strings.h" |
| 49 #include "grit/generated_resources.h" | 49 #include "grit/generated_resources.h" |
| 50 #include "ui/base/l10n/l10n_util_mac.h" | 50 #include "ui/base/l10n/l10n_util_mac.h" |
| 51 | 51 |
| 52 BrowserWindowCocoa::BrowserWindowCocoa(Browser* browser, | 52 BrowserWindowCocoa::BrowserWindowCocoa(Browser* browser, |
| 53 BrowserWindowController* controller, | 53 BrowserWindowController* controller, |
| (...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 596 NSRect monitorFrame = [screen frame]; | 596 NSRect monitorFrame = [screen frame]; |
| 597 NSRect frame = [controller_ instantFrame]; | 597 NSRect frame = [controller_ instantFrame]; |
| 598 gfx::Rect bounds(NSRectToCGRect(frame)); | 598 gfx::Rect bounds(NSRectToCGRect(frame)); |
| 599 bounds.set_y(NSHeight(monitorFrame) - bounds.y() - bounds.height()); | 599 bounds.set_y(NSHeight(monitorFrame) - bounds.y() - bounds.height()); |
| 600 return bounds; | 600 return bounds; |
| 601 } | 601 } |
| 602 | 602 |
| 603 gfx::Rect BrowserWindowCocoa::GrabWindowSnapshot(std::vector<unsigned char>* | 603 gfx::Rect BrowserWindowCocoa::GrabWindowSnapshot(std::vector<unsigned char>* |
| 604 png_representation) { | 604 png_representation) { |
| 605 int width = 0, height = 0; | 605 int width = 0, height = 0; |
| 606 base::mac::GrabWindowSnapshot(window(), png_representation, &width, &height); | 606 browser::GrabWindowSnapshot(window(), png_representation, &width, &height); |
| 607 return gfx::Rect(width, height); | 607 return gfx::Rect(width, height); |
| 608 } | 608 } |
| 609 | 609 |
| 610 void BrowserWindowCocoa::Observe(NotificationType type, | 610 void BrowserWindowCocoa::Observe(NotificationType type, |
| 611 const NotificationSource& source, | 611 const NotificationSource& source, |
| 612 const NotificationDetails& details) { | 612 const NotificationDetails& details) { |
| 613 switch (type.value) { | 613 switch (type.value) { |
| 614 // Only the key window gets a direct toggle from the menu. | 614 // Only the key window gets a direct toggle from the menu. |
| 615 // Other windows hear about it from the notification. | 615 // Other windows hear about it from the notification. |
| 616 case NotificationType::BOOKMARK_BAR_VISIBILITY_PREF_CHANGED: | 616 case NotificationType::BOOKMARK_BAR_VISIBILITY_PREF_CHANGED: |
| (...skipping 18 matching lines...) Expand all Loading... |
| 635 | 635 |
| 636 NSWindow* BrowserWindowCocoa::window() const { | 636 NSWindow* BrowserWindowCocoa::window() const { |
| 637 return [controller_ window]; | 637 return [controller_ window]; |
| 638 } | 638 } |
| 639 | 639 |
| 640 void BrowserWindowCocoa::UpdateSidebarForContents(TabContents* tab_contents) { | 640 void BrowserWindowCocoa::UpdateSidebarForContents(TabContents* tab_contents) { |
| 641 if (tab_contents == browser_->GetSelectedTabContents()) { | 641 if (tab_contents == browser_->GetSelectedTabContents()) { |
| 642 [controller_ updateSidebarForContents:tab_contents]; | 642 [controller_ updateSidebarForContents:tab_contents]; |
| 643 } | 643 } |
| 644 } | 644 } |
| OLD | NEW |