Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(415)

Side by Side Diff: chrome/browser/ui/cocoa/omnibox/omnibox_popup_view_mac.mm

Issue 1380083005: Mac: Use [NSArray firstObject] for [NSScreen screens] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 107
108 // Calculate the matrix size manually rather than using -sizeToCells 108 // Calculate the matrix size manually rather than using -sizeToCells
109 // because actually resizing the matrix messed up the popup size 109 // because actually resizing the matrix messed up the popup size
110 // animation. 110 // animation.
111 DCHECK_EQ([matrix_ intercellSpacing].height, 0.0); 111 DCHECK_EQ([matrix_ intercellSpacing].height, 0.0);
112 PositionPopup(NSHeight([matrix_ frame])); 112 PositionPopup(NSHeight([matrix_ frame]));
113 } 113 }
114 114
115 gfx::Rect OmniboxPopupViewMac::GetTargetBounds() { 115 gfx::Rect OmniboxPopupViewMac::GetTargetBounds() {
116 // Flip the coordinate system before returning. 116 // Flip the coordinate system before returning.
117 NSScreen* screen = [[NSScreen screens] objectAtIndex:0]; 117 NSScreen* screen = [[NSScreen screens] firstObject];
118 NSRect monitor_frame = [screen frame]; 118 NSRect monitor_frame = [screen frame];
119 gfx::Rect bounds(NSRectToCGRect(target_popup_frame_)); 119 gfx::Rect bounds(NSRectToCGRect(target_popup_frame_));
120 bounds.set_y(monitor_frame.size.height - bounds.y() - bounds.height()); 120 bounds.set_y(monitor_frame.size.height - bounds.y() - bounds.height());
121 return bounds; 121 return bounds;
122 } 122 }
123 123
124 // This is only called by model in SetSelectedLine() after updating 124 // This is only called by model in SetSelectedLine() after updating
125 // everything. Popup should already be visible. 125 // everything. Popup should already be visible.
126 void OmniboxPopupViewMac::PaintUpdatesNow() { 126 void OmniboxPopupViewMac::PaintUpdatesNow() {
127 [matrix_ selectRowIndex:model_->selected_line()]; 127 [matrix_ selectRowIndex:model_->selected_line()];
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 IDR_OMNIBOX_STAR : AutocompleteMatch::TypeToIcon(match.type); 297 IDR_OMNIBOX_STAR : AutocompleteMatch::TypeToIcon(match.type);
298 return OmniboxViewMac::ImageForResource(resource_id); 298 return OmniboxViewMac::ImageForResource(resource_id);
299 } 299 }
300 300
301 void OmniboxPopupViewMac::OpenURLForRow(size_t row, 301 void OmniboxPopupViewMac::OpenURLForRow(size_t row,
302 WindowOpenDisposition disposition) { 302 WindowOpenDisposition disposition) {
303 DCHECK_LT(row, GetResult().size()); 303 DCHECK_LT(row, GetResult().size());
304 omnibox_view_->OpenMatch(GetResult().match_at(row), disposition, GURL(), 304 omnibox_view_->OpenMatch(GetResult().match_at(row), disposition, GURL(),
305 base::string16(), row); 305 base::string16(), row);
306 } 306 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/browser_window_controller_private.mm ('k') | chrome/browser/ui/cocoa/panels/panel_utils_cocoa.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698