| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/cocoa/browser_window_cocoa.h" | 5 #include "chrome/browser/cocoa/browser_window_cocoa.h" |
| 6 | 6 |
| 7 #include "app/l10n_util_mac.h" | 7 #include "app/l10n_util_mac.h" |
| 8 #include "base/command_line.h" |
| 8 #include "base/logging.h" | 9 #include "base/logging.h" |
| 9 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| 10 #include "base/sys_string_conversions.h" | 11 #include "base/sys_string_conversions.h" |
| 11 #include "chrome/app/chrome_dll_resource.h" | 12 #include "chrome/app/chrome_dll_resource.h" |
| 12 #include "chrome/browser/bookmarks/bookmark_utils.h" | 13 #include "chrome/browser/bookmarks/bookmark_utils.h" |
| 13 #include "chrome/browser/browser.h" | 14 #include "chrome/browser/browser.h" |
| 14 #include "chrome/browser/browser_list.h" | 15 #include "chrome/browser/browser_list.h" |
| 15 #import "chrome/browser/cocoa/browser_window_controller.h" | 16 #import "chrome/browser/cocoa/browser_window_controller.h" |
| 16 #import "chrome/browser/cocoa/bug_report_window_controller.h" | 17 #import "chrome/browser/cocoa/bug_report_window_controller.h" |
| 17 #import "chrome/browser/cocoa/chrome_browser_window.h" | 18 #import "chrome/browser/cocoa/chrome_browser_window.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 30 #include "chrome/browser/cocoa/restart_browser.h" | 31 #include "chrome/browser/cocoa/restart_browser.h" |
| 31 #include "chrome/browser/cocoa/status_bubble_mac.h" | 32 #include "chrome/browser/cocoa/status_bubble_mac.h" |
| 32 #include "chrome/browser/cocoa/task_manager_mac.h" | 33 #include "chrome/browser/cocoa/task_manager_mac.h" |
| 33 #import "chrome/browser/cocoa/theme_install_bubble_view.h" | 34 #import "chrome/browser/cocoa/theme_install_bubble_view.h" |
| 34 #import "chrome/browser/cocoa/toolbar_controller.h" | 35 #import "chrome/browser/cocoa/toolbar_controller.h" |
| 35 #include "chrome/browser/download/download_shelf.h" | 36 #include "chrome/browser/download/download_shelf.h" |
| 36 #include "chrome/browser/global_keyboard_shortcuts_mac.h" | 37 #include "chrome/browser/global_keyboard_shortcuts_mac.h" |
| 37 #include "chrome/browser/pref_service.h" | 38 #include "chrome/browser/pref_service.h" |
| 38 #include "chrome/browser/profile.h" | 39 #include "chrome/browser/profile.h" |
| 39 #include "chrome/browser/tab_contents/tab_contents.h" | 40 #include "chrome/browser/tab_contents/tab_contents.h" |
| 41 #include "chrome/common/chrome_switches.h" |
| 40 #include "chrome/common/native_web_keyboard_event.h" | 42 #include "chrome/common/native_web_keyboard_event.h" |
| 41 #include "chrome/common/notification_service.h" | 43 #include "chrome/common/notification_service.h" |
| 42 #include "chrome/common/pref_names.h" | 44 #include "chrome/common/pref_names.h" |
| 43 #include "gfx/rect.h" | 45 #include "gfx/rect.h" |
| 44 #include "grit/chromium_strings.h" | 46 #include "grit/chromium_strings.h" |
| 45 #include "grit/generated_resources.h" | 47 #include "grit/generated_resources.h" |
| 46 | 48 |
| 47 BrowserWindowCocoa::BrowserWindowCocoa(Browser* browser, | 49 BrowserWindowCocoa::BrowserWindowCocoa(Browser* browser, |
| 48 BrowserWindowController* controller, | 50 BrowserWindowController* controller, |
| 49 NSWindow* window) | 51 NSWindow* window) |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 } | 390 } |
| 389 | 391 |
| 390 void BrowserWindowCocoa::TabContentsFocused(TabContents* tab_contents) { | 392 void BrowserWindowCocoa::TabContentsFocused(TabContents* tab_contents) { |
| 391 NOTIMPLEMENTED(); | 393 NOTIMPLEMENTED(); |
| 392 } | 394 } |
| 393 | 395 |
| 394 void BrowserWindowCocoa::ShowPageInfo(Profile* profile, | 396 void BrowserWindowCocoa::ShowPageInfo(Profile* profile, |
| 395 const GURL& url, | 397 const GURL& url, |
| 396 const NavigationEntry::SSLStatus& ssl, | 398 const NavigationEntry::SSLStatus& ssl, |
| 397 bool show_history) { | 399 bool show_history) { |
| 398 PageInfoWindowMac::ShowPageInfo(profile, url, ssl, show_history); | 400 const CommandLine* command_line(CommandLine::ForCurrentProcess()); |
| 401 if (command_line->HasSwitch(switches::kEnableNewPageInfoBubble)) |
| 402 browser::ShowPageInfoBubble(window(), profile, url, ssl, show_history); |
| 403 else |
| 404 browser::ShowPageInfo(window(), profile, url, ssl, show_history); |
| 399 } | 405 } |
| 400 | 406 |
| 401 void BrowserWindowCocoa::ShowAppMenu() { | 407 void BrowserWindowCocoa::ShowAppMenu() { |
| 402 // No-op. Mac doesn't support showing the menus via alt keys. | 408 // No-op. Mac doesn't support showing the menus via alt keys. |
| 403 } | 409 } |
| 404 | 410 |
| 405 bool BrowserWindowCocoa::PreHandleKeyboardEvent( | 411 bool BrowserWindowCocoa::PreHandleKeyboardEvent( |
| 406 const NativeWebKeyboardEvent& event, bool* is_keyboard_shortcut) { | 412 const NativeWebKeyboardEvent& event, bool* is_keyboard_shortcut) { |
| 407 if (event.skip_in_browser || event.type == NativeWebKeyboardEvent::Char) | 413 if (event.skip_in_browser || event.type == NativeWebKeyboardEvent::Char) |
| 408 return false; | 414 return false; |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 572 void BrowserWindowCocoa::DestroyBrowser() { | 578 void BrowserWindowCocoa::DestroyBrowser() { |
| 573 [controller_ destroyBrowser]; | 579 [controller_ destroyBrowser]; |
| 574 | 580 |
| 575 // at this point the controller is dead (autoreleased), so | 581 // at this point the controller is dead (autoreleased), so |
| 576 // make sure we don't try to reference it any more. | 582 // make sure we don't try to reference it any more. |
| 577 } | 583 } |
| 578 | 584 |
| 579 NSWindow* BrowserWindowCocoa::window() const { | 585 NSWindow* BrowserWindowCocoa::window() const { |
| 580 return [controller_ window]; | 586 return [controller_ window]; |
| 581 } | 587 } |
| OLD | NEW |