OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/wrench_menu/wrench_menu_controller.h" | 5 #import "chrome/browser/ui/cocoa/wrench_menu/wrench_menu_controller.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/mac/bundle_locations.h" | 8 #include "base/mac/bundle_locations.h" |
9 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
10 #include "base/strings/sys_string_conversions.h" | 10 #include "base/strings/sys_string_conversions.h" |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 gfx::Size preferredContainerSize = | 263 gfx::Size preferredContainerSize = |
264 [browserActionsController_ sizeForOverflowWidth:maxContainerWidth]; | 264 [browserActionsController_ sizeForOverflowWidth:maxContainerWidth]; |
265 | 265 |
266 // Set the origins and preferred size for the container. | 266 // Set the origins and preferred size for the container. |
267 // View hierarchy is as follows (from parent > child): | 267 // View hierarchy is as follows (from parent > child): |
268 // |view| > |anonymous view| > containerView. We have to set the origin | 268 // |view| > |anonymous view| > containerView. We have to set the origin |
269 // and size of each for it display properly. | 269 // and size of each for it display properly. |
270 // The parent views each have a size of the full width of the menu, so we can | 270 // The parent views each have a size of the full width of the menu, so we can |
271 // properly position the container. | 271 // properly position the container. |
272 NSSize parentSize = | 272 NSSize parentSize = |
273 NSMakeSize([[self menu] size].width, preferredContainerSize.height()); | 273 NSMakeSize(preferredContainerSize.width() + kRightPadding + kLeftPadding, |
| 274 preferredContainerSize.height()); |
274 [view setFrameSize:parentSize]; | 275 [view setFrameSize:parentSize]; |
275 [[containerView superview] setFrameSize:parentSize]; | 276 [[containerView superview] setFrameSize:parentSize]; |
276 | 277 |
277 // The container view gets its preferred size. | 278 // The container view gets its preferred size. |
278 [containerView setFrameSize:NSMakeSize(preferredContainerSize.width(), | 279 [containerView setFrameSize:NSMakeSize(preferredContainerSize.width(), |
279 preferredContainerSize.height())]; | 280 preferredContainerSize.height())]; |
280 [browserActionsController_ update]; | 281 [browserActionsController_ update]; |
281 | 282 |
282 [view setFrameOrigin:NSZeroPoint]; | 283 [view setFrameOrigin:NSZeroPoint]; |
283 [[containerView superview] setFrameOrigin:NSZeroPoint]; | 284 [[containerView superview] setFrameOrigin:NSZeroPoint]; |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
507 controller_ = controller; | 508 controller_ = controller; |
508 } | 509 } |
509 return self; | 510 return self; |
510 } | 511 } |
511 | 512 |
512 - (IBAction)dispatchWrenchMenuCommand:(id)sender { | 513 - (IBAction)dispatchWrenchMenuCommand:(id)sender { |
513 [controller_ dispatchWrenchMenuCommand:sender]; | 514 [controller_ dispatchWrenchMenuCommand:sender]; |
514 } | 515 } |
515 | 516 |
516 @end // @implementation WrenchMenuButtonViewController | 517 @end // @implementation WrenchMenuButtonViewController |
OLD | NEW |