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

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

Issue 1623002: Change how the calculation is performed for determining the location of the a... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/cocoa/browser_window_controller.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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/cocoa/bookmark_bubble_controller.h" 5 #import "chrome/browser/cocoa/bookmark_bubble_controller.h"
6 #include "app/l10n_util_mac.h" 6 #include "app/l10n_util_mac.h"
7 #include "base/mac_util.h" 7 #include "base/mac_util.h"
8 #include "base/sys_string_conversions.h" 8 #include "base/sys_string_conversions.h"
9 #include "chrome/browser/bookmarks/bookmark_model.h" 9 #include "chrome/browser/bookmarks/bookmark_model.h"
10 #import "chrome/browser/cocoa/browser_window_controller.h" 10 #import "chrome/browser/cocoa/browser_window_controller.h"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 // (called from this function) will bring the window on-screen; 91 // (called from this function) will bring the window on-screen;
92 // unfortunately, [NSWindowController showWindow:] will also bring it 92 // unfortunately, [NSWindowController showWindow:] will also bring it
93 // on-screen (but will cause unexpected changes to the window's 93 // on-screen (but will cause unexpected changes to the window's
94 // position). We cannot have an addChildWindow: and a subsequent 94 // position). We cannot have an addChildWindow: and a subsequent
95 // showWindow:. Thus, we have our own version. 95 // showWindow:. Thus, we have our own version.
96 - (void)showWindow:(id)sender { 96 - (void)showWindow:(id)sender {
97 BrowserWindowController* bwc = 97 BrowserWindowController* bwc =
98 [BrowserWindowController browserWindowControllerForWindow:parentWindow_]; 98 [BrowserWindowController browserWindowControllerForWindow:parentWindow_];
99 [bwc lockBarVisibilityForOwner:self withAnimation:NO delay:NO]; 99 [bwc lockBarVisibilityForOwner:self withAnimation:NO delay:NO];
100 NSWindow* window = [self window]; // completes nib load 100 NSWindow* window = [self window]; // completes nib load
101 [bubble_ setArrowLocation:kTopRight];
101 // Insure decent positioning even in the absence of a browser controller, 102 // Insure decent positioning even in the absence of a browser controller,
102 // which will occur for some unit tests. 103 // which will occur for some unit tests.
103 NSPoint topRight = bwc ? [bwc topRightForBubble] : 104 NSPoint arrowtip = bwc ? [bwc pointForBubbleArrowTip] :
104 NSMakePoint([window frame].size.width, [window frame].size.height); 105 NSMakePoint([window frame].size.width, [window frame].size.height);
105 NSPoint origin = [parentWindow_ convertBaseToScreen:topRight]; 106 NSPoint origin = [parentWindow_ convertBaseToScreen:arrowtip];
106 origin.y -= NSHeight([window frame]); 107 NSPoint bubbleArrowtip = [bubble_ arrowTip];
107 origin.x -= NSWidth([window frame]); 108 bubbleArrowtip = [bubble_ convertPoint:bubbleArrowtip toView:nil];
109 origin.y -= bubbleArrowtip.y;
110 origin.x -= bubbleArrowtip.x;
108 [window setFrameOrigin:origin]; 111 [window setFrameOrigin:origin];
109 [bubble_ setArrowLocation:kTopRight];
110 [parentWindow_ addChildWindow:window ordered:NSWindowAbove]; 112 [parentWindow_ addChildWindow:window ordered:NSWindowAbove];
111 // Default is IDS_BOOMARK_BUBBLE_PAGE_BOOKMARK; "Bookmark". 113 // Default is IDS_BOOMARK_BUBBLE_PAGE_BOOKMARK; "Bookmark".
112 // If adding for the 1st time the string becomes "Bookmark Added!" 114 // If adding for the 1st time the string becomes "Bookmark Added!"
113 if (!alreadyBookmarked_) { 115 if (!alreadyBookmarked_) {
114 NSString* title = 116 NSString* title =
115 l10n_util::GetNSString(IDS_BOOMARK_BUBBLE_PAGE_BOOKMARKED); 117 l10n_util::GetNSString(IDS_BOOMARK_BUBBLE_PAGE_BOOKMARKED);
116 [bigTitle_ setStringValue:title]; 118 [bigTitle_ setStringValue:title];
117 } 119 }
118 120
119 [self fillInFolderList]; 121 [self fillInFolderList];
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 NSInteger idx = [menu indexOfItemWithRepresentedObject:parentValue]; 318 NSInteger idx = [menu indexOfItemWithRepresentedObject:parentValue];
317 DCHECK(idx != -1); 319 DCHECK(idx != -1);
318 [folderPopUpButton_ selectItemAtIndex:idx]; 320 [folderPopUpButton_ selectItemAtIndex:idx];
319 } 321 }
320 322
321 - (NSPopUpButton*)folderPopUpButton { 323 - (NSPopUpButton*)folderPopUpButton {
322 return folderPopUpButton_; 324 return folderPopUpButton_;
323 } 325 }
324 326
325 @end // implementation BookmarkBubbleController(ExposedForUnitTesting) 327 @end // implementation BookmarkBubbleController(ExposedForUnitTesting)
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/cocoa/browser_window_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698