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

Side by Side Diff: chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.mm

Issue 2862003004: Mac: Fix infobar anchor under Harmony. (Closed)
Patch Set: s/. I/ i/ Created 3 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.h" 5 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #import "base/mac/mac_util.h" 8 #import "base/mac/mac_util.h"
9 #import "base/mac/sdk_forward_declarations.h" 9 #import "base/mac/sdk_forward_declarations.h"
10 #include "chrome/browser/themes/theme_service.h" 10 #include "chrome/browser/themes/theme_service.h"
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 return observer_->SelectionRangeForProposedRange(newRange); 281 return observer_->SelectionRangeForProposedRange(newRange);
282 return newRange; 282 return newRange;
283 } 283 }
284 284
285 - (void)addToolTip:(NSString*)tooltip forRect:(NSRect)aRect { 285 - (void)addToolTip:(NSString*)tooltip forRect:(NSRect)aRect {
286 [currentToolTips_ addObject:tooltip]; 286 [currentToolTips_ addObject:tooltip];
287 [self addToolTipRect:aRect owner:tooltip userData:nil]; 287 [self addToolTipRect:aRect owner:tooltip userData:nil];
288 } 288 }
289 289
290 - (NSPoint)bubblePointForDecoration:(LocationBarDecoration*)decoration { 290 - (NSPoint)bubblePointForDecoration:(LocationBarDecoration*)decoration {
291 NSPoint point; 291 if (!ui::MaterialDesignController::IsSecondaryUiMaterial())
292 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) { 292 return [self arrowAnchorPointForDecoration:decoration];
293 // Under MD, dialogs have no arrow and anchor to corner of the decoration
294 // frame, not a specific point within it. See http://crbug.com/566115.
295 BOOL isLeftDecoration;
296 const NSRect frame =
297 [[self cell] backgroundFrameForDecoration:decoration
298 inFrame:[self bounds]
299 isLeftDecoration:&isLeftDecoration];
300 point.y = NSMaxY(frame);
301 point.x = isLeftDecoration ? NSMinX(frame) : NSMaxX(frame);
302 } else {
303 const NSRect frame =
304 [[self cell] frameForDecoration:decoration inFrame:[self bounds]];
305 point = decoration->GetBubblePointInFrame(frame);
306 }
307 293
294 // Under MD, dialogs have no arrow and anchor to corner of the decoration
295 // frame, not a specific point within it. See http://crbug.com/566115.
296 BOOL isLeftDecoration;
297 const NSRect frame =
298 [[self cell] backgroundFrameForDecoration:decoration
299 inFrame:[self bounds]
300 isLeftDecoration:&isLeftDecoration];
301 NSPoint point = NSMakePoint(isLeftDecoration ? NSMinX(frame) : NSMaxX(frame),
302 NSMaxY(frame));
308 return [self convertPoint:point toView:nil]; 303 return [self convertPoint:point toView:nil];
309 } 304 }
310 305
306 - (NSPoint)arrowAnchorPointForDecoration:(LocationBarDecoration*)decoration {
307 const NSRect frame =
308 [[self cell] frameForDecoration:decoration inFrame:[self bounds]];
309 NSPoint point = decoration->GetBubblePointInFrame(frame);
310 return [self convertPoint:point toView:nil];
311 }
312
311 // TODO(shess): -resetFieldEditorFrameIfNeeded is the place where 313 // TODO(shess): -resetFieldEditorFrameIfNeeded is the place where
312 // changes to the cell layout should be flushed. LocationBarViewMac 314 // changes to the cell layout should be flushed. LocationBarViewMac
313 // and ToolbarController are calling this routine directly, and I 315 // and ToolbarController are calling this routine directly, and I
314 // think they are probably wrong. 316 // think they are probably wrong.
315 // http://crbug.com/40053 317 // http://crbug.com/40053
316 - (void)updateMouseTracking { 318 - (void)updateMouseTracking {
317 // This will force |resetCursorRects| to be called, as it is not to be called 319 // This will force |resetCursorRects| to be called, as it is not to be called
318 // directly. 320 // directly.
319 [[self window] invalidateCursorRectsForView:self]; 321 [[self window] invalidateCursorRectsForView:self];
320 322
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 // ThemedWindowDrawing implementation. 545 // ThemedWindowDrawing implementation.
544 546
545 - (void)windowDidChangeTheme { 547 - (void)windowDidChangeTheme {
546 [self updateColorsToMatchTheme]; 548 [self updateColorsToMatchTheme];
547 } 549 }
548 550
549 - (void)windowDidChangeActive { 551 - (void)windowDidChangeActive {
550 } 552 }
551 553
552 @end 554 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698