Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(88)

Side by Side Diff: chrome/browser/ui/cocoa/autofill/autofill_dialog_cocoa.mm

Issue 130563003: Change all other AutofillDialogView methods with a const DetailInput& as a param (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 145
146 void AutofillDialogCocoa::SubmitForTesting() { 146 void AutofillDialogCocoa::SubmitForTesting() {
147 [sheet_delegate_ accept:nil]; 147 [sheet_delegate_ accept:nil];
148 } 148 }
149 149
150 void AutofillDialogCocoa::CancelForTesting() { 150 void AutofillDialogCocoa::CancelForTesting() {
151 [sheet_delegate_ cancel:nil]; 151 [sheet_delegate_ cancel:nil];
152 } 152 }
153 153
154 base::string16 AutofillDialogCocoa::GetTextContentsOfInput( 154 base::string16 AutofillDialogCocoa::GetTextContentsOfInput(
155 const DetailInput& input) { 155 ServerFieldType type) {
156 for (size_t i = SECTION_MIN; i <= SECTION_MAX; ++i) { 156 for (size_t i = SECTION_MIN; i <= SECTION_MAX; ++i) {
157 DialogSection section = static_cast<DialogSection>(i); 157 DialogSection section = static_cast<DialogSection>(i);
158 FieldValueMap contents; 158 FieldValueMap contents;
159 [sheet_delegate_ getInputs:&contents forSection:section]; 159 [sheet_delegate_ getInputs:&contents forSection:section];
160 FieldValueMap::const_iterator it = contents.find(input.type); 160 FieldValueMap::const_iterator it = contents.find(type);
161 if (it != contents.end()) 161 if (it != contents.end())
162 return it->second; 162 return it->second;
163 } 163 }
164 164
165 NOTREACHED(); 165 NOTREACHED();
166 return base::string16(); 166 return base::string16();
167 } 167 }
168 168
169 void AutofillDialogCocoa::SetTextContentsOfInput( 169 void AutofillDialogCocoa::SetTextContentsOfInput(
170 const DetailInput& input, 170 ServerFieldType type,
171 const base::string16& contents) { 171 const base::string16& contents) {
172 [sheet_delegate_ setTextContents:base::SysUTF16ToNSString(contents) 172 [sheet_delegate_ setTextContents:base::SysUTF16ToNSString(contents)
173 forInput:input]; 173 forType:type];
174 } 174 }
175 175
176 void AutofillDialogCocoa::SetTextContentsOfSuggestionInput( 176 void AutofillDialogCocoa::SetTextContentsOfSuggestionInput(
177 DialogSection section, 177 DialogSection section,
178 const base::string16& text) { 178 const base::string16& text) {
179 [sheet_delegate_ setTextContents:base::SysUTF16ToNSString(text) 179 [sheet_delegate_ setTextContents:base::SysUTF16ToNSString(text)
180 ofSuggestionForSection:section]; 180 ofSuggestionForSection:section];
181 } 181 }
182 182
183 void AutofillDialogCocoa::ActivateInput(const DetailInput& input) { 183 void AutofillDialogCocoa::ActivateInput(ServerFieldType type) {
184 [sheet_delegate_ activateFieldForInput:input]; 184 [sheet_delegate_ activateFieldForType:type];
185 } 185 }
186 186
187 gfx::Size AutofillDialogCocoa::GetSize() const { 187 gfx::Size AutofillDialogCocoa::GetSize() const {
188 return gfx::Size(NSSizeToCGSize([[sheet_delegate_ window] frame].size)); 188 return gfx::Size(NSSizeToCGSize([[sheet_delegate_ window] frame].size));
189 } 189 }
190 190
191 content::WebContents* AutofillDialogCocoa::GetSignInWebContents() { 191 content::WebContents* AutofillDialogCocoa::GetSignInWebContents() {
192 return [sheet_delegate_ getSignInWebContents]; 192 return [sheet_delegate_ getSignInWebContents];
193 } 193 }
194 194
195 195
196 bool AutofillDialogCocoa::IsShowingOverlay() const { 196 bool AutofillDialogCocoa::IsShowingOverlay() const {
197 return [sheet_delegate_ isShowingOverlay]; 197 return [sheet_delegate_ isShowingOverlay];
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698