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

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

Issue 135933003: rAc: split TestableAutofillDialogView implementation into its own class (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: with mac nits fixed Created 6 years, 10 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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 } 127 }
128 128
129 void AutofillDialogCocoa::ModelChanged() { 129 void AutofillDialogCocoa::ModelChanged() {
130 [sheet_delegate_ modelChanged]; 130 [sheet_delegate_ modelChanged];
131 } 131 }
132 132
133 void AutofillDialogCocoa::UpdateErrorBubble() { 133 void AutofillDialogCocoa::UpdateErrorBubble() {
134 [sheet_delegate_ updateErrorBubble]; 134 [sheet_delegate_ updateErrorBubble];
135 } 135 }
136 136
137 TestableAutofillDialogView* AutofillDialogCocoa::GetTestableView() {
138 return this;
139 }
140
141 void AutofillDialogCocoa::OnSignInResize(const gfx::Size& pref_size) { 137 void AutofillDialogCocoa::OnSignInResize(const gfx::Size& pref_size) {
142 [sheet_delegate_ onSignInResize: 138 [sheet_delegate_ onSignInResize:
143 NSMakeSize(pref_size.width(), pref_size.height())]; 139 NSMakeSize(pref_size.width(), pref_size.height())];
144 } 140 }
145 141
146 void AutofillDialogCocoa::SubmitForTesting() {
147 [sheet_delegate_ accept:nil];
148 }
149
150 void AutofillDialogCocoa::CancelForTesting() {
151 [sheet_delegate_ cancel:nil];
152 }
153
154 base::string16 AutofillDialogCocoa::GetTextContentsOfInput(
155 ServerFieldType type) {
156 for (size_t i = SECTION_MIN; i <= SECTION_MAX; ++i) {
157 DialogSection section = static_cast<DialogSection>(i);
158 FieldValueMap contents;
159 [sheet_delegate_ getInputs:&contents forSection:section];
160 FieldValueMap::const_iterator it = contents.find(type);
161 if (it != contents.end())
162 return it->second;
163 }
164
165 NOTREACHED();
166 return base::string16();
167 }
168
169 void AutofillDialogCocoa::SetTextContentsOfInput(
170 ServerFieldType type,
171 const base::string16& contents) {
172 [sheet_delegate_ setTextContents:base::SysUTF16ToNSString(contents)
173 forType:type];
174 }
175
176 void AutofillDialogCocoa::SetTextContentsOfSuggestionInput(
177 DialogSection section,
178 const base::string16& text) {
179 [sheet_delegate_ setTextContents:base::SysUTF16ToNSString(text)
180 ofSuggestionForSection:section];
181 }
182
183 void AutofillDialogCocoa::ActivateInput(ServerFieldType type) {
184 [sheet_delegate_ activateFieldForType:type];
185 }
186
187 gfx::Size AutofillDialogCocoa::GetSize() const {
188 return gfx::Size(NSSizeToCGSize([[sheet_delegate_ window] frame].size));
189 }
190
191 content::WebContents* AutofillDialogCocoa::GetSignInWebContents() {
192 return [sheet_delegate_ getSignInWebContents];
193 }
194
195
196 bool AutofillDialogCocoa::IsShowingOverlay() const {
197 return [sheet_delegate_ isShowingOverlay];
198 }
199 142
200 void AutofillDialogCocoa::OnConstrainedWindowClosed( 143 void AutofillDialogCocoa::OnConstrainedWindowClosed(
201 ConstrainedWindowMac* window) { 144 ConstrainedWindowMac* window) {
202 constrained_window_.reset(); 145 constrained_window_.reset();
203 // |this| belongs to |delegate_|, so no self-destruction here. 146 // |this| belongs to |delegate_|, so no self-destruction here.
204 delegate_->ViewClosed(); 147 delegate_->ViewClosed();
205 } 148 }
206 149
207 } // autofill 150 } // autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698