| 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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 } | 155 } |
| 156 | 156 |
| 157 void OmniboxPopupViewMac::OnMatrixRowClicked(OmniboxPopupMatrix* matrix, | 157 void OmniboxPopupViewMac::OnMatrixRowClicked(OmniboxPopupMatrix* matrix, |
| 158 size_t row) { | 158 size_t row) { |
| 159 OpenURLForRow(row, | 159 OpenURLForRow(row, |
| 160 ui::WindowOpenDispositionFromNSEvent([NSApp currentEvent])); | 160 ui::WindowOpenDispositionFromNSEvent([NSApp currentEvent])); |
| 161 } | 161 } |
| 162 | 162 |
| 163 void OmniboxPopupViewMac::OnMatrixRowMiddleClicked(OmniboxPopupMatrix* matrix, | 163 void OmniboxPopupViewMac::OnMatrixRowMiddleClicked(OmniboxPopupMatrix* matrix, |
| 164 size_t row) { | 164 size_t row) { |
| 165 OpenURLForRow(row, NEW_BACKGROUND_TAB); | 165 OpenURLForRow(row, WindowOpenDisposition::NEW_BACKGROUND_TAB); |
| 166 } | 166 } |
| 167 | 167 |
| 168 const AutocompleteResult& OmniboxPopupViewMac::GetResult() const { | 168 const AutocompleteResult& OmniboxPopupViewMac::GetResult() const { |
| 169 return model_->result(); | 169 return model_->result(); |
| 170 } | 170 } |
| 171 | 171 |
| 172 void OmniboxPopupViewMac::CreatePopupIfNeeded() { | 172 void OmniboxPopupViewMac::CreatePopupIfNeeded() { |
| 173 if (!popup_) { | 173 if (!popup_) { |
| 174 popup_.reset( | 174 popup_.reset( |
| 175 [[NSWindow alloc] initWithContentRect:ui::kWindowSizeDeterminedLater | 175 [[NSWindow alloc] initWithContentRect:ui::kWindowSizeDeterminedLater |
| (...skipping 183 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 |