| 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/infobars/infobar_utilities.h" | 5 #import "chrome/browser/ui/cocoa/infobars/infobar_utilities.h" |
| 6 | 6 |
| 7 #include "base/memory/scoped_nsobject.h" | 7 #include "base/mac/scoped_nsobject.h" |
| 8 #import "chrome/browser/ui/cocoa/infobars/infobar_container_controller.h" | 8 #import "chrome/browser/ui/cocoa/infobars/infobar_container_controller.h" |
| 9 #import "chrome/browser/ui/cocoa/infobars/infobar_gradient_view.h" | 9 #import "chrome/browser/ui/cocoa/infobars/infobar_gradient_view.h" |
| 10 | 10 |
| 11 namespace InfoBarUtilities { | 11 namespace InfoBarUtilities { |
| 12 | 12 |
| 13 // Move the |toMove| view |spacing| pixels before/after the |anchor| view. | 13 // Move the |toMove| view |spacing| pixels before/after the |anchor| view. |
| 14 // |after| signifies the side of |anchor| on which to place |toMove|. | 14 // |after| signifies the side of |anchor| on which to place |toMove|. |
| 15 void MoveControl(NSView* anchor, NSView* toMove, int spacing, bool after) { | 15 void MoveControl(NSView* anchor, NSView* toMove, int spacing, bool after) { |
| 16 NSRect anchorFrame = [anchor frame]; | 16 NSRect anchorFrame = [anchor frame]; |
| 17 NSRect toMoveFrame = [toMove frame]; | 17 NSRect toMoveFrame = [toMove frame]; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 [ret setBordered:NO]; | 62 [ret setBordered:NO]; |
| 63 return ret; | 63 return ret; |
| 64 } | 64 } |
| 65 | 65 |
| 66 // Adds an item with the specified properties to |menu|. | 66 // Adds an item with the specified properties to |menu|. |
| 67 void AddMenuItem(NSMenu *menu, id target, SEL selector, NSString* title, | 67 void AddMenuItem(NSMenu *menu, id target, SEL selector, NSString* title, |
| 68 int tag, bool enabled, bool checked) { | 68 int tag, bool enabled, bool checked) { |
| 69 if (tag == -1) { | 69 if (tag == -1) { |
| 70 [menu addItem:[NSMenuItem separatorItem]]; | 70 [menu addItem:[NSMenuItem separatorItem]]; |
| 71 } else { | 71 } else { |
| 72 scoped_nsobject<NSMenuItem> item([[NSMenuItem alloc] | 72 base::scoped_nsobject<NSMenuItem> item( |
| 73 initWithTitle:title | 73 [[NSMenuItem alloc] initWithTitle:title |
| 74 action:selector | 74 action:selector |
| 75 keyEquivalent:@""]); | 75 keyEquivalent:@""]); |
| 76 [item setTag:tag]; | 76 [item setTag:tag]; |
| 77 [menu addItem:item]; | 77 [menu addItem:item]; |
| 78 [item setTarget:target]; | 78 [item setTarget:target]; |
| 79 if (checked) | 79 if (checked) |
| 80 [item setState:NSOnState]; | 80 [item setState:NSOnState]; |
| 81 if (!enabled) | 81 if (!enabled) |
| 82 [item setEnabled:NO]; | 82 [item setEnabled:NO]; |
| 83 } | 83 } |
| 84 } | 84 } |
| 85 | 85 |
| 86 } // namespace InfoBarUtilities | 86 } // namespace InfoBarUtilities |
| OLD | NEW |