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

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

Issue 15987009: Update chrome/ to use WeakPtr<T>::get() instead of implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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/autofill/autofill_dialog_controller_impl.h" 5 #include "chrome/browser/ui/autofill/autofill_dialog_controller_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 std::vector<base::string16> split_name; 333 std::vector<base::string16> split_name;
334 base::SplitString(whitespace_collapsed_name, ' ', &split_name); 334 base::SplitString(whitespace_collapsed_name, ' ', &split_name);
335 return split_name.size() >= 2; 335 return split_name.size() >= 2;
336 } 336 }
337 337
338 } // namespace 338 } // namespace
339 339
340 AutofillDialogController::~AutofillDialogController() {} 340 AutofillDialogController::~AutofillDialogController() {}
341 341
342 AutofillDialogControllerImpl::~AutofillDialogControllerImpl() { 342 AutofillDialogControllerImpl::~AutofillDialogControllerImpl() {
343 if (popup_controller_) 343 if (popup_controller_.get())
344 popup_controller_->Hide(); 344 popup_controller_->Hide();
345 345
346 GetMetricLogger().LogDialogInitialUserState( 346 GetMetricLogger().LogDialogInitialUserState(
347 GetDialogType(), initial_user_state_); 347 GetDialogType(), initial_user_state_);
348 } 348 }
349 349
350 // static 350 // static
351 base::WeakPtr<AutofillDialogControllerImpl> 351 base::WeakPtr<AutofillDialogControllerImpl>
352 AutofillDialogControllerImpl::Create( 352 AutofillDialogControllerImpl::Create(
353 content::WebContents* contents, 353 content::WebContents* contents,
(...skipping 938 matching lines...) Expand 10 before | Expand all | Expand 10 after
1292 const string16& field_contents, 1292 const string16& field_contents,
1293 bool was_edit) { 1293 bool was_edit) {
1294 // If the field is edited down to empty, don't show a popup. 1294 // If the field is edited down to empty, don't show a popup.
1295 if (was_edit && field_contents.empty()) { 1295 if (was_edit && field_contents.empty()) {
1296 HidePopup(); 1296 HidePopup();
1297 return; 1297 return;
1298 } 1298 }
1299 1299
1300 // If the user clicks while the popup is already showing, be sure to hide 1300 // If the user clicks while the popup is already showing, be sure to hide
1301 // it. 1301 // it.
1302 if (!was_edit && popup_controller_) { 1302 if (!was_edit && popup_controller_.get()) {
1303 HidePopup(); 1303 HidePopup();
1304 return; 1304 return;
1305 } 1305 }
1306 1306
1307 std::vector<string16> popup_values, popup_labels, popup_icons; 1307 std::vector<string16> popup_values, popup_labels, popup_icons;
1308 if (IsCreditCardType(input->type)) { 1308 if (IsCreditCardType(input->type)) {
1309 GetManager()->GetCreditCardSuggestions(input->type, 1309 GetManager()->GetCreditCardSuggestions(input->type,
1310 field_contents, 1310 field_contents,
1311 &popup_values, 1311 &popup_values,
1312 &popup_labels, 1312 &popup_labels,
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after
1821 if (view_) { 1821 if (view_) {
1822 view_->UpdateAccountChooser(); 1822 view_->UpdateAccountChooser();
1823 view_->UpdateNotificationArea(); 1823 view_->UpdateNotificationArea();
1824 } 1824 }
1825 } 1825 }
1826 1826
1827 //////////////////////////////////////////////////////////////////////////////// 1827 ////////////////////////////////////////////////////////////////////////////////
1828 1828
1829 bool AutofillDialogControllerImpl::HandleKeyPressEventInInput( 1829 bool AutofillDialogControllerImpl::HandleKeyPressEventInInput(
1830 const content::NativeWebKeyboardEvent& event) { 1830 const content::NativeWebKeyboardEvent& event) {
1831 if (popup_controller_) 1831 if (popup_controller_.get())
1832 return popup_controller_->HandleKeyPressEvent(event); 1832 return popup_controller_->HandleKeyPressEvent(event);
1833 1833
1834 return false; 1834 return false;
1835 } 1835 }
1836 1836
1837 bool AutofillDialogControllerImpl::RequestingCreditCardInfo() const { 1837 bool AutofillDialogControllerImpl::RequestingCreditCardInfo() const {
1838 DCHECK_GT(form_structure_.field_count(), 0U); 1838 DCHECK_GT(form_structure_.field_count(), 0U);
1839 1839
1840 for (size_t i = 0; i < form_structure_.field_count(); ++i) { 1840 for (size_t i = 0; i < form_structure_.field_count(); ++i) {
1841 if (IsCreditCardType(form_structure_.field(i)->type())) 1841 if (IsCreditCardType(form_structure_.field(i)->type()))
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after
2365 DCHECK_EQ(&model, &suggested_shipping_); 2365 DCHECK_EQ(&model, &suggested_shipping_);
2366 return SECTION_SHIPPING; 2366 return SECTION_SHIPPING;
2367 } 2367 }
2368 2368
2369 DetailInputs* AutofillDialogControllerImpl::MutableRequestedFieldsForSection( 2369 DetailInputs* AutofillDialogControllerImpl::MutableRequestedFieldsForSection(
2370 DialogSection section) { 2370 DialogSection section) {
2371 return const_cast<DetailInputs*>(&RequestedFieldsForSection(section)); 2371 return const_cast<DetailInputs*>(&RequestedFieldsForSection(section));
2372 } 2372 }
2373 2373
2374 void AutofillDialogControllerImpl::HidePopup() { 2374 void AutofillDialogControllerImpl::HidePopup() {
2375 if (popup_controller_) 2375 if (popup_controller_.get())
2376 popup_controller_->Hide(); 2376 popup_controller_->Hide();
2377 input_showing_popup_ = NULL; 2377 input_showing_popup_ = NULL;
2378 } 2378 }
2379 2379
2380 bool AutofillDialogControllerImpl::IsEditingExistingData( 2380 bool AutofillDialogControllerImpl::IsEditingExistingData(
2381 DialogSection section) const { 2381 DialogSection section) const {
2382 return section_editing_state_.count(section) > 0; 2382 return section_editing_state_.count(section) > 0;
2383 } 2383 }
2384 2384
2385 void AutofillDialogControllerImpl::SetEditingExistingData( 2385 void AutofillDialogControllerImpl::SetEditingExistingData(
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after
2915 AutofillMetrics::DIALOG_USER_SIGNED_IN_NO_WALLET_NO_AUTOFILL; 2915 AutofillMetrics::DIALOG_USER_SIGNED_IN_NO_WALLET_NO_AUTOFILL;
2916 } 2916 }
2917 2917
2918 // Has Wallet items. 2918 // Has Wallet items.
2919 return has_autofill_profiles ? 2919 return has_autofill_profiles ?
2920 AutofillMetrics::DIALOG_USER_SIGNED_IN_HAS_WALLET_HAS_AUTOFILL : 2920 AutofillMetrics::DIALOG_USER_SIGNED_IN_HAS_WALLET_HAS_AUTOFILL :
2921 AutofillMetrics::DIALOG_USER_SIGNED_IN_HAS_WALLET_NO_AUTOFILL; 2921 AutofillMetrics::DIALOG_USER_SIGNED_IN_HAS_WALLET_NO_AUTOFILL;
2922 } 2922 }
2923 2923
2924 } // namespace autofill 2924 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698