| 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/bookmarks/bookmark_name_folder_controller.h" | 5 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_name_folder_controller.h" |
| 6 | 6 |
| 7 #include "base/mac/bundle_locations.h" | 7 #include "base/mac/bundle_locations.h" |
| 8 #include "base/mac/mac_util.h" | 8 #include "base/mac/mac_util.h" |
| 9 #include "base/strings/sys_string_conversions.h" | 9 #include "base/strings/sys_string_conversions.h" |
| 10 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 10 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 [nameField_ setStringValue:initialName_.get()]; | 73 [nameField_ setStringValue:initialName_.get()]; |
| 74 [[nameField_ cell] setUsesSingleLineMode:YES]; | 74 [[nameField_ cell] setUsesSingleLineMode:YES]; |
| 75 | 75 |
| 76 [okButton_ setTitle:l10n_util::GetNSStringWithFixup(node_ ? IDS_SAVE : | 76 [okButton_ setTitle:l10n_util::GetNSStringWithFixup(node_ ? IDS_SAVE : |
| 77 IDS_ADD)]; | 77 IDS_ADD)]; |
| 78 } | 78 } |
| 79 | 79 |
| 80 - (void)runAsModalSheet { | 80 - (void)runAsModalSheet { |
| 81 // Ping me when things change out from under us. | 81 // Ping me when things change out from under us. |
| 82 observer_.reset(new BookmarkModelObserverForCocoa( | 82 observer_.reset(new BookmarkModelObserverForCocoa( |
| 83 node_, BookmarkModelFactory::GetForProfile(profile_), | 83 BookmarkModelFactory::GetForProfile(profile_), |
| 84 self, | 84 ^(BOOL nodeWasDeleted) { |
| 85 @selector(cancel:))); | 85 [self cancel:nil]; |
| 86 })); |
| 87 observer_->StartObservingNode(node_); |
| 86 [NSApp beginSheet:[self window] | 88 [NSApp beginSheet:[self window] |
| 87 modalForWindow:parentWindow_ | 89 modalForWindow:parentWindow_ |
| 88 modalDelegate:self | 90 modalDelegate:self |
| 89 didEndSelector:@selector(didEndSheet:returnCode:contextInfo:) | 91 didEndSelector:@selector(didEndSheet:returnCode:contextInfo:) |
| 90 contextInfo:nil]; | 92 contextInfo:nil]; |
| 91 } | 93 } |
| 92 | 94 |
| 93 - (IBAction)cancel:(id)sender { | 95 - (IBAction)cancel:(id)sender { |
| 94 [NSApp endSheet:[self window]]; | 96 [NSApp endSheet:[self window]]; |
| 95 } | 97 } |
| (...skipping 25 matching lines...) Expand all Loading... |
| 121 | 123 |
| 122 - (void)setFolderName:(NSString*)name { | 124 - (void)setFolderName:(NSString*)name { |
| 123 [nameField_ setStringValue:name]; | 125 [nameField_ setStringValue:name]; |
| 124 } | 126 } |
| 125 | 127 |
| 126 - (NSButton*)okButton { | 128 - (NSButton*)okButton { |
| 127 return okButton_; | 129 return okButton_; |
| 128 } | 130 } |
| 129 | 131 |
| 130 @end // BookmarkNameFolderController | 132 @end // BookmarkNameFolderController |
| OLD | NEW |