summaryrefslogtreecommitdiffstats
path: root/chrome/browser/autofill/autofill_credit_card_view_controller_mac.mm
blob: 36ea7215725202b3fe49fd281c4956c20bffe013 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#import "chrome/browser/autofill/autofill_credit_card_view_controller_mac.h"
#include "base/mac_util.h"
#include "base/sys_string_conversions.h"
#import "chrome/browser/autofill/autofill_credit_card_model_mac.h"
#include "chrome/browser/autofill/credit_card.h"

@implementation AutoFillCreditCardViewController

@synthesize creditCardModel = creditCardModel_;

- (id)initWithCreditCard:(const CreditCard&)creditCard {
  self = [super initWithNibName:@"AutoFillCreditCardFormView"
                         bundle:mac_util::MainAppBundle()];
  if (self) {
    // Pull in the view for initialization.
    [self view];

    // Create the model.
    [self setCreditCardModel:[[[AutoFillCreditCardModel alloc]
        initWithCreditCard:creditCard] autorelease]];

    // Setup initial state.
    // TODO(dhollowa): not yet implemented, disabling controls for now.
    // See http://crbug.com/33029.
    [billingAddressLabel_ setEnabled:FALSE];
    [billingAddressLabel_ setTextColor:[NSColor secondarySelectedControlColor]];
    [billingAddressPopup_ removeAllItems];
    [billingAddressPopup_ setEnabled:FALSE];
    [shippingAddressLabel_ setEnabled:FALSE];
    [shippingAddressLabel_ setTextColor:
        [NSColor secondarySelectedControlColor]];
    [shippingAddressPopup_ removeAllItems];
    [shippingAddressPopup_ setEnabled:FALSE];
  }
  return self;
}

- (void)dealloc {
  [creditCardModel_ release];
  [super dealloc];
}

- (void)copyModelToCreditCard:(CreditCard*)creditCard {
  [creditCardModel_ copyModelToCreditCard:creditCard];
}

@end