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

Side by Side Diff: chrome/browser/ui/cocoa/bookmarks/bookmark_bubble_controller.mm

Issue 2717603003: [Mac] Make bubble arrow location/position RTL-aware (Closed)
Patch Set: Now with proper enum formatting Created 3 years, 9 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 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bubble_controller.h" 5 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_bubble_controller.h"
6 6
7 #include "base/mac/bundle_locations.h" 7 #include "base/mac/bundle_locations.h"
8 #include "base/strings/sys_string_conversions.h" 8 #include "base/strings/sys_string_conversions.h"
9 #include "chrome/browser/ui/bookmarks/bookmark_bubble_observer.h" 9 #include "chrome/browser/ui/bookmarks/bookmark_bubble_observer.h"
10 #include "chrome/browser/ui/browser.h" 10 #include "chrome/browser/ui/browser.h"
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 137
138 // Override -[BaseBubbleController showWindow:] to tweak bubble location and 138 // Override -[BaseBubbleController showWindow:] to tweak bubble location and
139 // set up UI elements. 139 // set up UI elements.
140 - (void)showWindow:(id)sender { 140 - (void)showWindow:(id)sender {
141 NSWindow* window = [self window]; // Force load the NIB. 141 NSWindow* window = [self window]; // Force load the NIB.
142 NSWindow* parentWindow = self.parentWindow; 142 NSWindow* parentWindow = self.parentWindow;
143 BrowserWindowController* bwc = 143 BrowserWindowController* bwc =
144 [BrowserWindowController browserWindowControllerForWindow:parentWindow]; 144 [BrowserWindowController browserWindowControllerForWindow:parentWindow];
145 145
146 InfoBubbleView* bubble = self.bubble; 146 InfoBubbleView* bubble = self.bubble;
147 [bubble setArrowLocation:info_bubble::kTopRight]; 147 [bubble setArrowLocation:info_bubble::kTopTrailing];
148 148
149 // Insure decent positioning even in the absence of a browser controller, 149 // Insure decent positioning even in the absence of a browser controller,
150 // which will occur for some unit tests. 150 // which will occur for some unit tests.
151 NSPoint arrowTip = bwc ? [bwc bookmarkBubblePoint] : 151 NSPoint arrowTip = bwc ? [bwc bookmarkBubblePoint] :
152 NSMakePoint([window frame].size.width, [window frame].size.height); 152 NSMakePoint([window frame].size.width, [window frame].size.height);
153 arrowTip = ui::ConvertPointFromWindowToScreen(parentWindow, arrowTip); 153 arrowTip = ui::ConvertPointFromWindowToScreen(parentWindow, arrowTip);
154 NSPoint bubbleArrowTip = [bubble arrowTip]; 154 NSPoint bubbleArrowTip = [bubble arrowTip];
155 bubbleArrowTip = [bubble convertPoint:bubbleArrowTip toView:nil]; 155 bubbleArrowTip = [bubble convertPoint:bubbleArrowTip toView:nil];
156 arrowTip.y -= bubbleArrowTip.y; 156 arrowTip.y -= bubbleArrowTip.y;
157 arrowTip.x -= bubbleArrowTip.x; 157 arrowTip.x -= bubbleArrowTip.x;
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 NSInteger idx = [menu indexOfItemWithRepresentedObject:parentValue]; 376 NSInteger idx = [menu indexOfItemWithRepresentedObject:parentValue];
377 DCHECK(idx != -1); 377 DCHECK(idx != -1);
378 [folderPopUpButton_ selectItemAtIndex:idx]; 378 [folderPopUpButton_ selectItemAtIndex:idx];
379 } 379 }
380 380
381 - (NSPopUpButton*)folderPopUpButton { 381 - (NSPopUpButton*)folderPopUpButton {
382 return folderPopUpButton_; 382 return folderPopUpButton_;
383 } 383 }
384 384
385 @end // implementation BookmarkBubbleController(ExposedForUnitTesting) 385 @end // implementation BookmarkBubbleController(ExposedForUnitTesting)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698