OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/content_settings/cookie_tree_node.h" | 5 #import "chrome/browser/ui/cocoa/content_settings/cookie_tree_node.h" |
6 | 6 |
7 #include "base/strings/sys_string_conversions.h" | 7 #include "base/strings/sys_string_conversions.h" |
8 | 8 |
9 @implementation CocoaCookieTreeNode | 9 @implementation CocoaCookieTreeNode |
10 | 10 |
(...skipping 25 matching lines...) Expand all Loading... |
36 - (ui::TreeModelNode*)treeNode { | 36 - (ui::TreeModelNode*)treeNode { |
37 return treeNode_; | 37 return treeNode_; |
38 } | 38 } |
39 | 39 |
40 - (NSMutableArray*)mutableChildren { | 40 - (NSMutableArray*)mutableChildren { |
41 if (!children_.get()) { | 41 if (!children_.get()) { |
42 const int childCount = treeNode_->child_count(); | 42 const int childCount = treeNode_->child_count(); |
43 children_.reset([[NSMutableArray alloc] initWithCapacity:childCount]); | 43 children_.reset([[NSMutableArray alloc] initWithCapacity:childCount]); |
44 for (int i = 0; i < childCount; ++i) { | 44 for (int i = 0; i < childCount; ++i) { |
45 CookieTreeNode* child = treeNode_->GetChild(i); | 45 CookieTreeNode* child = treeNode_->GetChild(i); |
46 scoped_nsobject<CocoaCookieTreeNode> childNode( | 46 base::scoped_nsobject<CocoaCookieTreeNode> childNode( |
47 [[CocoaCookieTreeNode alloc] initWithNode:child]); | 47 [[CocoaCookieTreeNode alloc] initWithNode:child]); |
48 [children_ addObject:childNode.get()]; | 48 [children_ addObject:childNode.get()]; |
49 } | 49 } |
50 } | 50 } |
51 return children_.get(); | 51 return children_.get(); |
52 } | 52 } |
53 | 53 |
54 - (NSArray*)children { | 54 - (NSArray*)children { |
55 return [self mutableChildren]; | 55 return [self mutableChildren]; |
56 } | 56 } |
57 | 57 |
58 - (BOOL)isLeaf { | 58 - (BOOL)isLeaf { |
59 return [self nodeType] != kCocoaCookieDetailsTypeFolder; | 59 return [self nodeType] != kCocoaCookieDetailsTypeFolder; |
60 }; | 60 }; |
61 | 61 |
62 - (NSString*)description { | 62 - (NSString*)description { |
63 NSString* format = | 63 NSString* format = |
64 @"<CocoaCookieTreeNode @ %p (title=%@, nodeType=%d, childCount=%u)"; | 64 @"<CocoaCookieTreeNode @ %p (title=%@, nodeType=%d, childCount=%u)"; |
65 return [NSString stringWithFormat:format, self, [self title], | 65 return [NSString stringWithFormat:format, self, [self title], |
66 [self nodeType], [[self children] count]]; | 66 [self nodeType], [[self children] count]]; |
67 } | 67 } |
68 | 68 |
69 - (CocoaCookieDetails*)details { | 69 - (CocoaCookieDetails*)details { |
70 return details_; | 70 return details_; |
71 } | 71 } |
72 | 72 |
73 @end | 73 @end |
OLD | NEW |