| 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/base_bubble_controller.h" | 5 #import "chrome/browser/ui/cocoa/base_bubble_controller.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/mac/bundle_locations.h" | 8 #include "base/mac/bundle_locations.h" |
| 9 #include "base/mac/mac_util.h" | 9 #include "base/mac/mac_util.h" |
| 10 #include "base/mac/scoped_nsobject.h" | 10 #include "base/mac/scoped_nsobject.h" |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 | 134 |
| 135 - (void)recordAnchorOffset { | 135 - (void)recordAnchorOffset { |
| 136 // The offset of the anchor from the parent's upper-left-hand corner is kept | 136 // The offset of the anchor from the parent's upper-left-hand corner is kept |
| 137 // to ensure the bubble stays anchored correctly if the parent is resized. | 137 // to ensure the bubble stays anchored correctly if the parent is resized. |
| 138 anchorOffset_ = NSMakePoint(NSMinX([parentWindow_ frame]), | 138 anchorOffset_ = NSMakePoint(NSMinX([parentWindow_ frame]), |
| 139 NSMaxY([parentWindow_ frame])); | 139 NSMaxY([parentWindow_ frame])); |
| 140 anchorOffset_.x -= anchor_.x; | 140 anchorOffset_.x -= anchor_.x; |
| 141 anchorOffset_.y -= anchor_.y; | 141 anchorOffset_.y -= anchor_.y; |
| 142 } | 142 } |
| 143 | 143 |
| 144 - (NSBox*)separatorWithFrame:(NSRect)frame { | 144 - (NSBox*)horizontalSeparatorWithFrame:(NSRect)frame { |
| 145 frame.size.height = 1.0; | 145 frame.size.height = 1.0; |
| 146 base::scoped_nsobject<NSBox> spacer([[NSBox alloc] initWithFrame:frame]); | 146 base::scoped_nsobject<NSBox> spacer([[NSBox alloc] initWithFrame:frame]); |
| 147 [spacer setBoxType:NSBoxSeparator]; | 147 [spacer setBoxType:NSBoxSeparator]; |
| 148 [spacer setBorderType:NSLineBorder]; | 148 [spacer setBorderType:NSLineBorder]; |
| 149 [spacer setAlphaValue:0.2]; | 149 [spacer setAlphaValue:0.2]; |
| 150 return [spacer.release() autorelease]; | 150 return [spacer.release() autorelease]; |
| 151 } | 151 } |
| 152 | 152 |
| 153 - (NSBox*)verticalSeparatorWithFrame:(NSRect)frame { |
| 154 frame.size.width = 1.0; |
| 155 base::scoped_nsobject<NSBox> spacer([[NSBox alloc] initWithFrame:frame]); |
| 156 [spacer setBoxType:NSBoxSeparator]; |
| 157 [spacer setBorderType:NSLineBorder]; |
| 158 [spacer setAlphaValue:0.2]; |
| 159 return [spacer.release() autorelease]; |
| 160 } |
| 161 |
| 153 - (void)parentWindowDidResize:(NSNotification*)notification { | 162 - (void)parentWindowDidResize:(NSNotification*)notification { |
| 154 DCHECK_EQ(parentWindow_, [notification object]); | 163 DCHECK_EQ(parentWindow_, [notification object]); |
| 155 NSPoint newOrigin = NSMakePoint(NSMinX([parentWindow_ frame]), | 164 NSPoint newOrigin = NSMakePoint(NSMinX([parentWindow_ frame]), |
| 156 NSMaxY([parentWindow_ frame])); | 165 NSMaxY([parentWindow_ frame])); |
| 157 newOrigin.x -= anchorOffset_.x; | 166 newOrigin.x -= anchorOffset_.x; |
| 158 newOrigin.y -= anchorOffset_.y; | 167 newOrigin.y -= anchorOffset_.y; |
| 159 [self setAnchorPoint:newOrigin]; | 168 [self setAnchorPoint:newOrigin]; |
| 160 } | 169 } |
| 161 | 170 |
| 162 - (void)parentWindowWillClose:(NSNotification*)notification { | 171 - (void)parentWindowWillClose:(NSNotification*)notification { |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 | 336 |
| 328 - (void)activateTabWithContents:(content::WebContents*)newContents | 337 - (void)activateTabWithContents:(content::WebContents*)newContents |
| 329 previousContents:(content::WebContents*)oldContents | 338 previousContents:(content::WebContents*)oldContents |
| 330 atIndex:(NSInteger)index | 339 atIndex:(NSInteger)index |
| 331 reason:(int)reason { | 340 reason:(int)reason { |
| 332 // The user switched tabs; close. | 341 // The user switched tabs; close. |
| 333 [self close]; | 342 [self close]; |
| 334 } | 343 } |
| 335 | 344 |
| 336 @end // BaseBubbleController | 345 @end // BaseBubbleController |
| OLD | NEW |