Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #import "base/mac/sdk_forward_declarations.h" | 10 #import "base/mac/sdk_forward_declarations.h" |
| 11 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
| 12 #include "base/prefs/pref_service.h" | 12 #include "base/prefs/pref_service.h" |
| 13 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
| 14 #include "base/strings/sys_string_conversions.h" | 14 #include "base/strings/sys_string_conversions.h" |
| 15 #include "chrome/app/chrome_command_ids.h" | 15 #include "chrome/app/chrome_command_ids.h" |
| 16 #include "chrome/browser/chrome_notification_types.h" | 16 #include "chrome/browser/chrome_notification_types.h" |
| 17 #include "chrome/browser/download/download_shelf.h" | 17 #include "chrome/browser/download/download_shelf.h" |
| 18 #include "chrome/browser/extensions/tab_helper.h" | 18 #include "chrome/browser/extensions/tab_helper.h" |
| 19 #include "chrome/browser/fullscreen.h" | 19 #include "chrome/browser/fullscreen.h" |
| 20 #include "chrome/browser/profiles/profile.h" | 20 #include "chrome/browser/profiles/profile.h" |
| 21 #include "chrome/browser/shell_integration.h" | 21 #include "chrome/browser/shell_integration.h" |
| 22 #include "chrome/browser/signin/chrome_signin_helper.h" | 22 #include "chrome/browser/signin/chrome_signin_helper.h" |
| 23 #include "chrome/browser/translate/chrome_translate_client.h" | 23 #include "chrome/browser/translate/chrome_translate_client.h" |
| 24 #include "chrome/browser/ui/browser.h" | 24 #include "chrome/browser/ui/browser.h" |
| 25 #include "chrome/browser/ui/browser_command_controller.h" | 25 #include "chrome/browser/ui/browser_command_controller.h" |
| 26 #include "chrome/browser/ui/browser_commands_mac.h" | 26 #include "chrome/browser/ui/browser_commands_mac.h" |
| 27 #include "chrome/browser/ui/browser_dialogs.h" | |
| 27 #include "chrome/browser/ui/browser_list.h" | 28 #include "chrome/browser/ui/browser_list.h" |
| 28 #include "chrome/browser/ui/browser_window_state.h" | 29 #include "chrome/browser/ui/browser_window_state.h" |
| 29 #import "chrome/browser/ui/cocoa/browser/edit_search_engine_cocoa_controller.h" | 30 #import "chrome/browser/ui/cocoa/browser/edit_search_engine_cocoa_controller.h" |
| 30 #import "chrome/browser/ui/cocoa/browser_window_controller.h" | 31 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
| 31 #import "chrome/browser/ui/cocoa/browser_window_utils.h" | 32 #import "chrome/browser/ui/cocoa/browser_window_utils.h" |
| 32 #import "chrome/browser/ui/cocoa/chrome_event_processing_window.h" | 33 #import "chrome/browser/ui/cocoa/chrome_event_processing_window.h" |
| 33 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_con troller.h" | 34 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_con troller.h" |
| 34 #import "chrome/browser/ui/cocoa/download/download_shelf_controller.h" | 35 #import "chrome/browser/ui/cocoa/download/download_shelf_controller.h" |
| 35 #include "chrome/browser/ui/cocoa/find_bar/find_bar_bridge.h" | 36 #include "chrome/browser/ui/cocoa/find_bar/find_bar_bridge.h" |
| 36 #import "chrome/browser/ui/cocoa/info_bubble_view.h" | 37 #import "chrome/browser/ui/cocoa/info_bubble_view.h" |
| (...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 692 | 693 |
| 693 void BrowserWindowCocoa::UserChangedTheme() { | 694 void BrowserWindowCocoa::UserChangedTheme() { |
| 694 [controller_ userChangedTheme]; | 695 [controller_ userChangedTheme]; |
| 695 } | 696 } |
| 696 | 697 |
| 697 void BrowserWindowCocoa::ShowWebsiteSettings( | 698 void BrowserWindowCocoa::ShowWebsiteSettings( |
| 698 Profile* profile, | 699 Profile* profile, |
| 699 content::WebContents* web_contents, | 700 content::WebContents* web_contents, |
| 700 const GURL& url, | 701 const GURL& url, |
| 701 const content::SSLStatus& ssl) { | 702 const content::SSLStatus& ssl) { |
| 703 if (chrome::ToolkitViewsDialogsEnabled()) { | |
| 704 LocationBarViewMac* location_bar = [controller_ locationBarBridge]; | |
|
tapted
2015/08/10 05:44:23
I think this needs to move to website_settings_bub
jackhou1
2015/08/10 09:11:09
Done.
| |
| 705 NSPoint bubble_point = location_bar->GetPageInfoBubblePoint(); | |
| 706 NSPoint bubble_point_screen = [window() convertBaseToScreen:bubble_point]; | |
| 707 gfx::Point bubble_point_views( | |
| 708 bubble_point_screen.x, | |
| 709 NSMaxY([[window() screen] frame]) - bubble_point_screen.y); | |
|
tapted
2015/08/10 05:44:24
I don't think this is right -- flipping always nee
jackhou1
2015/08/10 09:11:09
Done.
| |
| 710 | |
| 711 chrome::ShowWebsiteSettingsBubbleViewsAtPoint( | |
| 712 bubble_point_views, profile, web_contents, url, ssl, browser_); | |
|
tapted
2015/08/10 05:44:23
I think the browser_ argument can be refactored ou
jackhou1
2015/08/10 09:11:09
Done in https://codereview.chromium.org/1268243003
| |
| 713 return; | |
| 714 } | |
| 715 | |
| 702 WebsiteSettingsUIBridge::Show(window(), profile, web_contents, url, ssl); | 716 WebsiteSettingsUIBridge::Show(window(), profile, web_contents, url, ssl); |
| 703 } | 717 } |
| 704 | 718 |
| 705 void BrowserWindowCocoa::ShowAppMenu() { | 719 void BrowserWindowCocoa::ShowAppMenu() { |
| 706 // No-op. Mac doesn't support showing the menus via alt keys. | 720 // No-op. Mac doesn't support showing the menus via alt keys. |
| 707 } | 721 } |
| 708 | 722 |
| 709 bool BrowserWindowCocoa::PreHandleKeyboardEvent( | 723 bool BrowserWindowCocoa::PreHandleKeyboardEvent( |
| 710 const NativeWebKeyboardEvent& event, bool* is_keyboard_shortcut) { | 724 const NativeWebKeyboardEvent& event, bool* is_keyboard_shortcut) { |
| 711 // Handle ESC to dismiss permission bubbles, but still forward it | 725 // Handle ESC to dismiss permission bubbles, but still forward it |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 845 void BrowserWindowCocoa::UnhideDownloadShelf() { | 859 void BrowserWindowCocoa::UnhideDownloadShelf() { |
| 846 GetDownloadShelf()->Unhide(); | 860 GetDownloadShelf()->Unhide(); |
| 847 } | 861 } |
| 848 | 862 |
| 849 void BrowserWindowCocoa::HideDownloadShelf() { | 863 void BrowserWindowCocoa::HideDownloadShelf() { |
| 850 GetDownloadShelf()->Hide(); | 864 GetDownloadShelf()->Hide(); |
| 851 StatusBubble* statusBubble = GetStatusBubble(); | 865 StatusBubble* statusBubble = GetStatusBubble(); |
| 852 if (statusBubble) | 866 if (statusBubble) |
| 853 statusBubble->Hide(); | 867 statusBubble->Hide(); |
| 854 } | 868 } |
| OLD | NEW |