| 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 #include "base/mac/mac_util.h" | 10 #include "base/mac/mac_util.h" |
| 11 #import "base/mac/sdk_forward_declarations.h" | 11 #import "base/mac/sdk_forward_declarations.h" |
| 12 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
| 13 #include "base/prefs/pref_service.h" | 13 #include "base/prefs/pref_service.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/password_manager/password_manager.h" | 20 #include "chrome/browser/password_manager/password_manager.h" |
| 21 #include "chrome/browser/profiles/profile.h" | 21 #include "chrome/browser/profiles/profile.h" |
| 22 #include "chrome/browser/shell_integration.h" | 22 #include "chrome/browser/shell_integration.h" |
| 23 #include "chrome/browser/ui/browser.h" | 23 #include "chrome/browser/ui/browser.h" |
| 24 #include "chrome/browser/ui/browser_command_controller.h" | 24 #include "chrome/browser/ui/browser_command_controller.h" |
| 25 #include "chrome/browser/ui/browser_commands.h" | 25 #include "chrome/browser/ui/browser_commands_mac.h" |
| 26 #include "chrome/browser/ui/browser_list.h" | 26 #include "chrome/browser/ui/browser_list.h" |
| 27 #include "chrome/browser/ui/browser_window_state.h" | 27 #include "chrome/browser/ui/browser_window_state.h" |
| 28 #import "chrome/browser/ui/cocoa/browser/avatar_base_controller.h" | 28 #import "chrome/browser/ui/cocoa/browser/avatar_base_controller.h" |
| 29 #import "chrome/browser/ui/cocoa/browser/avatar_menu_bubble_controller.h" | 29 #import "chrome/browser/ui/cocoa/browser/avatar_menu_bubble_controller.h" |
| 30 #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" |
| 31 #import "chrome/browser/ui/cocoa/browser/password_generation_bubble_controller.h
" | 31 #import "chrome/browser/ui/cocoa/browser/password_generation_bubble_controller.h
" |
| 32 #import "chrome/browser/ui/cocoa/browser_window_controller.h" | 32 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
| 33 #import "chrome/browser/ui/cocoa/browser_window_utils.h" | 33 #import "chrome/browser/ui/cocoa/browser_window_utils.h" |
| 34 #import "chrome/browser/ui/cocoa/chrome_event_processing_window.h" | 34 #import "chrome/browser/ui/cocoa/chrome_event_processing_window.h" |
| 35 #import "chrome/browser/ui/cocoa/download/download_shelf_controller.h" | 35 #import "chrome/browser/ui/cocoa/download/download_shelf_controller.h" |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 | 129 |
| 130 [window() makeKeyAndOrderFront:controller_]; | 130 [window() makeKeyAndOrderFront:controller_]; |
| 131 | 131 |
| 132 // When creating windows from nibs it is necessary to |makeKeyAndOrderFront:| | 132 // When creating windows from nibs it is necessary to |makeKeyAndOrderFront:| |
| 133 // prior to |orderOut:| then |miniaturize:| when restoring windows in the | 133 // prior to |orderOut:| then |miniaturize:| when restoring windows in the |
| 134 // minimized state. | 134 // minimized state. |
| 135 if (initial_show_state_ == ui::SHOW_STATE_MINIMIZED) { | 135 if (initial_show_state_ == ui::SHOW_STATE_MINIMIZED) { |
| 136 [window() orderOut:controller_]; | 136 [window() orderOut:controller_]; |
| 137 [window() miniaturize:controller_]; | 137 [window() miniaturize:controller_]; |
| 138 } else if (initial_show_state_ == ui::SHOW_STATE_FULLSCREEN) { | 138 } else if (initial_show_state_ == ui::SHOW_STATE_FULLSCREEN) { |
| 139 chrome::ToggleFullscreenMode(browser_); | 139 chrome::ToggleFullscreenWithChromeOrFallback(browser_); |
| 140 } | 140 } |
| 141 initial_show_state_ = ui::SHOW_STATE_DEFAULT; | 141 initial_show_state_ = ui::SHOW_STATE_DEFAULT; |
| 142 | 142 |
| 143 // Restore window animation behavior. | 143 // Restore window animation behavior. |
| 144 if (did_save_animation_behavior) | 144 if (did_save_animation_behavior) |
| 145 [window() setAnimationBehavior:saved_animation_behavior]; | 145 [window() setAnimationBehavior:saved_animation_behavior]; |
| 146 | 146 |
| 147 browser_->OnWindowDidShow(); | 147 browser_->OnWindowDidShow(); |
| 148 } | 148 } |
| 149 | 149 |
| (...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 745 // further, both by another H, i.e. WebContentsView's height becomes | 745 // further, both by another H, i.e. WebContentsView's height becomes |
| 746 // A.height() + H and RenderWidgetHostView's height becomes A.height() + 2H. | 746 // A.height() + H and RenderWidgetHostView's height becomes A.height() + 2H. |
| 747 // Strangely, the RenderWidgetHostView for the previous navigation entry also | 747 // Strangely, the RenderWidgetHostView for the previous navigation entry also |
| 748 // gets enlarged by H. | 748 // gets enlarged by H. |
| 749 // I believe these "automatic" resizing are caused by setAutoresizingMask of | 749 // I believe these "automatic" resizing are caused by setAutoresizingMask of |
| 750 // of the cocoa view in WebContentsViewMac, which defeats the purpose of | 750 // of the cocoa view in WebContentsViewMac, which defeats the purpose of |
| 751 // WebContentsDelegate::GetSizeForNewRenderView i.e. to prevent resizing of | 751 // WebContentsDelegate::GetSizeForNewRenderView i.e. to prevent resizing of |
| 752 // RenderWidgetHostView in (2) and (3). | 752 // RenderWidgetHostView in (2) and (3). |
| 753 return 0; | 753 return 0; |
| 754 } | 754 } |
| OLD | NEW |