| 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 return; | 108 return; |
| 109 } | 109 } |
| 110 | 110 |
| 111 CreatePopupIfNeeded(); | 111 CreatePopupIfNeeded(); |
| 112 | 112 |
| 113 NSImage* answerImage = nil; | 113 NSImage* answerImage = nil; |
| 114 if (!model_->answer_bitmap().isNull()) { | 114 if (!model_->answer_bitmap().isNull()) { |
| 115 answerImage = | 115 answerImage = |
| 116 gfx::Image::CreateFrom1xBitmap(model_->answer_bitmap()).CopyNSImage(); | 116 gfx::Image::CreateFrom1xBitmap(model_->answer_bitmap()).CopyNSImage(); |
| 117 } | 117 } |
| 118 [matrix_ setController:[[OmniboxPopupTableController alloc] | 118 [matrix_ setController:[[[OmniboxPopupTableController alloc] |
| 119 initWithMatchResults:result | 119 initWithMatchResults:result |
| 120 tableView:matrix_ | 120 tableView:matrix_ |
| 121 popupView:*this | 121 popupView:*this |
| 122 answerImage:answerImage]]; | 122 answerImage:answerImage] autorelease]]; |
| 123 BOOL is_dark_theme = [matrix_ hasDarkTheme]; | 123 BOOL is_dark_theme = [matrix_ hasDarkTheme]; |
| 124 [matrix_ setSeparator:[OmniboxPopupCell | 124 [matrix_ setSeparator:[OmniboxPopupCell |
| 125 createSeparatorStringForDarkTheme:is_dark_theme]]; | 125 createSeparatorStringForDarkTheme:is_dark_theme]]; |
| 126 | 126 |
| 127 // Update the selection before placing (and displaying) the window. | 127 // Update the selection before placing (and displaying) the window. |
| 128 PaintUpdatesNow(); | 128 PaintUpdatesNow(); |
| 129 | 129 |
| 130 // Calculate the matrix size manually rather than using -sizeToCells | 130 // Calculate the matrix size manually rather than using -sizeToCells |
| 131 // because actually resizing the matrix messed up the popup size | 131 // because actually resizing the matrix messed up the popup size |
| 132 // animation. | 132 // animation. |
| (...skipping 226 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 |