| 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/stl_util.h" | 9 #include "base/stl_util.h" |
| 10 #include "base/strings/sys_string_conversions.h" | 10 #include "base/strings/sys_string_conversions.h" |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 | 317 |
| 318 if (![popup_ isVisible]) | 318 if (![popup_ isVisible]) |
| 319 [[field_ window] addChildWindow:popup_ ordered:NSWindowAbove]; | 319 [[field_ window] addChildWindow:popup_ ordered:NSWindowAbove]; |
| 320 } | 320 } |
| 321 | 321 |
| 322 NSImage* OmniboxPopupViewMac::ImageForMatch(const AutocompleteMatch& match) { | 322 NSImage* OmniboxPopupViewMac::ImageForMatch(const AutocompleteMatch& match) { |
| 323 gfx::Image image = model_->GetIconIfExtensionMatch(match); | 323 gfx::Image image = model_->GetIconIfExtensionMatch(match); |
| 324 if (!image.IsEmpty()) | 324 if (!image.IsEmpty()) |
| 325 return image.AsNSImage(); | 325 return image.AsNSImage(); |
| 326 | 326 |
| 327 const int resource_id = match.starred ? | 327 const int resource_id = model_->IsStarredMatch(match) ? |
| 328 IDR_OMNIBOX_STAR : AutocompleteMatch::TypeToIcon(match.type); | 328 IDR_OMNIBOX_STAR : AutocompleteMatch::TypeToIcon(match.type); |
| 329 return OmniboxViewMac::ImageForResource(resource_id); | 329 return OmniboxViewMac::ImageForResource(resource_id); |
| 330 } | 330 } |
| 331 | 331 |
| 332 void OmniboxPopupViewMac::OpenURLForRow(size_t row, | 332 void OmniboxPopupViewMac::OpenURLForRow(size_t row, |
| 333 WindowOpenDisposition disposition) { | 333 WindowOpenDisposition disposition) { |
| 334 size_t start_match = model_->result().ShouldHideTopMatch() ? 1 : 0; | 334 size_t start_match = model_->result().ShouldHideTopMatch() ? 1 : 0; |
| 335 row += start_match; | 335 row += start_match; |
| 336 DCHECK_LT(row, GetResult().size()); | 336 DCHECK_LT(row, GetResult().size()); |
| 337 omnibox_view_->OpenMatch(GetResult().match_at(row), disposition, GURL(), | 337 omnibox_view_->OpenMatch(GetResult().match_at(row), disposition, GURL(), |
| 338 base::string16(), row); | 338 base::string16(), row); |
| 339 } | 339 } |
| OLD | NEW |