| OLD | NEW |
| 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 #include "app/l10n_util_mac.h" | 5 #include "app/l10n_util_mac.h" |
| 6 #include "base/mac_util.h" | 6 #include "base/mac_util.h" |
| 7 #include "base/sys_string_conversions.h" | 7 #include "base/sys_string_conversions.h" |
| 8 #include "chrome/browser/bookmarks/bookmark_model.h" | 8 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 9 #import "chrome/browser/cocoa/bookmark_bubble_controller.h" | 9 #import "chrome/browser/cocoa/bookmark_bubble_controller.h" |
| 10 #import "chrome/browser/cocoa/bookmark_bubble_window.h" | 10 #import "chrome/browser/cocoa/bookmark_bubble_window.h" |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 - (void)comboBoxSelectionDidChange:(NSNotification*)notification { | 106 - (void)comboBoxSelectionDidChange:(NSNotification*)notification { |
| 107 NSString* selected = [folderComboBox_ objectValueOfSelectedItem]; | 107 NSString* selected = [folderComboBox_ objectValueOfSelectedItem]; |
| 108 if ([selected isEqual:chooseAnotherFolder_.get()]) { | 108 if ([selected isEqual:chooseAnotherFolder_.get()]) { |
| 109 [self edit:self]; | 109 [self edit:self]; |
| 110 } | 110 } |
| 111 } | 111 } |
| 112 | 112 |
| 113 // We are the delegate of our own window so we know when we lose key. | 113 // We are the delegate of our own window so we know when we lose key. |
| 114 // When we lose key status we close, mirroring Windows behaivor. | 114 // When we lose key status we close, mirroring Windows behaivor. |
| 115 - (void)windowDidResignKey:(NSNotification*)notification { | 115 - (void)windowDidResignKey:(NSNotification*)notification { |
| 116 |
| 117 // If we get here, we are done with this window and controller. The |
| 118 // call of close: may destroy us which destroys the window. But the |
| 119 // window is in the middle of processing resignKeyWindow. We |
| 120 // retain/autorelease the window to insure it lasts until the end of |
| 121 // this event. |
| 122 [[window_ retain] autorelease]; |
| 123 |
| 116 if ([window_ isVisible]) | 124 if ([window_ isVisible]) |
| 117 [self close:self]; | 125 [self close:self]; |
| 118 } | 126 } |
| 119 | 127 |
| 120 @end // BookmarkBubbleController | 128 @end // BookmarkBubbleController |
| 121 | 129 |
| 122 | 130 |
| 123 @implementation BookmarkBubbleController(ExposedForUnitTesting) | 131 @implementation BookmarkBubbleController(ExposedForUnitTesting) |
| 124 | 132 |
| 125 // Create and return a retained NSWindow for this bubble. | 133 // Create and return a retained NSWindow for this bubble. |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 - (void)setTitle:(NSString*)title parentFolder:(NSString*)folder { | 214 - (void)setTitle:(NSString*)title parentFolder:(NSString*)folder { |
| 207 [nameTextField_ setStringValue:title]; | 215 [nameTextField_ setStringValue:title]; |
| 208 [folderComboBox_ selectItemWithObjectValue:folder]; | 216 [folderComboBox_ selectItemWithObjectValue:folder]; |
| 209 } | 217 } |
| 210 | 218 |
| 211 - (NSString*)chooseAnotherFolderString { | 219 - (NSString*)chooseAnotherFolderString { |
| 212 return chooseAnotherFolder_.get(); | 220 return chooseAnotherFolder_.get(); |
| 213 } | 221 } |
| 214 | 222 |
| 215 @end // implementation BookmarkBubbleController(ExposedForUnitTesting) | 223 @end // implementation BookmarkBubbleController(ExposedForUnitTesting) |
| OLD | NEW |