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

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

Issue 1951143002: [Mac][Material Design] Get Omnibox table width from dropdown window. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 NSRect background_rect = NSZeroRect; 253 NSRect background_rect = NSZeroRect;
254 background_rect.size.width = NSWidth(popup_frame); 254 background_rect.size.width = NSWidth(popup_frame);
255 background_rect.size.height = NSHeight(popup_frame) - 255 background_rect.size.height = NSHeight(popup_frame) -
256 NSHeight(top_separator_frame) - NSHeight(bottom_separator_frame); 256 NSHeight(top_separator_frame) - NSHeight(bottom_separator_frame);
257 background_rect.origin.y = NSMaxY(top_separator_frame); 257 background_rect.origin.y = NSMaxY(top_separator_frame);
258 [background_view_ setFrame:background_rect]; 258 [background_view_ setFrame:background_rect];
259 259
260 // In Material Design, the table is the width of the window. In non-MD, 260 // In Material Design, the table is the width of the window. In non-MD,
261 // calculate the width of the table based on backing out the popup's border 261 // calculate the width of the table based on backing out the popup's border
262 // from the width of the field. 262 // from the width of the field.
263 CGFloat table_width = NSWidth([background_view_ bounds]); 263 CGFloat table_width = NSWidth([[[field_ window] contentView] bounds]);
264 bool is_mode_material = ui::MaterialDesignController::IsModeMaterial(); 264 bool is_mode_material = ui::MaterialDesignController::IsModeMaterial();
265 if (!is_mode_material) { 265 if (!is_mode_material) {
266 table_width = NSWidth([field_ bounds]); 266 table_width = NSWidth([field_ bounds]);
267 } 267 }
268 DCHECK_GT(table_width, 0.0); 268 DCHECK_GT(table_width, 0.0);
269 269
270 // Matrix. 270 // Matrix.
271 NSPoint field_origin_base = 271 NSPoint field_origin_base =
272 [field_ convertPoint:[field_ bounds].origin toView:nil]; 272 [field_ convertPoint:[field_ bounds].origin toView:nil];
273 NSRect matrix_frame = NSZeroRect; 273 NSRect matrix_frame = NSZeroRect;
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698