Commit 5fe7264c authored by jrg@chromium.org's avatar jrg@chromium.org

CL which includes http://codereview.chromium.org/337006 for mrossetti

Also includes a unit test fix.
BUG=21908

TEST=Control-click on the bookmark bar, either on an existing folder
or on the blank area and choose "Add Folder..." from the contextual
menu. A sheet will drop down from the bookmark bar asking for the name
of the folder to add. The edit field will be populated with the
proposed name 'New folder'. ('New folder' will be appropriately
localized.)


Review URL: http://codereview.chromium.org/329031

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30207 0039d316-1c4b-4281-b951-d872f2087c98
parent 86a4e23c
......@@ -2,10 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "app/l10n_util.h"
#include "base/mac_util.h"
#include "base/sys_string_conversions.h"
#include "chrome/browser/profile.h"
#import "chrome/browser/cocoa/bookmark_name_folder_controller.h"
#include "grit/generated_resources.h"
@implementation BookmarkNameFolderController
......@@ -19,23 +21,15 @@
parentWindow_ = window;
profile_ = profile;
node_ = node;
if (node_) {
initialName_.reset([base::SysWideToNSString(node_->GetTitle()) retain]);
} else {
initialName_.reset([@"" retain]);
}
std::wstring newFolderString =
l10n_util::GetString(IDS_BOOMARK_EDITOR_NEW_FOLDER_NAME);
initialName_.reset([base::SysWideToNSString(newFolderString) retain]);
}
return self;
}
- (void)awakeFromNib {
[nameField_ setStringValue:initialName_.get()];
if (node_) {
// TODO(jrg)?: on Windows the dialog is named either New Folder or
// Edit Folder Name. However, since we're a sheet on the Mac, the
// title is never seen. If we switch from a sheet, correct the
// title right here.
}
[self controlTextDidChange:nil];
}
......
......@@ -74,7 +74,9 @@ TEST_F(BookmarkNameFolderControllerTest, EditAndConfirmOKButton) {
profile:helper_.profile()
node:node]);
[controller window]; // force nib load
EXPECT_FALSE([[controller okButton] isEnabled]);
// We start enabled since the default "New Folder" is added for us.
EXPECT_TRUE([[controller okButton] isEnabled]);
[controller setFolderName:@"Bozo"];
EXPECT_TRUE([[controller okButton] isEnabled]);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment