| 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 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 NSRect background_rect = NSZeroRect; | 253 NSRect background_rect = NSZeroRect; |
| 254 background_rect.size.width = NSWidth(popup_frame); | 254 background_rect.size.width = NSWidth(popup_frame); |
| 255 background_rect.size.height = NSHeight(popup_frame) - | 255 background_rect.size.height = NSHeight(popup_frame) - |
| 256 NSHeight(top_separator_frame) - NSHeight(bottom_separator_frame); | 256 NSHeight(top_separator_frame) - NSHeight(bottom_separator_frame); |
| 257 background_rect.origin.y = NSMaxY(top_separator_frame); | 257 background_rect.origin.y = NSMaxY(top_separator_frame); |
| 258 [background_view_ setFrame:background_rect]; | 258 [background_view_ setFrame:background_rect]; |
| 259 | 259 |
| 260 // In Material Design, the table is the width of the window. In non-MD, | 260 // In Material Design, the table is the width of the window. In non-MD, |
| 261 // calculate the width of the table based on backing out the popup's border | 261 // calculate the width of the table based on backing out the popup's border |
| 262 // from the width of the field. | 262 // from the width of the field. |
| 263 CGFloat table_width = NSWidth([background_view_ bounds]); | 263 CGFloat table_width = NSWidth([[[field_ window] contentView] bounds]); |
| 264 bool is_mode_material = ui::MaterialDesignController::IsModeMaterial(); | 264 bool is_mode_material = ui::MaterialDesignController::IsModeMaterial(); |
| 265 if (!is_mode_material) { | 265 if (!is_mode_material) { |
| 266 table_width = NSWidth([field_ bounds]); | 266 table_width = NSWidth([field_ bounds]); |
| 267 } | 267 } |
| 268 DCHECK_GT(table_width, 0.0); | 268 DCHECK_GT(table_width, 0.0); |
| 269 | 269 |
| 270 // Matrix. | 270 // Matrix. |
| 271 NSPoint field_origin_base = | 271 NSPoint field_origin_base = |
| 272 [field_ convertPoint:[field_ bounds].origin toView:nil]; | 272 [field_ convertPoint:[field_ bounds].origin toView:nil]; |
| 273 NSRect matrix_frame = NSZeroRect; | 273 NSRect matrix_frame = NSZeroRect; |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 return NSImageFromImageSkia( | 359 return NSImageFromImageSkia( |
| 360 gfx::CreateVectorIcon(vector_icon_id, kIconSize, icon_color)); | 360 gfx::CreateVectorIcon(vector_icon_id, kIconSize, icon_color)); |
| 361 } | 361 } |
| 362 | 362 |
| 363 void OmniboxPopupViewMac::OpenURLForRow(size_t row, | 363 void OmniboxPopupViewMac::OpenURLForRow(size_t row, |
| 364 WindowOpenDisposition disposition) { | 364 WindowOpenDisposition disposition) { |
| 365 DCHECK_LT(row, GetResult().size()); | 365 DCHECK_LT(row, GetResult().size()); |
| 366 omnibox_view_->OpenMatch(GetResult().match_at(row), disposition, GURL(), | 366 omnibox_view_->OpenMatch(GetResult().match_at(row), disposition, GURL(), |
| 367 base::string16(), row); | 367 base::string16(), row); |
| 368 } | 368 } |
| OLD | NEW |