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

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

Issue 2524223002: MacViews: Anchor bubbles according to the MD spec. (Closed)
Patch Set: Zap unnecessary patchset dep Created 4 years 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 | chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.h » ('j') | 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) 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 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 return observer_->SelectionRangeForProposedRange(newRange); 277 return observer_->SelectionRangeForProposedRange(newRange);
278 return newRange; 278 return newRange;
279 } 279 }
280 280
281 - (void)addToolTip:(NSString*)tooltip forRect:(NSRect)aRect { 281 - (void)addToolTip:(NSString*)tooltip forRect:(NSRect)aRect {
282 [currentToolTips_ addObject:tooltip]; 282 [currentToolTips_ addObject:tooltip];
283 [self addToolTipRect:aRect owner:tooltip userData:nil]; 283 [self addToolTipRect:aRect owner:tooltip userData:nil];
284 } 284 }
285 285
286 - (NSPoint)bubblePointForDecoration:(LocationBarDecoration*)decoration { 286 - (NSPoint)bubblePointForDecoration:(LocationBarDecoration*)decoration {
287 const NSRect frame = 287 NSPoint point;
288 [[self cell] frameForDecoration:decoration inFrame:[self bounds]]; 288 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) {
289 const NSPoint point = decoration->GetBubblePointInFrame(frame); 289 // Under MD, dialogs have no arrow and anchor to corner of the decoration
290 // frame, not a specific point within it. See http://crbug.com/566115.
291 BOOL isLeftDecoration;
292 const NSRect frame =
293 [[self cell] backgroundFrameForDecoration:decoration
294 inFrame:[self bounds]
295 isLeftDecoration:&isLeftDecoration];
296 point.y = NSMaxY(frame);
297 point.x = isLeftDecoration ? NSMinX(frame) : NSMaxX(frame);
298 } else {
299 const NSRect frame =
300 [[self cell] frameForDecoration:decoration inFrame:[self bounds]];
301 point = decoration->GetBubblePointInFrame(frame);
302 }
303
290 return [self convertPoint:point toView:nil]; 304 return [self convertPoint:point toView:nil];
291 } 305 }
292 306
293 // TODO(shess): -resetFieldEditorFrameIfNeeded is the place where 307 // TODO(shess): -resetFieldEditorFrameIfNeeded is the place where
294 // changes to the cell layout should be flushed. LocationBarViewMac 308 // changes to the cell layout should be flushed. LocationBarViewMac
295 // and ToolbarController are calling this routine directly, and I 309 // and ToolbarController are calling this routine directly, and I
296 // think they are probably wrong. 310 // think they are probably wrong.
297 // http://crbug.com/40053 311 // http://crbug.com/40053
298 - (void)updateMouseTracking { 312 - (void)updateMouseTracking {
299 // This will force |resetCursorRects| to be called, as it is not to be called 313 // This will force |resetCursorRects| to be called, as it is not to be called
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 // ThemedWindowDrawing implementation. 545 // ThemedWindowDrawing implementation.
532 546
533 - (void)windowDidChangeTheme { 547 - (void)windowDidChangeTheme {
534 [self updateColorsToMatchTheme]; 548 [self updateColorsToMatchTheme];
535 } 549 }
536 550
537 - (void)windowDidChangeActive { 551 - (void)windowDidChangeActive {
538 } 552 }
539 553
540 @end 554 @end
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698