diff options
author | danno@chromium.org <danno@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-25 09:38:02 +0000 |
---|---|---|
committer | danno@chromium.org <danno@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-25 09:38:02 +0000 |
commit | c7ae70250e69ce895b8c1bb98b0af5ae6c045cc9 (patch) | |
tree | c2e21cfe1b27f92a300ebb65f88c037ecda34b0a /chrome/browser/cocoa/cookie_details_view_controller.mm | |
parent | 6cca3e8d0074773db63858def6cbcfb34670134c (diff) | |
download | chromium_src-c7ae70250e69ce895b8c1bb98b0af5ae6c045cc9.zip chromium_src-c7ae70250e69ce895b8c1bb98b0af5ae6c045cc9.tar.gz chromium_src-c7ae70250e69ce895b8c1bb98b0af5ae6c045cc9.tar.bz2 |
[Mac] Allow user to change cookie expiration date in cookie prompt
Added the necessary code and madde xib changes to make it possible to select "When I close my browser" as the expiration for a cookie in the cookie prompt dialog.
xib changes:
- Add explicit outlet to details view controller for the layout tweaker so that can be called explicitly from code.
- Modify already existing popup menu for selecting cookie expiration to have the right menu items: item 1 is content.details.expires and item 2 is ^IDS_COOKIES_COOKIE_EXPIRES_SESSION.
- Wire the hidden binding of the expiration menu to the key value path content.details.canEditExpiration with a NSNegateBoolean transformer.
- Wire the visibility of the "expires" text in cookie details to the key value path content.details.canEditExpiration.
BUG=http://crbug.com/38405
TEST=manual testing, new units tests
Review URL: http://codereview.chromium.org/1134005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42590 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/cookie_details_view_controller.mm')
-rw-r--r-- | chrome/browser/cocoa/cookie_details_view_controller.mm | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/chrome/browser/cocoa/cookie_details_view_controller.mm b/chrome/browser/cocoa/cookie_details_view_controller.mm index 70da2a5..ea1801f 100644 --- a/chrome/browser/cocoa/cookie_details_view_controller.mm +++ b/chrome/browser/cocoa/cookie_details_view_controller.mm @@ -10,6 +10,7 @@ #include "base/sys_string_conversions.h" #import "chrome/browser/cocoa/cookie_tree_node.h" #import "chrome/browser/cookie_modal_dialog.h" +#import "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h" namespace { static const int kMinimalLabelOffsetFromViewBottom = 20; @@ -48,7 +49,18 @@ static const int kMinimalLabelOffsetFromViewBottom = 20; } - (void)setContentObject:(id)content { + // Make sure the view is loaded before we set the content object, + // otherwise, the KVO notifications to update the content don't + // reach the view and all of the detail values are default + // strings. + NSView* view = [self view]; + [objectController_ setValue:content forKey:@"content"]; + + // View needs to be re-tweaked after setting the content object, + // since the expiration date may have changed, changing the + // size of the expiration popup. + [tweaker_ tweakUI:view]; } - (void)shrinkViewToFit { @@ -77,4 +89,18 @@ static const int kMinimalLabelOffsetFromViewBottom = 20; options:nil]; } +- (IBAction)setCookieDoesntHaveExplicitExpiration:(id)sender { + [[[objectController_ content] details] setHasExpiration:NO]; +} + +- (IBAction)setCookieHasExplicitExpiration:(id)sender { + [[[objectController_ content] details] setHasExpiration:YES]; +} + +@dynamic hasExpiration; + +- (BOOL)hasExpiration { + return [[[objectController_ content] details] hasExpiration]; +} + @end |