summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa
diff options
context:
space:
mode:
authortfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-11 01:38:50 +0000
committertfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-11 01:38:50 +0000
commit3ce9f01e0678bcdf044efeb871fef4179573a3bc (patch)
tree3fbc53f60a12953d163d32802cfa56fe5a062dd4 /chrome/browser/cocoa
parent071f94e501d86db8dfa2a3c0806a2388216bb239 (diff)
downloadchromium_src-3ce9f01e0678bcdf044efeb871fef4179573a3bc.zip
chromium_src-3ce9f01e0678bcdf044efeb871fef4179573a3bc.tar.gz
chromium_src-3ce9f01e0678bcdf044efeb871fef4179573a3bc.tar.bz2
Cleanup: Get rid of TreeNodeChildrenReordered.
Reason: This function was never implemented by TreeNodeModel and is unlike it will be. Also it proved to not be necessary at all. BUG=None TEST=trybots Review URL: http://codereview.chromium.org/3091016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@55657 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa')
-rw-r--r--chrome/browser/cocoa/cookies_window_controller.h12
-rw-r--r--chrome/browser/cocoa/cookies_window_controller.mm29
-rw-r--r--chrome/browser/cocoa/cookies_window_controller_unittest.mm50
3 files changed, 2 insertions, 89 deletions
diff --git a/chrome/browser/cocoa/cookies_window_controller.h b/chrome/browser/cocoa/cookies_window_controller.h
index ea3e0fd..0f6217f 100644
--- a/chrome/browser/cocoa/cookies_window_controller.h
+++ b/chrome/browser/cocoa/cookies_window_controller.h
@@ -27,25 +27,17 @@ class CookiesTreeModelObserverBridge : public CookiesTreeModel::Observer {
public:
explicit CookiesTreeModelObserverBridge(CookiesWindowController* controller);
- // Notification that nodes were added to the specified parent.
+ // Begin TreeModelObserver implementation.
virtual void TreeNodesAdded(TreeModel* model,
TreeModelNode* parent,
int start,
int count);
-
- // Notification that nodes were removed from the specified parent.
virtual void TreeNodesRemoved(TreeModel* model,
TreeModelNode* parent,
int start,
int count);
-
- // Notification the children of |parent| have been reordered. Note, only
- // the direct children of |parent| have been reordered, not descendants.
- virtual void TreeNodeChildrenReordered(TreeModel* model,
- TreeModelNode* parent);
-
- // Notification that the contents of a node has changed.
virtual void TreeNodeChanged(TreeModel* model, TreeModelNode* node);
+ // End TreeModelObserver implementation.
virtual void TreeModelBeginBatch(CookiesTreeModel* model);
virtual void TreeModelEndBatch(CookiesTreeModel* model);
diff --git a/chrome/browser/cocoa/cookies_window_controller.mm b/chrome/browser/cocoa/cookies_window_controller.mm
index 6085279..0984294 100644
--- a/chrome/browser/cocoa/cookies_window_controller.mm
+++ b/chrome/browser/cocoa/cookies_window_controller.mm
@@ -70,35 +70,6 @@ void CookiesTreeModelObserverBridge::TreeNodesRemoved(TreeModel* model,
[window_controller_ didChangeValueForKey:kCocoaTreeModel];
}
-// Notification the children of |parent| have been reordered. Note, only
-// the direct children of |parent| have been reordered, not descendants.
-void CookiesTreeModelObserverBridge::TreeNodeChildrenReordered(TreeModel* model,
- TreeModelNode* parent) {
- // We're in for a major rebuild. Ignore this request.
- if (batch_update_ || !HasCocoaModel())
- return;
-
- CocoaCookieTreeNode* cocoa_parent = FindCocoaNode(parent, nil);
- NSMutableArray* cocoa_children = [cocoa_parent mutableChildren];
-
- CookieTreeNode* cookie_parent = static_cast<CookieTreeNode*>(parent);
- const int child_count = cookie_parent->GetChildCount();
-
- [window_controller_ willChangeValueForKey:kCocoaTreeModel];
- for (int i = 0; i < child_count; ++i) {
- CookieTreeNode* swap_in = cookie_parent->GetChild(i);
- for (int j = i; j < child_count; ++j) {
- CocoaCookieTreeNode* child = [cocoa_children objectAtIndex:j];
- TreeModelNode* swap_out = [child treeNode];
- if (swap_in == swap_out) {
- [cocoa_children exchangeObjectAtIndex:j withObjectAtIndex:i];
- break;
- }
- }
- }
- [window_controller_ didChangeValueForKey:kCocoaTreeModel];
-}
-
// Notification that the contents of a node has changed.
void CookiesTreeModelObserverBridge::TreeNodeChanged(TreeModel* model,
TreeModelNode* node) {
diff --git a/chrome/browser/cocoa/cookies_window_controller_unittest.mm b/chrome/browser/cocoa/cookies_window_controller_unittest.mm
index 531d0c2..967d918 100644
--- a/chrome/browser/cocoa/cookies_window_controller_unittest.mm
+++ b/chrome/browser/cocoa/cookies_window_controller_unittest.mm
@@ -275,56 +275,6 @@ TEST_F(CookiesWindowControllerTest, TreeNodesRemoved) {
EXPECT_NSEQ(@"A", title);
}
-TEST_F(CookiesWindowControllerTest, TreeNodeChildrenReordered) {
- const GURL url = GURL("http://foo.com");
- TestingProfile* profile = browser_helper_.profile();
- net::CookieMonster* cm = profile->GetCookieMonster();
- cm->SetCookie(url, "A=B");
- cm->SetCookie(url, "C=D");
- cm->SetCookie(url, "E=F");
-
- controller_.reset(
- [[CookiesWindowController alloc] initWithProfile:profile
- databaseHelper:database_helper_
- storageHelper:local_storage_helper_
- appcacheHelper:appcache_helper_]);
-
- // Root --> foo.com --> Cookies.
- NSMutableArray* cocoa_children =
- [[[[[[controller_ cocoaTreeModel] children] objectAtIndex:0]
- children] objectAtIndex:0] mutableChildren];
- EXPECT_EQ(3U, [cocoa_children count]);
-
- // Check default ordering.
- CocoaCookieTreeNode* node = [cocoa_children objectAtIndex:0];
- EXPECT_NSEQ(@"A", [[node details] name]);
- node = [cocoa_children objectAtIndex:1];
- EXPECT_NSEQ(@"C", [[node details] name]);
- node = [cocoa_children objectAtIndex:2];
- EXPECT_NSEQ(@"E", [[node details] name]);
-
- CookiesTreeModel* model = [controller_ treeModel];
- // Root --> foo.com --> Cookies.
- CookieTreeNode* parent = model->GetRoot()->GetChild(0)->GetChild(0);
-
- // Reorder the nodes.
- CookieTreeNode* node_e = parent->Remove(2);
- CookieTreeNode* node_c = parent->Remove(1);
- parent->Add(0, node_e);
- parent->Add(2, node_c);
-
- // Notify the observer of the reordering.
- [controller_ modelObserver]->TreeNodeChildrenReordered(model, parent);
-
- // Check the new order.
- node = [cocoa_children objectAtIndex:0];
- EXPECT_NSEQ(@"E", [[node details] name]);
- node = [cocoa_children objectAtIndex:1];
- EXPECT_NSEQ(@"A", [[node details] name]);
- node = [cocoa_children objectAtIndex:2];
- EXPECT_NSEQ(@"C", [[node details] name]);
-}
-
TEST_F(CookiesWindowControllerTest, TreeNodeChanged) {
const GURL url = GURL("http://foo.com");
TestingProfile* profile = browser_helper_.profile();