| 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_controller.h" | 5 #import "chrome/browser/ui/cocoa/infobars/infobar_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 "chrome/browser/infobars/infobar_service.h" | 10 #include "chrome/browser/infobars/infobar_service.h" |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 // If the menu is re-opened, prevent queries to update items. | 155 // If the menu is re-opened, prevent queries to update items. |
| 156 [menu setDelegate:nil]; | 156 [menu setDelegate:nil]; |
| 157 | 157 |
| 158 // Prevent target/action messages to the controller. | 158 // Prevent target/action messages to the controller. |
| 159 for (NSMenuItem* item in [menu itemArray]) { | 159 for (NSMenuItem* item in [menu itemArray]) { |
| 160 [item setEnabled:NO]; | 160 [item setEnabled:NO]; |
| 161 [item setTarget:nil]; | 161 [item setTarget:nil]; |
| 162 } | 162 } |
| 163 } | 163 } |
| 164 | 164 |
| 165 - (InfoBarDelegate*)delegate { | 165 - (infobars::InfoBarDelegate*)delegate { |
| 166 return infobar_->delegate(); | 166 return infobar_->delegate(); |
| 167 } | 167 } |
| 168 | 168 |
| 169 - (void)initializeLabel { | 169 - (void)initializeLabel { |
| 170 // Replace the label placeholder NSTextField with the real label NSTextView. | 170 // Replace the label placeholder NSTextField with the real label NSTextView. |
| 171 // The former doesn't show links in a nice way, but the latter can't be added | 171 // The former doesn't show links in a nice way, but the latter can't be added |
| 172 // in IB without a containing scroll view, so create the NSTextView | 172 // in IB without a containing scroll view, so create the NSTextView |
| 173 // programmatically. | 173 // programmatically. |
| 174 base::scoped_nsobject<HyperlinkTextView> newLabel( | 174 base::scoped_nsobject<HyperlinkTextView> newLabel( |
| 175 [[HyperlinkTextView alloc] initWithFrame:[labelPlaceholder_ frame]]); | 175 [[HyperlinkTextView alloc] initWithFrame:[labelPlaceholder_ frame]]); |
| 176 [newLabel setDrawsBackgroundUsingSuperview:YES]; | 176 [newLabel setDrawsBackgroundUsingSuperview:YES]; |
| 177 [newLabel setAutoresizingMask:[labelPlaceholder_ autoresizingMask]]; | 177 [newLabel setAutoresizingMask:[labelPlaceholder_ autoresizingMask]]; |
| 178 [[labelPlaceholder_ superview] | 178 [[labelPlaceholder_ superview] |
| 179 replaceSubview:labelPlaceholder_ with:newLabel]; | 179 replaceSubview:labelPlaceholder_ with:newLabel]; |
| 180 labelPlaceholder_ = nil; // Now released. | 180 labelPlaceholder_ = nil; // Now released. |
| 181 [newLabel setDelegate:self]; | 181 [newLabel setDelegate:self]; |
| 182 | 182 |
| 183 label_.reset(newLabel.release()); | 183 label_.reset(newLabel.release()); |
| 184 } | 184 } |
| 185 | 185 |
| 186 @end | 186 @end |
| OLD | NEW |