Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(69)

Issue 523025: [Mac] Implement the cookie manager (Closed)

Created:
10 years, 11 months ago by Robert Sesek
Modified:
9 years, 7 months ago
CC:
chromium-reviews_googlegroups.com, Paweł Hajdan Jr., ben+cc_chromium.org, pam+watch_chromium.org, brettw+cc_chromium.org, viettrungluu, John Grabowski
Visibility:
Public.

Description

[Mac] Implement the cookie manager This CL creates the basic cookie management interface, allowing users to view and delete cookies from Chromium. TODO: (1) Add the filtering by domain capability. (2) Localize the NIB. BUG=15360 TEST=Chromium-->Preferences-->Under the Hood-->Show Cookies. Also covered by unit tests. Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=35512

Patch Set 1 #

Total comments: 22

Patch Set 2 : NSDictionary -> CocoaCookieTreeNode #

Total comments: 42

Patch Set 3 : Address all comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+3189 lines, -2 lines) Patch
M base/cocoa_protocols_mac.h View 1 chunk +1 line, -0 lines 0 comments Download
A chrome/app/nibs/Cookies.xib View 1 2 1 chunk +2263 lines, -0 lines 0 comments Download
M chrome/app/nibs/Preferences.xib View 5 chunks +12 lines, -2 lines 0 comments Download
A chrome/browser/cocoa/cookie_tree_node.h View 2 1 chunk +56 lines, -0 lines 0 comments Download
A chrome/browser/cocoa/cookie_tree_node.mm View 2 1 chunk +119 lines, -0 lines 0 comments Download
A chrome/browser/cocoa/cookies_window_controller.h View 1 2 1 chunk +114 lines, -0 lines 0 comments Download
A chrome/browser/cocoa/cookies_window_controller.mm View 1 2 1 chunk +241 lines, -0 lines 0 comments Download
A chrome/browser/cocoa/cookies_window_controller_unittest.mm View 1 2 1 chunk +366 lines, -0 lines 0 comments Download
M chrome/browser/cocoa/preferences_window_controller.h View 2 chunks +2 lines, -0 lines 0 comments Download
M chrome/browser/cocoa/preferences_window_controller.mm View 2 chunks +9 lines, -0 lines 0 comments Download
M chrome/chrome_browser.gypi View 1 2 1 chunk +4 lines, -0 lines 0 comments Download
M chrome/chrome_dll.gypi View 1 chunk +1 line, -0 lines 0 comments Download
M chrome/chrome_tests.gypi View 1 2 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 8 (0 generated)
Robert Sesek
John, could you please review this? Pinkerton is still out and I'd rather not let ...
10 years, 11 months ago (2009-12-30 16:58:52 UTC) #1
John Grabowski
Big picture I like what you've done. I've asked for some structural changes (e.g. use ...
10 years, 11 months ago (2009-12-30 20:05:49 UTC) #2
Robert Sesek
http://codereview.chromium.org/523025/diff/1/3 File chrome/app/nibs/Cookies.xib (right): http://codereview.chromium.org/523025/diff/1/3#newcode1 chrome/app/nibs/Cookies.xib:1: <?xml version="1.0" encoding="UTF-8"?> On 2009/12/30 20:05:49, John Grabowski wrote: ...
10 years, 11 months ago (2009-12-31 07:55:14 UTC) #3
John Grabowski
Overall great work. LGTM if - you add a simple unit test for CookieTreeNode - ...
10 years, 11 months ago (2010-01-04 03:02:54 UTC) #4
pink (ping after 24hrs)
Do you still want me to look at this CL? -- Mike Pinkerton Mac Weenie ...
10 years, 11 months ago (2010-01-04 14:21:46 UTC) #5
John Grabowski
I think you are asking rsesek and not me, but... if you have time, then ...
10 years, 11 months ago (2010-01-04 14:42:49 UTC) #6
pink (ping after 24hrs)
lots of little things. Also, can we use a small/narrow scrollbar in the tree, or ...
10 years, 11 months ago (2010-01-04 15:46:51 UTC) #7
Robert Sesek
10 years, 11 months ago (2010-01-04 21:47:28 UTC) #8
All comments addressed. I tried making the scroll bar small, but IB seems to
hate me and won't take it.

http://codereview.chromium.org/523025/diff/2004/27
File chrome/browser/cocoa/cookie_tree_node.h (right):

http://codereview.chromium.org/523025/diff/2004/27#newcode15
chrome/browser/cocoa/cookie_tree_node.h:15: CookieTreeNode* treeNode_;  // weak
On 2010/01/04 03:02:54, John Grabowski wrote:
> More comments would be nice here (e.g. "the non-Cocoa version of this node"). 

Done.

http://codereview.chromium.org/523025/diff/2004/27#newcode17
chrome/browser/cocoa/cookie_tree_node.h:17: // These members are only set for
true cookie nodes.
On 2010/01/04 15:46:52, pink wrote:
> What other things could be there? folders? anything else?

There's the domain-level nodes (top level) and folders (Cookies).

http://codereview.chromium.org/523025/diff/2004/27#newcode30
chrome/browser/cocoa/cookie_tree_node.h:30: -
(id)initWithNode:(CookieTreeNode*)node createChildren:(BOOL)recurse;
On 2010/01/04 15:46:52, pink wrote:
> what does createChildren do? Why do you need a choice?

It was used before I introduced |-rebuild|. Removed.

http://codereview.chromium.org/523025/diff/2004/27#newcode39
chrome/browser/cocoa/cookie_tree_node.h:39: - (NSMutableArray*)children;
On 2010/01/04 15:46:52, pink wrote:
> As we don't normally allow mutable accessors, you should probably comment on
why
> this is this way.

Done.

http://codereview.chromium.org/523025/diff/2004/27#newcode42
chrome/browser/cocoa/cookie_tree_node.h:42: // Used only by cookies.
On 2010/01/04 15:46:52, pink wrote:
> What does it return for other things? nil? empty string?

Nil.

http://codereview.chromium.org/523025/diff/2004/28
File chrome/browser/cocoa/cookie_tree_node.mm (right):

http://codereview.chromium.org/523025/diff/2004/28#newcode14
chrome/browser/cocoa/cookie_tree_node.mm:14: -
(id)initWithNode:(CookieTreeNode*)node createChildren:(BOOL)recurse {
On 2010/01/04 03:02:54, John Grabowski wrote:
> I don't mean to be excessive but we have a unit test for all files in
> browser/cocoa/*.mm.  Would hate to break that now.  Even something simple,
like
> creating one node with recursion, would be fine.

The unit tests are in cookies_window_controller_unittest.mm. There's a lot of
dummy test classes used to setup the CookieMonster in a testing profile, so
rather than duplicating that already-duplicated code, I kept the tests where
they were. I can add a test file for CocoaCookieTreeNode and add a comment
saying it's tested elsewhere, if you want.

http://codereview.chromium.org/523025/diff/2004/28#newcode16
chrome/browser/cocoa/cookie_tree_node.mm:16: treeNode_ = node;
On 2010/01/04 15:46:52, pink wrote:
> DCHECK(node)?

Done.

http://codereview.chromium.org/523025/diff/2004/28#newcode19
chrome/browser/cocoa/cookie_tree_node.mm:19: children_.reset([[NSMutableArray
alloc] initWithCapacity:childCount]);
On 2010/01/04 03:02:54, John Grabowski wrote:
> Perhaps can put alloc of this array inside the "if (recurse) { }" 

I want |-children| to always return a valid array so we can attach new children
after the node is created.

http://codereview.chromium.org/523025/diff/2004/28#newcode44
chrome/browser/cocoa/cookie_tree_node.mm:44:
name_.reset([base::SysUTF8ToNSString(cookie.Name()) retain]);
On 2010/01/04 03:02:54, John Grabowski wrote:
> If name and title are always the same do we need both variables?

They're not always the same. Only for Cookie nodes. |name| is bound in the
detail interface, and we don't want it changing when we select a folder node.
|title| is displayed in the list.

http://codereview.chromium.org/523025/diff/2004/28#newcode62
chrome/browser/cocoa/cookie_tree_node.mm:62:
sendFor_.reset([l10n_util::GetNSString(
On 2010/01/04 15:46:52, pink wrote:
> should these be GetNSStringWithFixup()?

Done.

http://codereview.chromium.org/523025/diff/2004/29
File chrome/browser/cocoa/cookies_window_controller.h (right):

http://codereview.chromium.org/523025/diff/2004/29#newcode21
chrome/browser/cocoa/cookies_window_controller.h:21: class
CookiesTreeModelObserverCocoa : public TreeModelObserver {
On 2010/01/04 15:46:52, pink wrote:
> CookiesTreeModelObserverBridge? Does this need to be part of the public api or
> can it live in the .mm file? Or is it here for testing?

Changed to Bridge. And it is exposed here for testing, yes.

http://codereview.chromium.org/523025/diff/2004/29#newcode70
chrome/browser/cocoa/cookies_window_controller.h:70: // Platform-independent
model and C++/Obj-C bridge components.
On 2010/01/04 15:46:52, pink wrote:
> @private

Done.

http://codereview.chromium.org/523025/diff/2004/29#newcode84
chrome/browser/cocoa/cookies_window_controller.h:84: @property (readonly)
NSTreeController* treeController;
On 2010/01/04 15:46:52, pink wrote:
> nonatomic?

Done.

http://codereview.chromium.org/523025/diff/2004/30
File chrome/browser/cocoa/cookies_window_controller.mm (right):

http://codereview.chromium.org/523025/diff/2004/30#newcode26
chrome/browser/cocoa/cookies_window_controller.mm:26: :
windowController_(controller) {
On 2010/01/04 15:46:52, pink wrote:
> follow c++ naming in c++ classes: window_controller_

Done.

http://codereview.chromium.org/523025/diff/2004/30#newcode40
chrome/browser/cocoa/cookies_window_controller.mm:40: CookieTreeNode*
cookie_chid = cookie_parent->GetChild(start + i);
On 2010/01/04 15:46:52, pink wrote:
> cookie_child?

Done.

http://codereview.chromium.org/523025/diff/2004/30#newcode95
chrome/browser/cocoa/cookies_window_controller.mm:95: CocoaCookieTreeNode*
CookiesTreeModelObserverCocoa::CocoaNodeFromTreeNode(
On 2010/01/04 15:46:52, pink wrote:
> naming doesn't immediately imply that this has been retained. Either clarify
the
> naming or autorelease before returning.

It's supposed to be |-autorelease|ed. I was tracking down an |-autorelease| bug
and I forgot to change this back.

http://codereview.chromium.org/523025/diff/2004/30#newcode112
chrome/browser/cocoa/cookies_window_controller.mm:112: NSMutableArray* children
= [start children];
On 2010/01/04 15:46:52, pink wrote:
> this local var can be NSArray, right? No need to make it mutable if it doesn't
> have to be.

Done.

http://codereview.chromium.org/523025/diff/2004/30#newcode123
chrome/browser/cocoa/cookies_window_controller.mm:123: return nil;  // We
couldn't find the node?
On 2010/01/04 15:46:52, pink wrote:
> why is that a question?

Because? ;)

http://codereview.chromium.org/523025/diff/2004/30#newcode129
chrome/browser/cocoa/cookies_window_controller.mm:129: @synthesize
treeController = treeController_;
On 2010/01/04 03:02:54, John Grabowski wrote:
> blank line between @impl and @synth
> 

Done.

http://codereview.chromium.org/523025/diff/2004/30#newcode187
chrome/browser/cocoa/cookies_window_controller.mm:187: NSArray* selection =
[[treeController_ selectedObjects] retain];
On 2010/01/04 15:46:52, pink wrote:
> why do you need to retain it, and why not use a scoped_nsobject?

When it wasn't retained, |selection| was being invalidated immediately. I'm not
sure why that was happening, but the fix was retaining it. Changed to a scoper,
though.

http://codereview.chromium.org/523025/diff/2004/31
File chrome/browser/cocoa/cookies_window_controller_unittest.mm (right):

http://codereview.chromium.org/523025/diff/2004/31#newcode80
chrome/browser/cocoa/cookies_window_controller_unittest.mm:80: // For some
utterly inexplicable reason, |-children| returns an NSArray rather
On 2010/01/04 03:02:54, John Grabowski wrote:
> There are subtle ways to make this happen (e.g. [[NSMutableArray array] copy]
> returns an NSArray).
> 
> Can you set a breakpoint on a call to -children, then "step into" in a
debugger
> and see where you end up?  If that doesn't work, try setting a breakpoint
right
> before the call to children, then type "break [NSArray init]" in the debugger
> console (or something like that) before continuing so we get more info.

|-children| goes to the right place. The mystery ensues.

Powered by Google App Engine
This is Rietveld 408576698