| 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/sys_string_conversions.h" | 10 #include "base/sys_string_conversions.h" |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 // Restore the original animations dictionary. This does not reinstate any | 392 // Restore the original animations dictionary. This does not reinstate any |
| 393 // previously running animations. | 393 // previously running animations. |
| 394 [popup_ setAnimations:savedAnimations]; | 394 [popup_ setAnimations:savedAnimations]; |
| 395 } | 395 } |
| 396 | 396 |
| 397 if (![popup_ isVisible]) | 397 if (![popup_ isVisible]) |
| 398 [[field_ window] addChildWindow:popup_ ordered:NSWindowAbove]; | 398 [[field_ window] addChildWindow:popup_ ordered:NSWindowAbove]; |
| 399 } | 399 } |
| 400 | 400 |
| 401 NSImage* OmniboxPopupViewMac::ImageForMatch(const AutocompleteMatch& match) { | 401 NSImage* OmniboxPopupViewMac::ImageForMatch(const AutocompleteMatch& match) { |
| 402 const SkBitmap* bitmap = model_->GetIconIfExtensionMatch(match); | 402 gfx::Image image = model_->GetIconIfExtensionMatch(match); |
| 403 if (bitmap) | 403 if (!image.IsEmpty()) |
| 404 return gfx::SkBitmapToNSImage(*bitmap); | 404 return image.AsNSImage(); |
| 405 | 405 |
| 406 const int resource_id = match.starred ? | 406 const int resource_id = match.starred ? |
| 407 IDR_OMNIBOX_STAR : AutocompleteMatch::TypeToIcon(match.type); | 407 IDR_OMNIBOX_STAR : AutocompleteMatch::TypeToIcon(match.type); |
| 408 return OmniboxViewMac::ImageForResource(resource_id); | 408 return OmniboxViewMac::ImageForResource(resource_id); |
| 409 } | 409 } |
| 410 | 410 |
| 411 void OmniboxPopupViewMac::UpdatePopupAppearance() { | 411 void OmniboxPopupViewMac::UpdatePopupAppearance() { |
| 412 DCHECK([NSThread isMainThread]); | 412 DCHECK([NSThread isMainThread]); |
| 413 const AutocompleteResult& result = model_->result(); | 413 const AutocompleteResult& result = model_->result(); |
| 414 if (result.empty()) { | 414 if (result.empty()) { |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 759 xRadius:kPopupRoundingRadius | 759 xRadius:kPopupRoundingRadius |
| 760 yRadius:kPopupRoundingRadius]; | 760 yRadius:kPopupRoundingRadius]; |
| 761 | 761 |
| 762 // Draw the matrix clipped to our border. | 762 // Draw the matrix clipped to our border. |
| 763 gfx::ScopedNSGraphicsContextSaveGState scopedGState; | 763 gfx::ScopedNSGraphicsContextSaveGState scopedGState; |
| 764 [path addClip]; | 764 [path addClip]; |
| 765 [super drawRect:rect]; | 765 [super drawRect:rect]; |
| 766 } | 766 } |
| 767 | 767 |
| 768 @end | 768 @end |
| OLD | NEW |