| 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 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
| 12 #include "base/prefs/pref_service.h" | 13 #include "base/prefs/pref_service.h" |
| 13 #include "base/strings/sys_string_conversions.h" | 14 #include "base/strings/sys_string_conversions.h" |
| 14 #include "chrome/app/chrome_command_ids.h" | 15 #include "chrome/app/chrome_command_ids.h" |
| 15 #include "chrome/browser/chrome_notification_types.h" | 16 #include "chrome/browser/chrome_notification_types.h" |
| 16 #include "chrome/browser/download/download_shelf.h" | 17 #include "chrome/browser/download/download_shelf.h" |
| 17 #include "chrome/browser/extensions/tab_helper.h" | 18 #include "chrome/browser/extensions/tab_helper.h" |
| 18 #include "chrome/browser/fullscreen.h" | 19 #include "chrome/browser/fullscreen.h" |
| 19 #include "chrome/browser/password_manager/password_manager.h" | 20 #include "chrome/browser/password_manager/password_manager.h" |
| 20 #include "chrome/browser/profiles/profile.h" | 21 #include "chrome/browser/profiles/profile.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 | 61 |
| 61 #if defined(ENABLE_ONE_CLICK_SIGNIN) | 62 #if defined(ENABLE_ONE_CLICK_SIGNIN) |
| 62 #import "chrome/browser/ui/cocoa/one_click_signin_bubble_controller.h" | 63 #import "chrome/browser/ui/cocoa/one_click_signin_bubble_controller.h" |
| 63 #import "chrome/browser/ui/cocoa/one_click_signin_dialog_controller.h" | 64 #import "chrome/browser/ui/cocoa/one_click_signin_dialog_controller.h" |
| 64 #endif | 65 #endif |
| 65 | 66 |
| 66 using content::NativeWebKeyboardEvent; | 67 using content::NativeWebKeyboardEvent; |
| 67 using content::SSLStatus; | 68 using content::SSLStatus; |
| 68 using content::WebContents; | 69 using content::WebContents; |
| 69 | 70 |
| 70 // Replicate specific 10.7 SDK declarations for building with prior SDKs. | |
| 71 #if !defined(MAC_OS_X_VERSION_10_7) || \ | |
| 72 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7 | |
| 73 | |
| 74 enum { | |
| 75 NSWindowAnimationBehaviorDefault = 0, | |
| 76 NSWindowAnimationBehaviorNone = 2, | |
| 77 NSWindowAnimationBehaviorDocumentWindow = 3, | |
| 78 NSWindowAnimationBehaviorUtilityWindow = 4, | |
| 79 NSWindowAnimationBehaviorAlertPanel = 5 | |
| 80 }; | |
| 81 typedef NSInteger NSWindowAnimationBehavior; | |
| 82 | |
| 83 @interface NSWindow (LionSDKDeclarations) | |
| 84 - (NSWindowAnimationBehavior)animationBehavior; | |
| 85 - (void)setAnimationBehavior:(NSWindowAnimationBehavior)newAnimationBehavior; | |
| 86 @end | |
| 87 | |
| 88 #endif // MAC_OS_X_VERSION_10_7 | |
| 89 | |
| 90 namespace { | 71 namespace { |
| 91 | 72 |
| 92 NSPoint GetPointForBubble(content::WebContents* web_contents, | 73 NSPoint GetPointForBubble(content::WebContents* web_contents, |
| 93 int x_offset, | 74 int x_offset, |
| 94 int y_offset) { | 75 int y_offset) { |
| 95 NSView* view = web_contents->GetView()->GetNativeView(); | 76 NSView* view = web_contents->GetView()->GetNativeView(); |
| 96 NSRect bounds = [view bounds]; | 77 NSRect bounds = [view bounds]; |
| 97 NSPoint point; | 78 NSPoint point; |
| 98 point.x = NSMinX(bounds) + x_offset; | 79 point.x = NSMinX(bounds) + x_offset; |
| 99 // The view's origin is at the bottom but |rect|'s origin is at the top. | 80 // The view's origin is at the bottom but |rect|'s origin is at the top. |
| (...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 764 // further, both by another H, i.e. WebContentsView's height becomes | 745 // further, both by another H, i.e. WebContentsView's height becomes |
| 765 // A.height() + H and RenderWidgetHostView's height becomes A.height() + 2H. | 746 // A.height() + H and RenderWidgetHostView's height becomes A.height() + 2H. |
| 766 // Strangely, the RenderWidgetHostView for the previous navigation entry also | 747 // Strangely, the RenderWidgetHostView for the previous navigation entry also |
| 767 // gets enlarged by H. | 748 // gets enlarged by H. |
| 768 // I believe these "automatic" resizing are caused by setAutoresizingMask of | 749 // I believe these "automatic" resizing are caused by setAutoresizingMask of |
| 769 // of the cocoa view in WebContentsViewMac, which defeats the purpose of | 750 // of the cocoa view in WebContentsViewMac, which defeats the purpose of |
| 770 // WebContentsDelegate::GetSizeForNewRenderView i.e. to prevent resizing of | 751 // WebContentsDelegate::GetSizeForNewRenderView i.e. to prevent resizing of |
| 771 // RenderWidgetHostView in (2) and (3). | 752 // RenderWidgetHostView in (2) and (3). |
| 772 return 0; | 753 return 0; |
| 773 } | 754 } |
| OLD | NEW |