diff options
10 files changed, 32 insertions, 68 deletions
diff --git a/chrome/browser/cocoa/bookmark_all_tabs_controller.h b/chrome/browser/cocoa/bookmark_all_tabs_controller.h index 8d2d2b9..45386ed 100644 --- a/chrome/browser/cocoa/bookmark_all_tabs_controller.h +++ b/chrome/browser/cocoa/bookmark_all_tabs_controller.h @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -26,8 +26,7 @@ typedef std::vector<ActiveTabNameURLPair> ActiveTabsNameURLPairVector; - (id)initWithParentWindow:(NSWindow*)parentWindow profile:(Profile*)profile parent:(const BookmarkNode*)parent - configuration:(BookmarkEditor::Configuration)configuration - handler:(BookmarkEditor::Handler*)handler; + configuration:(BookmarkEditor::Configuration)configuration; @end @@ -42,4 +41,4 @@ typedef std::vector<ActiveTabNameURLPair> ActiveTabsNameURLPairVector; @end -#endif /* CHROME_BROWSER_COCOA_BOOKMARK_ALL_TABS_CONTROLLER_H_ */ +#endif // CHROME_BROWSER_COCOA_BOOKMARK_ALL_TABS_CONTROLLER_H_ diff --git a/chrome/browser/cocoa/bookmark_all_tabs_controller.mm b/chrome/browser/cocoa/bookmark_all_tabs_controller.mm index 8c2e236..2d8184a 100644 --- a/chrome/browser/cocoa/bookmark_all_tabs_controller.mm +++ b/chrome/browser/cocoa/bookmark_all_tabs_controller.mm @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -16,15 +16,13 @@ - (id)initWithParentWindow:(NSWindow*)parentWindow profile:(Profile*)profile parent:(const BookmarkNode*)parent - configuration:(BookmarkEditor::Configuration)configuration - handler:(BookmarkEditor::Handler*)handler { + configuration:(BookmarkEditor::Configuration)configuration { NSString* nibName = @"BookmarkAllTabs"; if ((self = [super initWithParentWindow:parentWindow nibName:nibName profile:profile parent:parent - configuration:configuration - handler:handler])) { + configuration:configuration])) { } return self; } @@ -66,7 +64,6 @@ BookmarkModel* model = [self bookmarkModel]; const BookmarkNode* newFolder = model->AddGroup(newParentNode, newIndex, newFolderString); - [self notifyHandlerCreatedNode:newFolder]; // Get a list of all open tabs, create nodes for them, and add // to the new folder node. [self UpdateActiveTabPairs]; @@ -74,9 +71,7 @@ for (ActiveTabsNameURLPairVector::const_iterator it = activeTabPairsVector_.begin(); it != activeTabPairsVector_.end(); ++it, ++i) { - const BookmarkNode* node = model->AddURL(newFolder, i, - it->first, it->second); - [self notifyHandlerCreatedNode:node]; + model->AddURL(newFolder, i, it->first, it->second); } return [NSNumber numberWithBool:YES]; } diff --git a/chrome/browser/cocoa/bookmark_all_tabs_controller_unittest.mm b/chrome/browser/cocoa/bookmark_all_tabs_controller_unittest.mm index 118a554..48dd371 100644 --- a/chrome/browser/cocoa/bookmark_all_tabs_controller_unittest.mm +++ b/chrome/browser/cocoa/bookmark_all_tabs_controller_unittest.mm @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -52,8 +52,7 @@ class BookmarkAllTabsControllerTest : public CocoaTest { initWithParentWindow:test_window() profile:helper_.profile() parent:group_a_ - configuration:BookmarkEditor::SHOW_TREE - handler:nil]; + configuration:BookmarkEditor::SHOW_TREE]; } virtual void SetUp() { diff --git a/chrome/browser/cocoa/bookmark_editor_base_controller.h b/chrome/browser/cocoa/bookmark_editor_base_controller.h index 5fbdf5e..bb8fec5 100644 --- a/chrome/browser/cocoa/bookmark_editor_base_controller.h +++ b/chrome/browser/cocoa/bookmark_editor_base_controller.h @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -33,7 +33,6 @@ class BookmarkModel; Profile* profile_; // weak const BookmarkNode* parentNode_; // weak; owned by the model BookmarkEditor::Configuration configuration_; - scoped_ptr<BookmarkEditor::Handler> handler_; // we take ownership NSString* initialName_; NSString* displayName_; // Bound to a text field in the dialog. BOOL okEnabled_; // Bound to the OK button. @@ -58,8 +57,7 @@ class BookmarkModel; nibName:(NSString*)nibName profile:(Profile*)profile parent:(const BookmarkNode*)parent - configuration:(BookmarkEditor::Configuration)configuration - handler:(BookmarkEditor::Handler*)handler; + configuration:(BookmarkEditor::Configuration)configuration; // Run the bookmark editor as a modal sheet. Does not block. - (void)runAsModalSheet; @@ -98,9 +96,6 @@ class BookmarkModel; // node is nil then select the bookmark bar node. Exposed for unit test. - (void)selectNodeInBrowser:(const BookmarkNode*)node; -// Notify the handler, if any, of a node creation. -- (void)notifyHandlerCreatedNode:(const BookmarkNode*)node; - // Notifications called when the BookmarkModel changes out from under me. - (void)nodeRemoved:(const BookmarkNode*)node fromParent:(const BookmarkNode*)parent; @@ -172,4 +167,4 @@ class BookmarkModel; @end -#endif /* CHROME_BROWSER_COCOA_BOOKMARK_EDITOR_BASE_CONTROLLER_H_ */ +#endif // CHROME_BROWSER_COCOA_BOOKMARK_EDITOR_BASE_CONTROLLER_H_ diff --git a/chrome/browser/cocoa/bookmark_editor_base_controller.mm b/chrome/browser/cocoa/bookmark_editor_base_controller.mm index ac66f20..45bf44e 100644 --- a/chrome/browser/cocoa/bookmark_editor_base_controller.mm +++ b/chrome/browser/cocoa/bookmark_editor_base_controller.mm @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -61,22 +61,19 @@ void BookmarkEditor::Show(gfx::NativeWindow parent_hwnd, const EditDetails& details, Configuration configuration) { BookmarkEditorBaseController* controller = nil; - // TODO(viettrungluu): get rid of |handler:| below and elsewhere. if (details.type == EditDetails::NEW_FOLDER) { controller = [[BookmarkAllTabsController alloc] initWithParentWindow:parent_hwnd profile:profile parent:parent - configuration:configuration - handler:NULL]; + configuration:configuration]; } else { controller = [[BookmarkEditorController alloc] initWithParentWindow:parent_hwnd profile:profile parent:parent node:details.existing_node - configuration:configuration - handler:NULL]; + configuration:configuration]; } [controller runAsModalSheet]; } @@ -164,8 +161,7 @@ class BookmarkEditorBaseControllerBridge : public BookmarkModelObserver { nibName:(NSString*)nibName profile:(Profile*)profile parent:(const BookmarkNode*)parent - configuration:(BookmarkEditor::Configuration)configuration - handler:(BookmarkEditor::Handler*)handler { + configuration:(BookmarkEditor::Configuration)configuration { NSString* nibpath = [mac_util::MainAppBundle() pathForResource:nibName ofType:@"nib"]; @@ -174,7 +170,6 @@ class BookmarkEditorBaseControllerBridge : public BookmarkModelObserver { profile_ = profile; parentNode_ = parent; configuration_ = configuration; - handler_.reset(handler); initialName_ = [@"" retain]; observer_.reset(new BookmarkEditorBaseControllerBridge(self)); [self bookmarkModel]->AddObserver(observer_.get()); @@ -335,11 +330,6 @@ class BookmarkEditorBaseControllerBridge : public BookmarkModelObserver { return selectedNode; } -- (void)notifyHandlerCreatedNode:(const BookmarkNode*)node { - if (handler_.get()) - handler_->NodeCreated(node); -} - - (NSArray*)folderTreeArray { return folderTreeArray_.get(); } @@ -478,7 +468,6 @@ class BookmarkEditorBaseControllerBridge : public BookmarkModelObserver { const BookmarkNode* newFolder = model->AddGroup(parentNode, i, base::SysNSStringToWide([subFolderInfo folderName])); - [self notifyHandlerCreatedNode:newFolder]; // Update our dictionary with the actual folder node just created. [subFolderInfo setFolderNode:newFolder]; [subFolderInfo setNewFolder:NO]; diff --git a/chrome/browser/cocoa/bookmark_editor_base_controller_unittest.mm b/chrome/browser/cocoa/bookmark_editor_base_controller_unittest.mm index 7446357..ed074a5 100644 --- a/chrome/browser/cocoa/bookmark_editor_base_controller_unittest.mm +++ b/chrome/browser/cocoa/bookmark_editor_base_controller_unittest.mm @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -67,8 +67,7 @@ class BookmarkEditorBaseControllerTest : public CocoaTest { nibName:@"BookmarkAllTabs" profile:browser_helper_.profile() parent:group_b_0_ - configuration:BookmarkEditor::SHOW_TREE - handler:nil]; + configuration:BookmarkEditor::SHOW_TREE]; } virtual void SetUp() { diff --git a/chrome/browser/cocoa/bookmark_editor_controller.h b/chrome/browser/cocoa/bookmark_editor_controller.h index 864840e..2f4129c 100644 --- a/chrome/browser/cocoa/bookmark_editor_controller.h +++ b/chrome/browser/cocoa/bookmark_editor_controller.h @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -24,8 +24,7 @@ profile:(Profile*)profile parent:(const BookmarkNode*)parent node:(const BookmarkNode*)node - configuration:(BookmarkEditor::Configuration)configuration - handler:(BookmarkEditor::Handler*)handler; + configuration:(BookmarkEditor::Configuration)configuration; @end @@ -33,4 +32,4 @@ - (NSColor *)urlFieldColor; @end -#endif /* CHROME_BROWSER_COCOA_BOOKMARK_EDITOR_CONTROLLER_H_ */ +#endif // CHROME_BROWSER_COCOA_BOOKMARK_EDITOR_CONTROLLER_H_ diff --git a/chrome/browser/cocoa/bookmark_editor_controller.mm b/chrome/browser/cocoa/bookmark_editor_controller.mm index 521f93c..97ee6c6 100644 --- a/chrome/browser/cocoa/bookmark_editor_controller.mm +++ b/chrome/browser/cocoa/bookmark_editor_controller.mm @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -26,14 +26,12 @@ profile:(Profile*)profile parent:(const BookmarkNode*)parent node:(const BookmarkNode*)node - configuration:(BookmarkEditor::Configuration)configuration - handler:(BookmarkEditor::Handler*)handler { + configuration:(BookmarkEditor::Configuration)configuration { if ((self = [super initWithParentWindow:parentWindow nibName:@"BookmarkEditor" profile:profile parent:parent - configuration:configuration - handler:handler])) { + configuration:configuration])) { // "Add Page..." has no "node" so this may be NULL. node_ = node; } @@ -129,10 +127,7 @@ newIndex = oldIndex; } // Add bookmark as new node at the end of the newly selected folder. - const BookmarkNode* node = model->AddURL(newParentNode, newIndex, - newTitle, newURL); - // Honor handler semantics: callback on node creation. - [self notifyHandlerCreatedNode:node]; + model->AddURL(newParentNode, newIndex, newTitle, newURL); return [NSNumber numberWithBool:YES]; } diff --git a/chrome/browser/cocoa/bookmark_editor_controller_unittest.mm b/chrome/browser/cocoa/bookmark_editor_controller_unittest.mm index 2405625..209fca2 100644 --- a/chrome/browser/cocoa/bookmark_editor_controller_unittest.mm +++ b/chrome/browser/cocoa/bookmark_editor_controller_unittest.mm @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -34,8 +34,7 @@ class BookmarkEditorControllerTest : public CocoaTest { profile:browser_helper_.profile() parent:default_parent_ node:default_node - configuration:BookmarkEditor::NO_TREE - handler:nil]; + configuration:BookmarkEditor::NO_TREE]; [controller_ runAsModalSheet]; } @@ -141,8 +140,7 @@ class BookmarkEditorControllerNoNodeTest : public CocoaTest { profile:browser_helper_.profile() parent:parent node:NULL - configuration:BookmarkEditor::NO_TREE - handler:nil]; + configuration:BookmarkEditor::NO_TREE]; [controller_ runAsModalSheet]; } @@ -180,8 +178,7 @@ class BookmarkEditorControllerYesNodeTest : public CocoaTest { profile:browser_helper_.profile() parent:parent node:node - configuration:BookmarkEditor::NO_TREE - handler:nil]; + configuration:BookmarkEditor::NO_TREE]; [controller_ runAsModalSheet]; } @@ -264,8 +261,7 @@ class BookmarkEditorControllerTreeTest : public CocoaTest { profile:browser_helper_.profile() parent:group_bb_ node:bookmark_bb_3_ - configuration:BookmarkEditor::SHOW_TREE - handler:nil]; + configuration:BookmarkEditor::SHOW_TREE]; } virtual void SetUp() { @@ -406,8 +402,7 @@ class BookmarkEditorControllerTreeNoNodeTest : profile:browser_helper_.profile() parent:group_bb_ node:nil - configuration:BookmarkEditor::SHOW_TREE - handler:nil]; + configuration:BookmarkEditor::SHOW_TREE]; } }; diff --git a/chrome/browser/cocoa/browser_window_controller.mm b/chrome/browser/cocoa/browser_window_controller.mm index d023663..6da85b2 100644 --- a/chrome/browser/cocoa/browser_window_controller.mm +++ b/chrome/browser/cocoa/browser_window_controller.mm @@ -1427,8 +1427,7 @@ profile:browser_->profile() parent:node->GetParent() node:node - configuration:BookmarkEditor::SHOW_TREE - handler:NULL] + configuration:BookmarkEditor::SHOW_TREE] runAsModalSheet]; } } |