| 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_details_container.h" | 5 #import "chrome/browser/ui/cocoa/autofill/autofill_details_container.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/mac/foundation_util.h" | 9 #include "base/mac/foundation_util.h" |
| 10 #include "chrome/browser/ui/autofill/autofill_dialog_controller.h" | 10 #include "chrome/browser/ui/autofill/autofill_dialog_view_delegate.h" |
| 11 #import "chrome/browser/ui/cocoa/autofill/autofill_section_container.h" | 11 #import "chrome/browser/ui/cocoa/autofill/autofill_section_container.h" |
| 12 #import "chrome/browser/ui/cocoa/info_bubble_view.h" | 12 #import "chrome/browser/ui/cocoa/info_bubble_view.h" |
| 13 #include "skia/ext/skia_utils_mac.h" | 13 #include "skia/ext/skia_utils_mac.h" |
| 14 | 14 |
| 15 namespace { | 15 namespace { |
| 16 | 16 |
| 17 // Imported constant from Views version. TODO(groby): Share. | 17 // Imported constant from Views version. TODO(groby): Share. |
| 18 SkColor const kWarningColor = 0xffde4932; // SkColorSetRGB(0xde, 0x49, 0x32); | 18 SkColor const kWarningColor = 0xffde4932; // SkColorSetRGB(0xde, 0x49, 0x32); |
| 19 | 19 |
| 20 } // namespace | 20 } // namespace |
| 21 | 21 |
| 22 @interface AutofillDetailsContainer () | 22 @interface AutofillDetailsContainer () |
| 23 // Compute infobubble origin based on anchor/view. | 23 // Compute infobubble origin based on anchor/view. |
| 24 - (NSPoint)originFromAnchorView:(NSView*)view; | 24 - (NSPoint)originFromAnchorView:(NSView*)view; |
| 25 @end | 25 @end |
| 26 | 26 |
| 27 @implementation AutofillDetailsContainer | 27 @implementation AutofillDetailsContainer |
| 28 | 28 |
| 29 - (id)initWithController:(autofill::AutofillDialogController*)controller { | 29 - (id)initWithDelegate:(autofill::AutofillDialogViewDelegate*)delegate { |
| 30 if (self = [super init]) { | 30 if (self = [super init]) { |
| 31 controller_ = controller; | 31 delegate_ = delegate; |
| 32 } | 32 } |
| 33 return self; | 33 return self; |
| 34 } | 34 } |
| 35 | 35 |
| 36 - (void)addSection:(autofill::DialogSection)section { | 36 - (void)addSection:(autofill::DialogSection)section { |
| 37 base::scoped_nsobject<AutofillSectionContainer> sectionContainer( | 37 base::scoped_nsobject<AutofillSectionContainer> sectionContainer( |
| 38 [[AutofillSectionContainer alloc] initWithController:controller_ | 38 [[AutofillSectionContainer alloc] initWithDelegate:delegate_ |
| 39 forSection:section]); | 39 forSection:section]); |
| 40 [sectionContainer setValidationDelegate:self]; | 40 [sectionContainer setValidationDelegate:self]; |
| 41 [details_ addObject:sectionContainer]; | 41 [details_ addObject:sectionContainer]; |
| 42 } | 42 } |
| 43 | 43 |
| 44 - (void)loadView { | 44 - (void)loadView { |
| 45 details_.reset([[NSMutableArray alloc] init]); | 45 details_.reset([[NSMutableArray alloc] init]); |
| 46 | 46 |
| 47 [self addSection:autofill::SECTION_EMAIL]; | 47 [self addSection:autofill::SECTION_EMAIL]; |
| 48 [self addSection:autofill::SECTION_CC]; | 48 [self addSection:autofill::SECTION_CC]; |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 [infoBubble_ setFrameSize:bubbleSize]; | 165 [infoBubble_ setFrameSize:bubbleSize]; |
| 166 [label setFrameOrigin:NSMakePoint(labelInset, labelInset)]; | 166 [label setFrameOrigin:NSMakePoint(labelInset, labelInset)]; |
| 167 [infoBubble_ setFrameOrigin:[self originFromAnchorView:field]]; | 167 [infoBubble_ setFrameOrigin:[self originFromAnchorView:field]]; |
| 168 [infoBubble_ setHidden:NO]; | 168 [infoBubble_ setHidden:NO]; |
| 169 } else { | 169 } else { |
| 170 [infoBubble_ setHidden:YES]; | 170 [infoBubble_ setHidden:YES]; |
| 171 } | 171 } |
| 172 } | 172 } |
| 173 | 173 |
| 174 @end | 174 @end |
| OLD | NEW |