| 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/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/mac/mac_util.h" | 9 #include "base/mac/mac_util.h" |
| 10 #import "base/mac/sdk_forward_declarations.h" | 10 #import "base/mac/sdk_forward_declarations.h" |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 NSRect anchor_rect_base = [controller omniboxPopupAnchorRect]; | 196 NSRect anchor_rect_base = [controller omniboxPopupAnchorRect]; |
| 197 | 197 |
| 198 // Calculate the popup's position on the screen. | 198 // Calculate the popup's position on the screen. |
| 199 NSRect popup_frame = anchor_rect_base; | 199 NSRect popup_frame = anchor_rect_base; |
| 200 // Size to fit the matrix and shift down by the size. | 200 // Size to fit the matrix and shift down by the size. |
| 201 popup_frame.size.height = matrixHeight + kPopupPaddingVertical * 2.0; | 201 popup_frame.size.height = matrixHeight + kPopupPaddingVertical * 2.0; |
| 202 popup_frame.size.height += [OmniboxPopupTopSeparatorView preferredHeight]; | 202 popup_frame.size.height += [OmniboxPopupTopSeparatorView preferredHeight]; |
| 203 popup_frame.size.height += [OmniboxPopupBottomSeparatorView preferredHeight]; | 203 popup_frame.size.height += [OmniboxPopupBottomSeparatorView preferredHeight]; |
| 204 popup_frame.origin.y -= NSHeight(popup_frame); | 204 popup_frame.origin.y -= NSHeight(popup_frame); |
| 205 // Shift to screen coordinates. | 205 // Shift to screen coordinates. |
| 206 popup_frame.origin = | 206 popup_frame = [[controller window] convertRectToScreen:popup_frame]; |
| 207 [[controller window] convertBaseToScreen:popup_frame.origin]; | |
| 208 | 207 |
| 209 // Top separator. | 208 // Top separator. |
| 210 NSRect top_separator_frame = NSZeroRect; | 209 NSRect top_separator_frame = NSZeroRect; |
| 211 top_separator_frame.size.width = NSWidth(popup_frame); | 210 top_separator_frame.size.width = NSWidth(popup_frame); |
| 212 top_separator_frame.size.height = | 211 top_separator_frame.size.height = |
| 213 [OmniboxPopupTopSeparatorView preferredHeight]; | 212 [OmniboxPopupTopSeparatorView preferredHeight]; |
| 214 [top_separator_view_ setFrame:top_separator_frame]; | 213 [top_separator_view_ setFrame:top_separator_frame]; |
| 215 | 214 |
| 216 // Bottom separator. | 215 // Bottom separator. |
| 217 NSRect bottom_separator_frame = NSZeroRect; | 216 NSRect bottom_separator_frame = NSZeroRect; |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 IDR_OMNIBOX_STAR : AutocompleteMatch::TypeToIcon(match.type); | 308 IDR_OMNIBOX_STAR : AutocompleteMatch::TypeToIcon(match.type); |
| 310 return OmniboxViewMac::ImageForResource(resource_id); | 309 return OmniboxViewMac::ImageForResource(resource_id); |
| 311 } | 310 } |
| 312 | 311 |
| 313 void OmniboxPopupViewMac::OpenURLForRow(size_t row, | 312 void OmniboxPopupViewMac::OpenURLForRow(size_t row, |
| 314 WindowOpenDisposition disposition) { | 313 WindowOpenDisposition disposition) { |
| 315 DCHECK_LT(row, GetResult().size()); | 314 DCHECK_LT(row, GetResult().size()); |
| 316 omnibox_view_->OpenMatch(GetResult().match_at(row), disposition, GURL(), | 315 omnibox_view_->OpenMatch(GetResult().match_at(row), disposition, GURL(), |
| 317 base::string16(), row); | 316 base::string16(), row); |
| 318 } | 317 } |
| OLD | NEW |