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