OLD | NEW |
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/bookmarks/chrome_bookmark_client.h" | 9 #include "chrome/browser/bookmarks/chrome_bookmark_client.h" |
10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 // Override -[BaseBubbleController showWindow:] to tweak bubble location and | 167 // Override -[BaseBubbleController showWindow:] to tweak bubble location and |
168 // set up UI elements. | 168 // set up UI elements. |
169 - (void)showWindow:(id)sender { | 169 - (void)showWindow:(id)sender { |
170 NSWindow* window = [self window]; // Force load the NIB. | 170 NSWindow* window = [self window]; // Force load the NIB. |
171 NSWindow* parentWindow = self.parentWindow; | 171 NSWindow* parentWindow = self.parentWindow; |
172 BrowserWindowController* bwc = | 172 BrowserWindowController* bwc = |
173 [BrowserWindowController browserWindowControllerForWindow:parentWindow]; | 173 [BrowserWindowController browserWindowControllerForWindow:parentWindow]; |
174 [bwc lockBarVisibilityForOwner:self withAnimation:NO delay:NO]; | 174 [bwc lockBarVisibilityForOwner:self withAnimation:NO delay:NO]; |
175 | 175 |
176 InfoBubbleView* bubble = self.bubble; | 176 InfoBubbleView* bubble = self.bubble; |
177 [bubble setArrowLocation:info_bubble::kTopRight]; | 177 [bubble setArrowLocation:views::BubbleBorder::TOP_RIGHT]; |
178 | 178 |
179 // Insure decent positioning even in the absence of a browser controller, | 179 // Insure decent positioning even in the absence of a browser controller, |
180 // which will occur for some unit tests. | 180 // which will occur for some unit tests. |
181 NSPoint arrowTip = bwc ? [bwc bookmarkBubblePoint] : | 181 NSPoint arrowTip = bwc ? [bwc bookmarkBubblePoint] : |
182 NSMakePoint([window frame].size.width, [window frame].size.height); | 182 NSMakePoint([window frame].size.width, [window frame].size.height); |
183 arrowTip = [parentWindow convertBaseToScreen:arrowTip]; | 183 arrowTip = [parentWindow convertBaseToScreen:arrowTip]; |
184 NSPoint bubbleArrowTip = [bubble arrowTip]; | 184 NSPoint bubbleArrowTip = [bubble arrowTip]; |
185 bubbleArrowTip = [bubble convertPoint:bubbleArrowTip toView:nil]; | 185 bubbleArrowTip = [bubble convertPoint:bubbleArrowTip toView:nil]; |
186 arrowTip.y -= bubbleArrowTip.y; | 186 arrowTip.y -= bubbleArrowTip.y; |
187 arrowTip.x -= bubbleArrowTip.x; | 187 arrowTip.x -= bubbleArrowTip.x; |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 NSInteger idx = [menu indexOfItemWithRepresentedObject:parentValue]; | 403 NSInteger idx = [menu indexOfItemWithRepresentedObject:parentValue]; |
404 DCHECK(idx != -1); | 404 DCHECK(idx != -1); |
405 [folderPopUpButton_ selectItemAtIndex:idx]; | 405 [folderPopUpButton_ selectItemAtIndex:idx]; |
406 } | 406 } |
407 | 407 |
408 - (NSPopUpButton*)folderPopUpButton { | 408 - (NSPopUpButton*)folderPopUpButton { |
409 return folderPopUpButton_; | 409 return folderPopUpButton_; |
410 } | 410 } |
411 | 411 |
412 @end // implementation BookmarkBubbleController(ExposedForUnitTesting) | 412 @end // implementation BookmarkBubbleController(ExposedForUnitTesting) |
OLD | NEW |