| 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 void AutofillDialogCocoa::UpdateSection(DialogSection section) { | 95 void AutofillDialogCocoa::UpdateSection(DialogSection section) { |
| 96 [sheet_delegate_ updateSection:section]; | 96 [sheet_delegate_ updateSection:section]; |
| 97 } | 97 } |
| 98 | 98 |
| 99 void AutofillDialogCocoa::FillSection(DialogSection section, | 99 void AutofillDialogCocoa::FillSection(DialogSection section, |
| 100 const DetailInput& originating_input) { | 100 const DetailInput& originating_input) { |
| 101 [sheet_delegate_ fillSection:section forInput:originating_input]; | 101 [sheet_delegate_ fillSection:section forInput:originating_input]; |
| 102 } | 102 } |
| 103 | 103 |
| 104 void AutofillDialogCocoa::GetUserInput(DialogSection section, | 104 void AutofillDialogCocoa::GetUserInput(DialogSection section, |
| 105 DetailOutputMap* output) { | 105 FieldValueMap* output) { |
| 106 [sheet_delegate_ getInputs:output forSection:section]; | 106 [sheet_delegate_ getInputs:output forSection:section]; |
| 107 } | 107 } |
| 108 | 108 |
| 109 string16 AutofillDialogCocoa::GetCvc() { | 109 string16 AutofillDialogCocoa::GetCvc() { |
| 110 return base::SysNSStringToUTF16([sheet_delegate_ getCvc]); | 110 return base::SysNSStringToUTF16([sheet_delegate_ getCvc]); |
| 111 } | 111 } |
| 112 | 112 |
| 113 bool AutofillDialogCocoa::HitTestInput(const DetailInput& input, | 113 bool AutofillDialogCocoa::HitTestInput(const DetailInput& input, |
| 114 const gfx::Point& screen_point) { | 114 const gfx::Point& screen_point) { |
| 115 // TODO(dbeam): implement. | 115 // TODO(dbeam): implement. |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 [sheet_delegate_ accept:nil]; | 149 [sheet_delegate_ accept:nil]; |
| 150 } | 150 } |
| 151 | 151 |
| 152 void AutofillDialogCocoa::CancelForTesting() { | 152 void AutofillDialogCocoa::CancelForTesting() { |
| 153 [sheet_delegate_ cancel:nil]; | 153 [sheet_delegate_ cancel:nil]; |
| 154 } | 154 } |
| 155 | 155 |
| 156 string16 AutofillDialogCocoa::GetTextContentsOfInput(const DetailInput& input) { | 156 string16 AutofillDialogCocoa::GetTextContentsOfInput(const DetailInput& input) { |
| 157 for (size_t i = SECTION_MIN; i <= SECTION_MAX; ++i) { | 157 for (size_t i = SECTION_MIN; i <= SECTION_MAX; ++i) { |
| 158 DialogSection section = static_cast<DialogSection>(i); | 158 DialogSection section = static_cast<DialogSection>(i); |
| 159 DetailOutputMap contents; | 159 FieldValueMap contents; |
| 160 [sheet_delegate_ getInputs:&contents forSection:section]; | 160 [sheet_delegate_ getInputs:&contents forSection:section]; |
| 161 DetailOutputMap::const_iterator it = contents.find(&input); | 161 FieldValueMap::const_iterator it = contents.find(input.type); |
| 162 if (it != contents.end()) | 162 if (it != contents.end()) |
| 163 return it->second; | 163 return it->second; |
| 164 } | 164 } |
| 165 | 165 |
| 166 NOTREACHED(); | 166 NOTREACHED(); |
| 167 return string16(); | 167 return string16(); |
| 168 } | 168 } |
| 169 | 169 |
| 170 void AutofillDialogCocoa::SetTextContentsOfInput(const DetailInput& input, | 170 void AutofillDialogCocoa::SetTextContentsOfInput(const DetailInput& input, |
| 171 const string16& contents) { | 171 const string16& contents) { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 198 } | 198 } |
| 199 | 199 |
| 200 void AutofillDialogCocoa::OnConstrainedWindowClosed( | 200 void AutofillDialogCocoa::OnConstrainedWindowClosed( |
| 201 ConstrainedWindowMac* window) { | 201 ConstrainedWindowMac* window) { |
| 202 constrained_window_.reset(); | 202 constrained_window_.reset(); |
| 203 // |this| belongs to |delegate_|, so no self-destruction here. | 203 // |this| belongs to |delegate_|, so no self-destruction here. |
| 204 delegate_->ViewClosed(); | 204 delegate_->ViewClosed(); |
| 205 } | 205 } |
| 206 | 206 |
| 207 } // autofill | 207 } // autofill |
| OLD | NEW |