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

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

Issue 21205007: [rAc Android] Remove the old dialog implementation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 7 years, 4 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 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 GetMetricLogger().LogDialogInitialUserState( 457 GetMetricLogger().LogDialogInitialUserState(
458 GetDialogType(), initial_user_state_); 458 GetDialogType(), initial_user_state_);
459 459
460 if (deemphasized_render_view_) { 460 if (deemphasized_render_view_) {
461 web_contents()->GetRenderViewHost()->Send( 461 web_contents()->GetRenderViewHost()->Send(
462 new ChromeViewMsg_SetVisuallyDeemphasized( 462 new ChromeViewMsg_SetVisuallyDeemphasized(
463 web_contents()->GetRenderViewHost()->GetRoutingID(), false)); 463 web_contents()->GetRenderViewHost()->GetRoutingID(), false));
464 } 464 }
465 } 465 }
466 466
467 #if !defined(OS_ANDROID)
467 // static 468 // static
468 base::WeakPtr<AutofillDialogControllerImpl> 469 base::WeakPtr<AutofillDialogControllerImpl>
469 AutofillDialogControllerImpl::Create( 470 AutofillDialogControllerImpl::Create(
470 content::WebContents* contents, 471 content::WebContents* contents,
471 const FormData& form_structure, 472 const FormData& form_structure,
472 const GURL& source_url, 473 const GURL& source_url,
473 const DialogType dialog_type, 474 const DialogType dialog_type,
474 const base::Callback<void(const FormStructure*, 475 const base::Callback<void(const FormStructure*,
475 const std::string&)>& callback) { 476 const std::string&)>& callback) {
476 // AutofillDialogControllerImpl owns itself. 477 // AutofillDialogControllerImpl owns itself.
477 AutofillDialogControllerImpl* autofill_dialog_controller = 478 AutofillDialogControllerImpl* autofill_dialog_controller =
478 new AutofillDialogControllerImpl(contents, 479 new AutofillDialogControllerImpl(contents,
479 form_structure, 480 form_structure,
480 source_url, 481 source_url,
481 dialog_type, 482 dialog_type,
482 callback); 483 callback);
483 return autofill_dialog_controller->weak_ptr_factory_.GetWeakPtr(); 484 return autofill_dialog_controller->weak_ptr_factory_.GetWeakPtr();
484 } 485 }
486 #endif // !defined(OS_ANDROID)
485 487
486 // static 488 // static
487 void AutofillDialogControllerImpl::RegisterProfilePrefs( 489 void AutofillDialogControllerImpl::RegisterProfilePrefs(
488 user_prefs::PrefRegistrySyncable* registry) { 490 user_prefs::PrefRegistrySyncable* registry) {
489 registry->RegisterIntegerPref( 491 registry->RegisterIntegerPref(
490 ::prefs::kAutofillDialogShowCount, 492 ::prefs::kAutofillDialogShowCount,
491 0, 493 0,
492 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); 494 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
493 registry->RegisterBooleanPref( 495 registry->RegisterBooleanPref(
494 ::prefs::kAutofillDialogHasPaidWithWallet, 496 ::prefs::kAutofillDialogHasPaidWithWallet,
(...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after
1221 1223
1222 // For other sections, only show a menu if there's at least one suggestion. 1224 // For other sections, only show a menu if there's at least one suggestion.
1223 for (int i = 0; i < model->GetItemCount(); ++i) { 1225 for (int i = 0; i < model->GetItemCount(); ++i) {
1224 if (IsASuggestionItemKey(model->GetItemKeyAt(i))) 1226 if (IsASuggestionItemKey(model->GetItemKeyAt(i)))
1225 return model; 1227 return model;
1226 } 1228 }
1227 1229
1228 return NULL; 1230 return NULL;
1229 } 1231 }
1230 1232
1231 #if defined(OS_ANDROID)
1232 ui::MenuModel* AutofillDialogControllerImpl::MenuModelForSectionHack(
1233 DialogSection section) {
1234 return SuggestionsMenuModelForSection(section);
1235 }
1236 #endif
1237
1238 ui::MenuModel* AutofillDialogControllerImpl::MenuModelForAccountChooser() { 1233 ui::MenuModel* AutofillDialogControllerImpl::MenuModelForAccountChooser() {
1239 // If there were unrecoverable Wallet errors, or if there are choices other 1234 // If there were unrecoverable Wallet errors, or if there are choices other
1240 // than "Pay without the wallet", show the full menu. 1235 // than "Pay without the wallet", show the full menu.
1241 if (account_chooser_model_.HadWalletError() || 1236 if (account_chooser_model_.HadWalletError() ||
1242 account_chooser_model_.HasAccountsToChoose()) { 1237 account_chooser_model_.HasAccountsToChoose()) {
1243 return &account_chooser_model_; 1238 return &account_chooser_model_;
1244 } 1239 }
1245 1240
1246 // Otherwise, there is no menu, just a sign in link. 1241 // Otherwise, there is no menu, just a sign in link.
1247 return NULL; 1242 return NULL;
(...skipping 1145 matching lines...) Expand 10 before | Expand all | Expand 10 after
2393 risk_data_.clear(); 2388 risk_data_.clear();
2394 2389
2395 uint64 obfuscated_gaia_id = 0; 2390 uint64 obfuscated_gaia_id = 0;
2396 bool success = base::StringToUint64(wallet_items_->obfuscated_gaia_id(), 2391 bool success = base::StringToUint64(wallet_items_->obfuscated_gaia_id(),
2397 &obfuscated_gaia_id); 2392 &obfuscated_gaia_id);
2398 DCHECK(success); 2393 DCHECK(success);
2399 2394
2400 gfx::Rect window_bounds; 2395 gfx::Rect window_bounds;
2401 #if !defined(OS_ANDROID) 2396 #if !defined(OS_ANDROID)
2402 window_bounds = GetBaseWindowForWebContents(web_contents())->GetBounds(); 2397 window_bounds = GetBaseWindowForWebContents(web_contents())->GetBounds();
2403 #else
2404 // TODO(dbeam): figure out the correct browser window size to pass along for
2405 // android.
2406 #endif 2398 #endif
2407 2399
2408 PrefService* user_prefs = profile_->GetPrefs(); 2400 PrefService* user_prefs = profile_->GetPrefs();
2409 std::string charset = user_prefs->GetString(::prefs::kDefaultCharset); 2401 std::string charset = user_prefs->GetString(::prefs::kDefaultCharset);
2410 std::string accept_languages = 2402 std::string accept_languages =
2411 user_prefs->GetString(::prefs::kAcceptLanguages); 2403 user_prefs->GetString(::prefs::kAcceptLanguages);
2412 base::Time install_time = base::Time::FromTimeT( 2404 base::Time install_time = base::Time::FromTimeT(
2413 g_browser_process->local_state()->GetInt64(::prefs::kInstallDate)); 2405 g_browser_process->local_state()->GetInt64(::prefs::kInstallDate));
2414 2406
2415 risk::GetFingerprint( 2407 risk::GetFingerprint(
(...skipping 17 matching lines...) Expand all
2433 } 2425 }
2434 2426
2435 void AutofillDialogControllerImpl::OpenTabWithUrl(const GURL& url) { 2427 void AutofillDialogControllerImpl::OpenTabWithUrl(const GURL& url) {
2436 #if !defined(OS_ANDROID) 2428 #if !defined(OS_ANDROID)
2437 chrome::NavigateParams params( 2429 chrome::NavigateParams params(
2438 chrome::FindBrowserWithWebContents(web_contents()), 2430 chrome::FindBrowserWithWebContents(web_contents()),
2439 url, 2431 url,
2440 content::PAGE_TRANSITION_AUTO_BOOKMARK); 2432 content::PAGE_TRANSITION_AUTO_BOOKMARK);
2441 params.disposition = NEW_FOREGROUND_TAB; 2433 params.disposition = NEW_FOREGROUND_TAB;
2442 chrome::Navigate(&params); 2434 chrome::Navigate(&params);
2443 #else
2444 // TODO(estade): use TabModelList?
2445 #endif 2435 #endif
2446 } 2436 }
2447 2437
2448 bool AutofillDialogControllerImpl::IsEditingExistingData( 2438 bool AutofillDialogControllerImpl::IsEditingExistingData(
2449 DialogSection section) const { 2439 DialogSection section) const {
2450 return section_editing_state_.count(section) > 0; 2440 return section_editing_state_.count(section) > 0;
2451 } 2441 }
2452 2442
2453 bool AutofillDialogControllerImpl::IsManuallyEditingSection( 2443 bool AutofillDialogControllerImpl::IsManuallyEditingSection(
2454 DialogSection section) const { 2444 DialogSection section) const {
(...skipping 1014 matching lines...) Expand 10 before | Expand all | Expand 10 after
3469 view_->GetUserInput(SECTION_CC_BILLING, &output); 3459 view_->GetUserInput(SECTION_CC_BILLING, &output);
3470 CreditCard card; 3460 CreditCard card;
3471 GetBillingInfoFromOutputs(output, &card, NULL, NULL); 3461 GetBillingInfoFromOutputs(output, &card, NULL, NULL);
3472 backing_last_four = card.TypeAndLastFourDigits(); 3462 backing_last_four = card.TypeAndLastFourDigits();
3473 } 3463 }
3474 AutofillCreditCardBubbleController::ShowGeneratedCardUI( 3464 AutofillCreditCardBubbleController::ShowGeneratedCardUI(
3475 web_contents(), backing_last_four, full_wallet_->TypeAndLastFourDigits()); 3465 web_contents(), backing_last_four, full_wallet_->TypeAndLastFourDigits());
3476 } 3466 }
3477 3467
3478 } // namespace autofill 3468 } // namespace autofill
OLDNEW
« no previous file with comments | « chrome/browser/ui/autofill/autofill_dialog_controller_impl.h ('k') | chrome/browser/ui/autofill/autofill_dialog_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698