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 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 } | 313 } |
314 | 314 |
315 [NSAnimationContext beginGrouping]; | 315 [NSAnimationContext beginGrouping]; |
316 // Don't use the GTM addition for the "Steve" slowdown because this can | 316 // Don't use the GTM addition for the "Steve" slowdown because this can |
317 // happen async from user actions and the effects could be a surprise. | 317 // happen async from user actions and the effects could be a surprise. |
318 [[NSAnimationContext currentContext] setDuration:kShrinkAnimationDuration]; | 318 [[NSAnimationContext currentContext] setDuration:kShrinkAnimationDuration]; |
319 // When using the animator to update |popup_| on El Capitan, for some reason | 319 // When using the animator to update |popup_| on El Capitan, for some reason |
320 // the window does not get redrawn. Use a completion handler to make sure | 320 // the window does not get redrawn. Use a completion handler to make sure |
321 // |popup_| gets redrawn once the animation completes. See | 321 // |popup_| gets redrawn once the animation completes. See |
322 // http://crbug.com/538590 and http://crbug.com/551007 . | 322 // http://crbug.com/538590 and http://crbug.com/551007 . |
323 if (base::mac::IsOSElCapitanOrLater()) { | 323 if (base::mac::IsAtLeastOS10_11()) { |
324 NSWindow* popup = popup_.get(); | 324 NSWindow* popup = popup_.get(); |
325 [[NSAnimationContext currentContext] setCompletionHandler:^{ | 325 [[NSAnimationContext currentContext] setCompletionHandler:^{ |
326 [popup display]; | 326 [popup display]; |
327 }]; | 327 }]; |
328 } | 328 } |
329 [[popup_ animator] setFrame:popup_frame display:YES]; | 329 [[popup_ animator] setFrame:popup_frame display:YES]; |
330 [NSAnimationContext endGrouping]; | 330 [NSAnimationContext endGrouping]; |
331 | 331 |
332 if (!animate) { | 332 if (!animate) { |
333 // Restore the original animations dictionary. This does not reinstate any | 333 // Restore the original animations dictionary. This does not reinstate any |
(...skipping 25 matching lines...) Expand all 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 |