| 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/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 Loading... |
| 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 |
| 151 NSPoint arrowTip = bwc ? [bwc bookmarkBubblePoint] : | 152 NSPoint arrowTip = bwc ? [bwc bookmarkBubblePoint] : |
| 152 NSMakePoint([window frame].size.width, [window frame].size.height); | 153 NSMakePoint([window frame].size.width, [window frame].size.height); |
| 153 arrowTip = ui::ConvertPointFromWindowToScreen(parentWindow, arrowTip); | 154 arrowTip = ui::ConvertPointFromWindowToScreen(parentWindow, arrowTip); |
| 154 NSPoint bubbleArrowTip = [bubble arrowTip]; | 155 NSPoint bubbleArrowTip = [bubble arrowTip]; |
| 155 bubbleArrowTip = [bubble convertPoint:bubbleArrowTip toView:nil]; | 156 bubbleArrowTip = [bubble convertPoint:bubbleArrowTip toView:nil]; |
| 156 arrowTip.y -= bubbleArrowTip.y; | 157 arrowTip.y -= bubbleArrowTip.y; |
| 157 arrowTip.x -= bubbleArrowTip.x; | 158 arrowTip.x -= bubbleArrowTip.x; |
| 158 [window setFrameOrigin:arrowTip]; | 159 [window setFrameOrigin:arrowTip]; |
| 159 | 160 |
| 160 // Default is IDS_BOOKMARK_BUBBLE_PAGE_BOOKMARK; "Bookmark". | 161 // Default is IDS_BOOKMARK_BUBBLE_PAGE_BOOKMARK; "Bookmark". |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 NSInteger idx = [menu indexOfItemWithRepresentedObject:parentValue]; | 377 NSInteger idx = [menu indexOfItemWithRepresentedObject:parentValue]; |
| 377 DCHECK(idx != -1); | 378 DCHECK(idx != -1); |
| 378 [folderPopUpButton_ selectItemAtIndex:idx]; | 379 [folderPopUpButton_ selectItemAtIndex:idx]; |
| 379 } | 380 } |
| 380 | 381 |
| 381 - (NSPopUpButton*)folderPopUpButton { | 382 - (NSPopUpButton*)folderPopUpButton { |
| 382 return folderPopUpButton_; | 383 return folderPopUpButton_; |
| 383 } | 384 } |
| 384 | 385 |
| 385 @end // implementation BookmarkBubbleController(ExposedForUnitTesting) | 386 @end // implementation BookmarkBubbleController(ExposedForUnitTesting) |
| OLD | NEW |