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 #include "chrome/browser/ui/cocoa/autofill/autofill_dialog_cocoa.h" | 5 #include "chrome/browser/ui/cocoa/autofill/autofill_dialog_cocoa.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/mac/scoped_nsobject.h" | 8 #include "base/mac/scoped_nsobject.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/strings/sys_string_conversions.h" | 10 #include "base/strings/sys_string_conversions.h" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 void AutofillDialogCocoa::UpdateSection(DialogSection section) { | 92 void AutofillDialogCocoa::UpdateSection(DialogSection section) { |
93 [sheet_delegate_ updateSection:section]; | 93 [sheet_delegate_ updateSection:section]; |
94 } | 94 } |
95 | 95 |
96 void AutofillDialogCocoa::FillSection(DialogSection section, | 96 void AutofillDialogCocoa::FillSection(DialogSection section, |
97 const DetailInput& originating_input) { | 97 const DetailInput& originating_input) { |
98 [sheet_delegate_ fillSection:section forInput:originating_input]; | 98 [sheet_delegate_ fillSection:section forInput:originating_input]; |
99 } | 99 } |
100 | 100 |
101 void AutofillDialogCocoa::GetUserInput(DialogSection section, | 101 void AutofillDialogCocoa::GetUserInput(DialogSection section, |
102 DetailOutputMap* output) { | 102 FieldValueMap* output) { |
103 [sheet_delegate_ getInputs:output forSection:section]; | 103 [sheet_delegate_ getInputs:output forSection:section]; |
104 } | 104 } |
105 | 105 |
106 string16 AutofillDialogCocoa::GetCvc() { | 106 string16 AutofillDialogCocoa::GetCvc() { |
107 return base::SysNSStringToUTF16([sheet_delegate_ getCvc]); | 107 return base::SysNSStringToUTF16([sheet_delegate_ getCvc]); |
108 } | 108 } |
109 | 109 |
110 bool AutofillDialogCocoa::HitTestInput(const DetailInput& input, | 110 bool AutofillDialogCocoa::HitTestInput(const DetailInput& input, |
111 const gfx::Point& screen_point) { | 111 const gfx::Point& screen_point) { |
112 // TODO(dbeam): implement. | 112 // TODO(dbeam): implement. |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 [sheet_delegate_ accept:nil]; | 146 [sheet_delegate_ accept:nil]; |
147 } | 147 } |
148 | 148 |
149 void AutofillDialogCocoa::CancelForTesting() { | 149 void AutofillDialogCocoa::CancelForTesting() { |
150 [sheet_delegate_ cancel:nil]; | 150 [sheet_delegate_ cancel:nil]; |
151 } | 151 } |
152 | 152 |
153 string16 AutofillDialogCocoa::GetTextContentsOfInput(const DetailInput& input) { | 153 string16 AutofillDialogCocoa::GetTextContentsOfInput(const DetailInput& input) { |
154 for (size_t i = SECTION_MIN; i <= SECTION_MAX; ++i) { | 154 for (size_t i = SECTION_MIN; i <= SECTION_MAX; ++i) { |
155 DialogSection section = static_cast<DialogSection>(i); | 155 DialogSection section = static_cast<DialogSection>(i); |
156 DetailOutputMap contents; | 156 FieldValueMap contents; |
157 [sheet_delegate_ getInputs:&contents forSection:section]; | 157 [sheet_delegate_ getInputs:&contents forSection:section]; |
158 DetailOutputMap::const_iterator it = contents.find(&input); | 158 FieldValueMap::const_iterator it = contents.find(input.type); |
159 if (it != contents.end()) | 159 if (it != contents.end()) |
160 return it->second; | 160 return it->second; |
161 } | 161 } |
162 | 162 |
163 NOTREACHED(); | 163 NOTREACHED(); |
164 return string16(); | 164 return string16(); |
165 } | 165 } |
166 | 166 |
167 void AutofillDialogCocoa::SetTextContentsOfInput(const DetailInput& input, | 167 void AutofillDialogCocoa::SetTextContentsOfInput(const DetailInput& input, |
168 const string16& contents) { | 168 const string16& contents) { |
(...skipping 26 matching lines...) Expand all Loading... |
195 } | 195 } |
196 | 196 |
197 void AutofillDialogCocoa::OnConstrainedWindowClosed( | 197 void AutofillDialogCocoa::OnConstrainedWindowClosed( |
198 ConstrainedWindowMac* window) { | 198 ConstrainedWindowMac* window) { |
199 constrained_window_.reset(); | 199 constrained_window_.reset(); |
200 // |this| belongs to |delegate_|, so no self-destruction here. | 200 // |this| belongs to |delegate_|, so no self-destruction here. |
201 delegate_->ViewClosed(); | 201 delegate_->ViewClosed(); |
202 } | 202 } |
203 | 203 |
204 } // autofill | 204 } // autofill |
OLD | NEW |