OLD | NEW |
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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 #include "content/public/browser/notification_types.h" | 63 #include "content/public/browser/notification_types.h" |
64 #include "content/public/browser/render_view_host.h" | 64 #include "content/public/browser/render_view_host.h" |
65 #include "content/public/browser/web_contents.h" | 65 #include "content/public/browser/web_contents.h" |
66 #include "content/public/browser/web_contents_view.h" | 66 #include "content/public/browser/web_contents_view.h" |
67 #include "content/public/common/url_constants.h" | 67 #include "content/public/common/url_constants.h" |
68 #include "grit/chromium_strings.h" | 68 #include "grit/chromium_strings.h" |
69 #include "grit/component_strings.h" | 69 #include "grit/component_strings.h" |
70 #include "grit/generated_resources.h" | 70 #include "grit/generated_resources.h" |
71 #include "grit/theme_resources.h" | 71 #include "grit/theme_resources.h" |
72 #include "grit/webkit_resources.h" | 72 #include "grit/webkit_resources.h" |
73 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" | |
74 #include "net/cert/cert_status_flags.h" | 73 #include "net/cert/cert_status_flags.h" |
75 #include "ui/base/base_window.h" | 74 #include "ui/base/base_window.h" |
76 #include "ui/base/l10n/l10n_util.h" | 75 #include "ui/base/l10n/l10n_util.h" |
77 #include "ui/base/models/combobox_model.h" | 76 #include "ui/base/models/combobox_model.h" |
78 #include "ui/base/resource/resource_bundle.h" | 77 #include "ui/base/resource/resource_bundle.h" |
79 #include "ui/gfx/canvas.h" | 78 #include "ui/gfx/canvas.h" |
80 #include "ui/gfx/color_utils.h" | 79 #include "ui/gfx/color_utils.h" |
81 #include "ui/gfx/skbitmap_operations.h" | 80 #include "ui/gfx/skbitmap_operations.h" |
82 | 81 |
83 namespace autofill { | 82 namespace autofill { |
(...skipping 2007 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2091 should_show_wallet_promo_ = false; | 2090 should_show_wallet_promo_ = false; |
2092 account_chooser_model_.SelectActiveWalletAccount(); | 2091 account_chooser_model_.SelectActiveWalletAccount(); |
2093 signin_helper_.reset(new wallet::WalletSigninHelper( | 2092 signin_helper_.reset(new wallet::WalletSigninHelper( |
2094 this, profile_->GetRequestContext())); | 2093 this, profile_->GetRequestContext())); |
2095 signin_helper_->StartWalletCookieValueFetch(); | 2094 signin_helper_->StartWalletCookieValueFetch(); |
2096 HideSignIn(); | 2095 HideSignIn(); |
2097 } | 2096 } |
2098 } | 2097 } |
2099 | 2098 |
2100 //////////////////////////////////////////////////////////////////////////////// | 2099 //////////////////////////////////////////////////////////////////////////////// |
2101 // content::WebContentsObserver implementation. | |
2102 | |
2103 void AutofillDialogControllerImpl::DidNavigateMainFrame( | |
2104 const content::LoadCommittedDetails& details, | |
2105 const content::FrameNavigateParams& params) { | |
2106 // Close view if necessary. | |
2107 if (!net::registry_controlled_domains::SameDomainOrHost( | |
2108 details.previous_url, details.entry->GetURL(), | |
2109 net::registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES)) { | |
2110 Hide(); | |
2111 } | |
2112 } | |
2113 | |
2114 //////////////////////////////////////////////////////////////////////////////// | |
2115 // SuggestionsMenuModelDelegate implementation. | 2100 // SuggestionsMenuModelDelegate implementation. |
2116 | 2101 |
2117 void AutofillDialogControllerImpl::SuggestionItemSelected( | 2102 void AutofillDialogControllerImpl::SuggestionItemSelected( |
2118 SuggestionsMenuModel* model, | 2103 SuggestionsMenuModel* model, |
2119 size_t index) { | 2104 size_t index) { |
2120 if (model->GetItemKeyAt(index) == kManageItemsKey) { | 2105 if (model->GetItemKeyAt(index) == kManageItemsKey) { |
2121 GURL url; | 2106 GURL url; |
2122 if (!IsPayingWithWallet()) { | 2107 if (!IsPayingWithWallet()) { |
2123 GURL settings_url(chrome::kChromeUISettingsURL); | 2108 GURL settings_url(chrome::kChromeUISettingsURL); |
2124 url = settings_url.Resolve(chrome::kAutofillSubPage); | 2109 url = settings_url.Resolve(chrome::kAutofillSubPage); |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2346 return source_url_.SchemeIs(chrome::kHttpsScheme); | 2331 return source_url_.SchemeIs(chrome::kHttpsScheme); |
2347 } | 2332 } |
2348 | 2333 |
2349 AutofillDialogControllerImpl::AutofillDialogControllerImpl( | 2334 AutofillDialogControllerImpl::AutofillDialogControllerImpl( |
2350 content::WebContents* contents, | 2335 content::WebContents* contents, |
2351 const FormData& form_structure, | 2336 const FormData& form_structure, |
2352 const GURL& source_url, | 2337 const GURL& source_url, |
2353 const DialogType dialog_type, | 2338 const DialogType dialog_type, |
2354 const base::Callback<void(const FormStructure*, | 2339 const base::Callback<void(const FormStructure*, |
2355 const std::string&)>& callback) | 2340 const std::string&)>& callback) |
2356 : WebContentsObserver(contents), | 2341 : profile_(Profile::FromBrowserContext(contents->GetBrowserContext())), |
2357 profile_(Profile::FromBrowserContext(contents->GetBrowserContext())), | |
2358 contents_(contents), | 2342 contents_(contents), |
2359 initial_user_state_(AutofillMetrics::DIALOG_USER_STATE_UNKNOWN), | 2343 initial_user_state_(AutofillMetrics::DIALOG_USER_STATE_UNKNOWN), |
2360 dialog_type_(dialog_type), | 2344 dialog_type_(dialog_type), |
2361 form_structure_(form_structure, std::string()), | 2345 form_structure_(form_structure, std::string()), |
2362 invoked_from_same_origin_(true), | 2346 invoked_from_same_origin_(true), |
2363 source_url_(source_url), | 2347 source_url_(source_url), |
2364 callback_(callback), | 2348 callback_(callback), |
2365 account_chooser_model_(this, profile_->GetPrefs(), metric_logger_, | 2349 account_chooser_model_(this, profile_->GetPrefs(), metric_logger_, |
2366 dialog_type), | 2350 dialog_type), |
2367 wallet_client_(profile_->GetRequestContext(), this), | 2351 wallet_client_(profile_->GetRequestContext(), this), |
(...skipping 1122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3490 view_->GetUserInput(SECTION_CC_BILLING, &output); | 3474 view_->GetUserInput(SECTION_CC_BILLING, &output); |
3491 CreditCard card; | 3475 CreditCard card; |
3492 GetBillingInfoFromOutputs(output, &card, NULL, NULL); | 3476 GetBillingInfoFromOutputs(output, &card, NULL, NULL); |
3493 backing_last_four = card.TypeAndLastFourDigits(); | 3477 backing_last_four = card.TypeAndLastFourDigits(); |
3494 } | 3478 } |
3495 AutofillCreditCardBubbleController::ShowGeneratedCardBubble( | 3479 AutofillCreditCardBubbleController::ShowGeneratedCardBubble( |
3496 web_contents(), backing_last_four, full_wallet_->TypeAndLastFourDigits()); | 3480 web_contents(), backing_last_four, full_wallet_->TypeAndLastFourDigits()); |
3497 } | 3481 } |
3498 | 3482 |
3499 } // namespace autofill | 3483 } // namespace autofill |
OLD | NEW |