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

Side by Side Diff: chrome/browser/ui/autofill/autofill_popup_controller_impl.cc

Issue 12302034: Always Close the Autofill UI through the same path (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/autofill/autofill_popup_controller_impl.h" 5 #include "chrome/browser/ui/autofill/autofill_popup_controller_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 } else { 165 } else {
166 UpdateBoundsAndRedrawPopup(); 166 UpdateBoundsAndRedrawPopup();
167 } 167 }
168 168
169 delegate_->OnPopupShown(this); 169 delegate_->OnPopupShown(this);
170 } 170 }
171 171
172 void AutofillPopupControllerImpl::Hide() { 172 void AutofillPopupControllerImpl::Hide() {
173 if (is_hiding_) 173 if (is_hiding_)
174 return; 174 return;
175 is_hiding_ = true; 175 is_hiding_ = true;
Ilya Sherman 2013/02/26 01:02:32 Since deletion now happens synchronously within th
csharp 2013/02/26 18:33:31 True, fixed.
176 176
177 SetSelectedLine(kNoSelection); 177 SetSelectedLine(kNoSelection);
178 178
179 delegate_->OnPopupHidden(this); 179 delegate_->OnPopupHidden(this);
180 180
181 if (view_) 181 if (view_)
182 view_->Hide(); 182 view_->Hide();
183 else 183
184 delete this; 184 delete this;
185 } 185 }
186 186
187 bool AutofillPopupControllerImpl::HandleKeyPressEvent( 187 bool AutofillPopupControllerImpl::HandleKeyPressEvent(
188 const content::NativeWebKeyboardEvent& event) { 188 const content::NativeWebKeyboardEvent& event) {
189 switch (event.windowsKeyCode) { 189 switch (event.windowsKeyCode) {
190 case ui::VKEY_UP: 190 case ui::VKEY_UP:
191 SelectPreviousLine(); 191 SelectPreviousLine();
192 return true; 192 return true;
193 case ui::VKEY_DOWN: 193 case ui::VKEY_DOWN:
194 SelectNextLine(); 194 SelectNextLine();
(...skipping 10 matching lines...) Expand all
205 case ui::VKEY_DELETE: 205 case ui::VKEY_DELETE:
206 return (event.modifiers & content::NativeWebKeyboardEvent::ShiftKey) && 206 return (event.modifiers & content::NativeWebKeyboardEvent::ShiftKey) &&
207 RemoveSelectedLine(); 207 RemoveSelectedLine();
208 case ui::VKEY_RETURN: 208 case ui::VKEY_RETURN:
209 return AcceptSelectedLine(); 209 return AcceptSelectedLine();
210 default: 210 default:
211 return false; 211 return false;
212 } 212 }
213 } 213 }
214 214
215 void AutofillPopupControllerImpl::ViewDestroyed() {
216 delete this;
217 }
218
219 void AutofillPopupControllerImpl::UpdateBoundsAndRedrawPopup() { 215 void AutofillPopupControllerImpl::UpdateBoundsAndRedrawPopup() {
220 #if !defined(OS_ANDROID) 216 #if !defined(OS_ANDROID)
221 // TODO(csharp): Since UpdatePopupBounds can change the position of the popup, 217 // TODO(csharp): Since UpdatePopupBounds can change the position of the popup,
222 // the popup could end up jumping from above the element to below it. 218 // the popup could end up jumping from above the element to below it.
223 // It is unclear if it is better to keep the popup where it was, or if it 219 // It is unclear if it is better to keep the popup where it was, or if it
224 // should try and move to its desired position. 220 // should try and move to its desired position.
225 UpdatePopupBounds(); 221 UpdatePopupBounds();
226 #endif 222 #endif
227 223
228 view_->UpdateBoundsAndRedrawPopup(); 224 view_->UpdateBoundsAndRedrawPopup();
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
654 if (bottom_available >= popup_required_height || 650 if (bottom_available >= popup_required_height ||
655 bottom_available >= top_available) { 651 bottom_available >= top_available) {
656 // The popup can appear below the field. 652 // The popup can appear below the field.
657 return std::make_pair(bottom_growth_start, popup_required_height); 653 return std::make_pair(bottom_growth_start, popup_required_height);
658 } else { 654 } else {
659 // The popup must appear above the field. 655 // The popup must appear above the field.
660 return std::make_pair(top_growth_end - popup_required_height, 656 return std::make_pair(top_growth_end - popup_required_height,
661 popup_required_height); 657 popup_required_height);
662 } 658 }
663 } 659 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698