| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/omnibox/omnibox_popup_view_mac.h" | 5 #include "chrome/browser/ui/cocoa/omnibox/omnibox_popup_view_mac.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
| 10 #include "base/sys_string_conversions.h" | 10 #include "base/sys_string_conversions.h" |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 [popup_ setHasShadow:YES]; | 337 [popup_ setHasShadow:YES]; |
| 338 [popup_ setLevel:NSNormalWindowLevel]; | 338 [popup_ setLevel:NSNormalWindowLevel]; |
| 339 | 339 |
| 340 scoped_nsobject<AutocompleteMatrix> matrix( | 340 scoped_nsobject<AutocompleteMatrix> matrix( |
| 341 [[AutocompleteMatrix alloc] initWithPopupView:this]); | 341 [[AutocompleteMatrix alloc] initWithPopupView:this]); |
| 342 scoped_nsobject<OmniboxPopupView> contentView( | 342 scoped_nsobject<OmniboxPopupView> contentView( |
| 343 [[OmniboxPopupView alloc] initWithFrame:NSZeroRect]); | 343 [[OmniboxPopupView alloc] initWithFrame:NSZeroRect]); |
| 344 | 344 |
| 345 [contentView addSubview:matrix]; | 345 [contentView addSubview:matrix]; |
| 346 [popup_ setContentView:contentView]; | 346 [popup_ setContentView:contentView]; |
| 347 |
| 348 // TODO(dtseng): Ignore until we provide NSAccessibility support. |
| 349 [popup_ accessibilitySetOverrideValue:NSAccessibilityUnknownRole |
| 350 forAttribute:NSAccessibilityRoleAttribute]; |
| 347 } | 351 } |
| 348 } | 352 } |
| 349 | 353 |
| 350 void OmniboxPopupViewMac::PositionPopup(const CGFloat matrixHeight) { | 354 void OmniboxPopupViewMac::PositionPopup(const CGFloat matrixHeight) { |
| 351 // Calculate the popup's position on the screen. It should abut the | 355 // Calculate the popup's position on the screen. It should abut the |
| 352 // field's visual border vertically, and be below the bounds | 356 // field's visual border vertically, and be below the bounds |
| 353 // horizontally. | 357 // horizontally. |
| 354 | 358 |
| 355 // Start with the field's rect on the screen. | 359 // Start with the field's rect on the screen. |
| 356 NSRect popupFrame = NSInsetRect([field_ bounds], 0.0, kFieldVisualInset); | 360 NSRect popupFrame = NSInsetRect([field_ bounds], 0.0, kFieldVisualInset); |
| (...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 820 bottomLeftCornerRadius:kPopupRoundingRadius | 824 bottomLeftCornerRadius:kPopupRoundingRadius |
| 821 bottomRightCornerRadius:kPopupRoundingRadius]; | 825 bottomRightCornerRadius:kPopupRoundingRadius]; |
| 822 | 826 |
| 823 // Draw the matrix clipped to our border. | 827 // Draw the matrix clipped to our border. |
| 824 gfx::ScopedNSGraphicsContextSaveGState scopedGState; | 828 gfx::ScopedNSGraphicsContextSaveGState scopedGState; |
| 825 [path addClip]; | 829 [path addClip]; |
| 826 [super drawRect:rect]; | 830 [super drawRect:rect]; |
| 827 } | 831 } |
| 828 | 832 |
| 829 @end | 833 @end |
| OLD | NEW |