| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/autofill/autofill_main_container.h" | 5 #import "chrome/browser/ui/cocoa/autofill/autofill_main_container.h" |
| 6 | 6 |
| 7 #include "chrome/browser/ui/cocoa/autofill/autofill_dialog_constants.h" | 7 #include "chrome/browser/ui/cocoa/autofill/autofill_dialog_constants.h" |
| 8 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_button.h" | 8 #import "chrome/browser/ui/cocoa/constrained_window/constrained_window_button.h" |
| 9 #import "chrome/browser/ui/cocoa/autofill/autofill_account_chooser.h" | 9 #import "chrome/browser/ui/cocoa/autofill/autofill_account_chooser.h" |
| 10 #import "chrome/browser/ui/cocoa/autofill/autofill_details_container.h" |
| 10 #import "chrome/browser/ui/cocoa/key_equivalent_constants.h" | 11 #import "chrome/browser/ui/cocoa/key_equivalent_constants.h" |
| 11 #include "grit/generated_resources.h" | 12 #include "grit/generated_resources.h" |
| 12 #import "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h" | 13 #import "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h" |
| 13 #include "ui/base/cocoa/window_size_constants.h" | 14 #include "ui/base/cocoa/window_size_constants.h" |
| 14 #include "ui/base/l10n/l10n_util.h" | 15 #include "ui/base/l10n/l10n_util.h" |
| 15 | 16 |
| 16 @interface AutofillMainContainer (Private) | 17 @interface AutofillMainContainer (Private) |
| 17 - (void)buildWindowButtonsForFrame:(NSRect)frame; | 18 - (void)buildWindowButtonsForFrame:(NSRect)frame; |
| 18 - (void)layoutButtons; | 19 - (void)layoutButtons; |
| 19 - (void)closeSheet:(id)sender; | 20 - (void)closeSheet:(id)sender; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 41 [accountChooser_ setAutoresizingMask:(NSViewWidthSizable | NSViewMinYMargin)]; | 42 [accountChooser_ setAutoresizingMask:(NSViewWidthSizable | NSViewMinYMargin)]; |
| 42 | 43 |
| 43 [self buildWindowButtonsForFrame:NSZeroRect]; | 44 [self buildWindowButtonsForFrame:NSZeroRect]; |
| 44 | 45 |
| 45 scoped_nsobject<NSView> view([[NSView alloc] initWithFrame:NSZeroRect]); | 46 scoped_nsobject<NSView> view([[NSView alloc] initWithFrame:NSZeroRect]); |
| 46 [view setAutoresizesSubviews:YES]; | 47 [view setAutoresizesSubviews:YES]; |
| 47 [view setSubviews:@[accountChooser_, buttonContainer_]]; | 48 [view setSubviews:@[accountChooser_, buttonContainer_]]; |
| 48 self.view = view; | 49 self.view = view; |
| 49 | 50 |
| 50 [self layoutButtons]; | 51 [self layoutButtons]; |
| 52 |
| 53 detailsContainer_.reset( |
| 54 [[AutofillDetailsContainer alloc] initWithController:controller_]); |
| 55 NSSize frameSize = [[detailsContainer_ view] frame].size; |
| 56 [[detailsContainer_ view] setFrameOrigin: |
| 57 NSMakePoint(0, NSHeight([buttonContainer_ frame]))]; |
| 58 frameSize.height += NSHeight([accountChooser_ frame]); |
| 59 frameSize.height += NSHeight([buttonContainer_ frame]); |
| 60 [[detailsContainer_ view] setFrameOrigin: |
| 61 NSMakePoint(0, NSHeight([buttonContainer_ frame]))]; |
| 62 [self.view setFrameSize:frameSize]; |
| 63 [self.view addSubview:[detailsContainer_ view]]; |
| 51 } | 64 } |
| 52 | 65 |
| 53 - (void)buildWindowButtonsForFrame:(NSRect)frame { | 66 - (void)buildWindowButtonsForFrame:(NSRect)frame { |
| 54 if (buttonContainer_.get()) | 67 if (buttonContainer_.get()) |
| 55 return; | 68 return; |
| 56 | 69 |
| 57 buttonContainer_.reset([[GTMWidthBasedTweaker alloc] initWithFrame: | 70 buttonContainer_.reset([[GTMWidthBasedTweaker alloc] initWithFrame: |
| 58 ui::kWindowSizeDeterminedLater]); | 71 ui::kWindowSizeDeterminedLater]); |
| 59 [buttonContainer_ | 72 [buttonContainer_ |
| 60 setAutoresizingMask:(NSViewMinXMargin | NSViewMaxYMargin)]; | 73 setAutoresizingMask:(NSViewMinXMargin | NSViewMaxYMargin)]; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 return accountChooser_; | 109 return accountChooser_; |
| 97 } | 110 } |
| 98 | 111 |
| 99 - (void)closeSheet:(id)sender { | 112 - (void)closeSheet:(id)sender { |
| 100 [target_ closeSheet:sender]; | 113 [target_ closeSheet:sender]; |
| 101 } | 114 } |
| 102 | 115 |
| 103 | 116 |
| 104 @end | 117 @end |
| 105 | 118 |
| OLD | NEW |