Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(74)

Side by Side Diff: chrome/browser/ui/cocoa/status_bubble_mac.mm

Issue 1917973002: mac: Remove IsOSLion(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/status_bubble_mac.h" 5 #include "chrome/browser/ui/cocoa/status_bubble_mac.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after
743 NSMaxX(actual_window_frame) - NSWidth(window_frame); 743 NSMaxX(actual_window_frame) - NSWidth(window_frame);
744 } 744 }
745 actual_window_frame.size.width = NSWidth(window_frame); 745 actual_window_frame.size.width = NSWidth(window_frame);
746 746
747 // Do not expand if it's going to cover mouse location. 747 // Do not expand if it's going to cover mouse location.
748 gfx::Point p = GetMouseLocation(); 748 gfx::Point p = GetMouseLocation();
749 if (NSPointInRect(NSMakePoint(p.x(), p.y()), actual_window_frame)) 749 if (NSPointInRect(NSMakePoint(p.x(), p.y()), actual_window_frame))
750 return; 750 return;
751 751
752 // Get the current corner flags and see what needs to change based on the 752 // Get the current corner flags and see what needs to change based on the
753 // expansion. This is only needed on Lion, which has rounded window bottoms. 753 // expansion.
754 if (base::mac::IsOSLionOrLater()) { 754 unsigned long corner_flags = [[window_ contentView] cornerFlags];
755 unsigned long corner_flags = [[window_ contentView] cornerFlags]; 755 corner_flags |= OSDependentCornerFlags(actual_window_frame);
756 corner_flags |= OSDependentCornerFlags(actual_window_frame); 756 [[window_ contentView] setCornerFlags:corner_flags];
757 [[window_ contentView] setCornerFlags:corner_flags]; 757
758 }
759 758
760 [NSAnimationContext beginGrouping]; 759 [NSAnimationContext beginGrouping];
761 [[NSAnimationContext currentContext] setDuration:kExpansionDurationSeconds]; 760 [[NSAnimationContext currentContext] setDuration:kExpansionDurationSeconds];
762 [[window_ animator] setFrame:actual_window_frame display:YES]; 761 [[window_ animator] setFrame:actual_window_frame display:YES];
763 [NSAnimationContext endGrouping]; 762 [NSAnimationContext endGrouping];
764 } 763 }
765 764
766 void StatusBubbleMac::UpdateSizeAndPosition() { 765 void StatusBubbleMac::UpdateSizeAndPosition() {
767 if (!window_) 766 if (!window_)
768 return; 767 return;
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
826 size.width = kWindowWidthPercent * screenRect.size.width; 825 size.width = kWindowWidthPercent * screenRect.size.width;
827 } 826 }
828 827
829 screenRect.size = size; 828 screenRect.size = size;
830 return screenRect; 829 return screenRect;
831 } 830 }
832 831
833 unsigned long StatusBubbleMac::OSDependentCornerFlags(NSRect window_frame) { 832 unsigned long StatusBubbleMac::OSDependentCornerFlags(NSRect window_frame) {
834 unsigned long corner_flags = 0; 833 unsigned long corner_flags = 0;
835 834
836 if (base::mac::IsOSLionOrLater()) { 835 NSRect parent_frame = [parent_ frame];
837 NSRect parent_frame = [parent_ frame];
838 836
839 // Round the bottom corners when they're right up against the 837 // Round the bottom corners when they're right up against the
840 // corresponding edge of the parent window, or when below the parent 838 // corresponding edge of the parent window, or when below the parent
841 // window. 839 // window.
842 if (NSMinY(window_frame) <= NSMinY(parent_frame)) { 840 if (NSMinY(window_frame) <= NSMinY(parent_frame)) {
843 if (NSMinX(window_frame) == NSMinX(parent_frame)) { 841 if (NSMinX(window_frame) == NSMinX(parent_frame)) {
844 corner_flags |= kRoundedBottomLeftCorner; 842 corner_flags |= kRoundedBottomLeftCorner;
845 }
846
847 if (NSMaxX(window_frame) == NSMaxX(parent_frame)) {
848 corner_flags |= kRoundedBottomRightCorner;
849 }
850 } 843 }
851 844
852 // Round the top corners when the bubble is below the parent window. 845 if (NSMaxX(window_frame) == NSMaxX(parent_frame)) {
853 if (NSMinY(window_frame) < NSMinY(parent_frame)) { 846 corner_flags |= kRoundedBottomRightCorner;
854 corner_flags |= kRoundedTopLeftCorner | kRoundedTopRightCorner;
855 } 847 }
856 } 848 }
857 849
850 // Round the top corners when the bubble is below the parent window.
851 if (NSMinY(window_frame) < NSMinY(parent_frame)) {
852 corner_flags |= kRoundedTopLeftCorner | kRoundedTopRightCorner;
853 }
854
858 return corner_flags; 855 return corner_flags;
859 } 856 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698